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