3
0

shadow_.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. /* vi: set sw=4 ts=4: */
  2. /* Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
  3. This file is part of the GNU C Library.
  4. The GNU C Library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Lesser General Public
  6. License as published by the Free Software Foundation; either
  7. version 2.1 of the License, or (at your option) any later version.
  8. The GNU C Library is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Lesser General Public License for more details.
  12. You should have received a copy of the GNU Lesser General Public
  13. License along with the GNU C Library; if not, write to the Free
  14. Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  15. 02111-1307 USA. */
  16. /* Declaration of types and functions for shadow password suite */
  17. #ifndef BB_SHADOW_H
  18. #define BB_SHADOW_H 1
  19. PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN
  20. /* Structure of the password file */
  21. struct spwd {
  22. char *sp_namp; /* Login name */
  23. char *sp_pwdp; /* Encrypted password */
  24. long sp_lstchg; /* Date of last change */
  25. long sp_min; /* Minimum number of days between changes */
  26. long sp_max; /* Maximum number of days between changes */
  27. long sp_warn; /* Number of days to warn user to change the password */
  28. long sp_inact; /* Number of days the account may be inactive */
  29. long sp_expire; /* Number of days since 1970-01-01 until account expires */
  30. unsigned long sp_flag; /* Reserved */
  31. };
  32. #define setspent bb_internal_setspent
  33. #define endspent bb_internal_endspent
  34. #define getspent bb_internal_getspent
  35. #define getspnam bb_internal_getspnam
  36. #define sgetspent bb_internal_sgetspent
  37. #define fgetspent bb_internal_fgetspent
  38. #define putspent bb_internal_putspent
  39. #define getspent_r bb_internal_getspent_r
  40. #define getspnam_r bb_internal_getspnam_r
  41. #define sgetspent_r bb_internal_sgetspent_r
  42. #define fgetspent_r bb_internal_fgetspent_r
  43. #define lckpwdf bb_internal_lckpwdf
  44. #define ulckpwdf bb_internal_ulckpwdf
  45. /* All function names below should be remapped by #defines above
  46. * in order to not collide with libc names. */
  47. #ifdef UNUSED_FOR_NOW
  48. /* Open database for reading */
  49. void FAST_FUNC setspent(void);
  50. /* Close database */
  51. void FAST_FUNC endspent(void);
  52. /* Get next entry from database, perhaps after opening the file */
  53. struct spwd* FAST_FUNC getspent(void);
  54. /* Get shadow entry matching NAME */
  55. struct spwd* FAST_FUNC getspnam(const char *__name);
  56. /* Read shadow entry from STRING */
  57. struct spwd* FAST_FUNC sgetspent(const char *__string);
  58. /* Read next shadow entry from STREAM */
  59. struct spwd* FAST_FUNC fgetspent(FILE *__stream);
  60. /* Write line containing shadow password entry to stream */
  61. int FAST_FUNC putspent(const struct spwd *__p, FILE *__stream);
  62. /* Reentrant versions of some of the functions above */
  63. int FAST_FUNC getspent_r(struct spwd *__result_buf, char *__buffer,
  64. size_t __buflen, struct spwd **__result);
  65. #endif
  66. int FAST_FUNC getspnam_r(const char *__name, struct spwd *__result_buf,
  67. char *__buffer, size_t __buflen,
  68. struct spwd **__result);
  69. #ifdef UNUSED_FOR_NOW
  70. int FAST_FUNC sgetspent_r(const char *__string, struct spwd *__result_buf,
  71. char *__buffer, size_t __buflen,
  72. struct spwd **__result);
  73. int FAST_FUNC fgetspent_r(FILE *__stream, struct spwd *__result_buf,
  74. char *__buffer, size_t __buflen,
  75. struct spwd **__result);
  76. /* Protect password file against multi writers */
  77. int FAST_FUNC lckpwdf(void);
  78. /* Unlock password file */
  79. int FAST_FUNC ulckpwdf(void);
  80. #endif
  81. POP_SAVED_FUNCTION_VISIBILITY
  82. #endif /* shadow.h */