shadow_.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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. #if !defined CONFIG_USE_BB_SHADOW
  18. #include <shadow.h>
  19. #else
  20. #ifndef _SHADOW_H
  21. #define _SHADOW_H 1
  22. #include <stdio.h>
  23. /* Paths to the user database files. */
  24. #ifndef _PATH_SHADOW
  25. #define _PATH_SHADOW "/etc/shadow"
  26. #endif
  27. #define SHADOW _PATH_SHADOW
  28. /* Structure of the password file. */
  29. struct spwd
  30. {
  31. char *sp_namp; /* Login name. */
  32. char *sp_pwdp; /* Encrypted password. */
  33. long int sp_lstchg; /* Date of last change. */
  34. long int sp_min; /* Minimum number of days between changes. */
  35. long int sp_max; /* Maximum number of days between changes. */
  36. long int sp_warn; /* Number of days to warn user to change
  37. the password. */
  38. long int sp_inact; /* Number of days the account may be
  39. inactive. */
  40. long int sp_expire; /* Number of days since 1970-01-01 until
  41. account expires. */
  42. unsigned long int sp_flag; /* Reserved. */
  43. };
  44. /* Open database for reading. */
  45. extern void setspent (void);
  46. /* Close database. */
  47. extern void endspent (void);
  48. /* Get next entry from database, perhaps after opening the file. */
  49. extern struct spwd *getspent (void);
  50. /* Get shadow entry matching NAME. */
  51. extern struct spwd *getspnam (__const char *__name);
  52. /* Read shadow entry from STRING. */
  53. extern struct spwd *sgetspent (__const char *__string);
  54. /* Read next shadow entry from STREAM. */
  55. extern struct spwd *fgetspent (FILE *__stream);
  56. /* Write line containing shadow password entry to stream. */
  57. extern int putspent (__const struct spwd *__p, FILE *__stream);
  58. /* Reentrant versions of some of the functions above. */
  59. extern int getspent_r (struct spwd *__result_buf, char *__buffer,
  60. size_t __buflen, struct spwd **__result);
  61. extern int getspnam_r (__const char *__name, struct spwd *__result_buf,
  62. char *__buffer, size_t __buflen,
  63. struct spwd **__result);
  64. extern int sgetspent_r (__const char *__string, struct spwd *__result_buf,
  65. char *__buffer, size_t __buflen,
  66. struct spwd **__result);
  67. extern int fgetspent_r (FILE *__stream, struct spwd *__result_buf,
  68. char *__buffer, size_t __buflen,
  69. struct spwd **__result);
  70. /* Protect password file against multi writers. */
  71. extern int lckpwdf (void);
  72. /* Unlock password file. */
  73. extern int ulckpwdf (void);
  74. #endif /* shadow.h */
  75. #endif