shadow_.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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. /* Paths to the user database files */
  33. #ifndef _PATH_SHADOW
  34. #define _PATH_SHADOW "/etc/shadow"
  35. #endif
  36. #define setspent bb_internal_setspent
  37. #define endspent bb_internal_endspent
  38. #define getspent bb_internal_getspent
  39. #define getspnam bb_internal_getspnam
  40. #define sgetspent bb_internal_sgetspent
  41. #define fgetspent bb_internal_fgetspent
  42. #define putspent bb_internal_putspent
  43. #define getspent_r bb_internal_getspent_r
  44. #define getspnam_r bb_internal_getspnam_r
  45. #define sgetspent_r bb_internal_sgetspent_r
  46. #define fgetspent_r bb_internal_fgetspent_r
  47. #define lckpwdf bb_internal_lckpwdf
  48. #define ulckpwdf bb_internal_ulckpwdf
  49. /* All function names below should be remapped by #defines above
  50. * in order to not collide with libc names. */
  51. #ifdef UNUSED_FOR_NOW
  52. /* Open database for reading */
  53. extern void setspent(void);
  54. /* Close database */
  55. extern void endspent(void);
  56. /* Get next entry from database, perhaps after opening the file */
  57. extern struct spwd *getspent(void);
  58. /* Get shadow entry matching NAME */
  59. extern struct spwd *getspnam(const char *__name);
  60. /* Read shadow entry from STRING */
  61. extern struct spwd *sgetspent(const char *__string);
  62. /* Read next shadow entry from STREAM */
  63. extern struct spwd *fgetspent(FILE *__stream);
  64. /* Write line containing shadow password entry to stream */
  65. extern int putspent(const struct spwd *__p, FILE *__stream);
  66. /* Reentrant versions of some of the functions above */
  67. extern int getspent_r(struct spwd *__result_buf, char *__buffer,
  68. size_t __buflen, struct spwd **__result);
  69. #endif
  70. extern int getspnam_r(const char *__name, struct spwd *__result_buf,
  71. char *__buffer, size_t __buflen,
  72. struct spwd **__result);
  73. #ifdef UNUSED_FOR_NOW
  74. extern int sgetspent_r(const char *__string, struct spwd *__result_buf,
  75. char *__buffer, size_t __buflen,
  76. struct spwd **__result);
  77. extern int fgetspent_r(FILE *__stream, struct spwd *__result_buf,
  78. char *__buffer, size_t __buflen,
  79. struct spwd **__result);
  80. /* Protect password file against multi writers */
  81. extern int lckpwdf(void);
  82. /* Unlock password file */
  83. extern int ulckpwdf(void);
  84. #endif
  85. POP_SAVED_FUNCTION_VISIBILITY
  86. #endif /* shadow.h */