shadow_.h 3.2 KB

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