shadow.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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. #ifndef _SHADOW_H
  17. #define _SHADOW_H 1
  18. #include <features.h>
  19. #include <paths.h>
  20. #define __need_FILE
  21. #include <stdio.h>
  22. #define __need_size_t
  23. #include <stddef.h>
  24. /* Paths to the user database files. */
  25. #define SHADOW _PATH_SHADOW
  26. __BEGIN_DECLS
  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) __THROW;
  45. /* Close database. */
  46. extern void endspent (void) __THROW;
  47. /* Get next entry from database, perhaps after opening the file. */
  48. extern struct spwd *getspent (void) __THROW;
  49. /* Get shadow entry matching NAME. */
  50. extern struct spwd *getspnam (__const char *__name) __THROW;
  51. /* Read shadow entry from STRING. */
  52. extern struct spwd *sgetspent (__const char *__string) __THROW;
  53. /* Read next shadow entry from STREAM. */
  54. extern struct spwd *fgetspent (FILE *__stream) __THROW;
  55. /* Write line containing shadow password entry to stream. */
  56. extern int putspent (__const struct spwd *__p, FILE *__stream) __THROW;
  57. #ifdef __USE_MISC
  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) __THROW;
  61. extern int getspnam_r (__const char *__name, struct spwd *__result_buf,
  62. char *__buffer, size_t __buflen,
  63. struct spwd **__result)__THROW;
  64. extern int sgetspent_r (__const char *__string, struct spwd *__result_buf,
  65. char *__buffer, size_t __buflen,
  66. struct spwd **__result) __THROW;
  67. extern int fgetspent_r (FILE *__stream, struct spwd *__result_buf,
  68. char *__buffer, size_t __buflen,
  69. struct spwd **__result) __THROW;
  70. #endif /* misc */
  71. /* Protect password file against multi writers. */
  72. extern int lckpwdf (void) __THROW;
  73. /* Unlock password file. */
  74. extern int ulckpwdf (void) __THROW;
  75. __END_DECLS
  76. #endif /* shadow.h */