1*53ee8cc1Swenshuai.xi /* Copyright (C) 1996, 1997, 1998, 1999, 2003 Free Software Foundation, Inc. 2*53ee8cc1Swenshuai.xi This file is part of the GNU C Library. 3*53ee8cc1Swenshuai.xi 4*53ee8cc1Swenshuai.xi The GNU C Library is free software; you can redistribute it and/or 5*53ee8cc1Swenshuai.xi modify it under the terms of the GNU Lesser General Public 6*53ee8cc1Swenshuai.xi License as published by the Free Software Foundation; either 7*53ee8cc1Swenshuai.xi version 2.1 of the License, or (at your option) any later version. 8*53ee8cc1Swenshuai.xi 9*53ee8cc1Swenshuai.xi The GNU C Library is distributed in the hope that it will be useful, 10*53ee8cc1Swenshuai.xi but WITHOUT ANY WARRANTY; without even the implied warranty of 11*53ee8cc1Swenshuai.xi MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12*53ee8cc1Swenshuai.xi Lesser General Public License for more details. 13*53ee8cc1Swenshuai.xi 14*53ee8cc1Swenshuai.xi You should have received a copy of the GNU Lesser General Public 15*53ee8cc1Swenshuai.xi License along with the GNU C Library; if not, write to the Free 16*53ee8cc1Swenshuai.xi Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 17*53ee8cc1Swenshuai.xi 02111-1307 USA. */ 18*53ee8cc1Swenshuai.xi 19*53ee8cc1Swenshuai.xi /* Declaration of types and functions for shadow password suite. */ 20*53ee8cc1Swenshuai.xi 21*53ee8cc1Swenshuai.xi #ifndef _SHADOW_H 22*53ee8cc1Swenshuai.xi #define _SHADOW_H 1 23*53ee8cc1Swenshuai.xi 24*53ee8cc1Swenshuai.xi #include <features.h> 25*53ee8cc1Swenshuai.xi 26*53ee8cc1Swenshuai.xi #include <paths.h> 27*53ee8cc1Swenshuai.xi 28*53ee8cc1Swenshuai.xi #define __need_FILE 29*53ee8cc1Swenshuai.xi #include <stdio.h> 30*53ee8cc1Swenshuai.xi #define __need_size_t 31*53ee8cc1Swenshuai.xi #include <stddef.h> 32*53ee8cc1Swenshuai.xi 33*53ee8cc1Swenshuai.xi /* Paths to the user database files. */ 34*53ee8cc1Swenshuai.xi #define SHADOW _PATH_SHADOW 35*53ee8cc1Swenshuai.xi 36*53ee8cc1Swenshuai.xi 37*53ee8cc1Swenshuai.xi __BEGIN_DECLS 38*53ee8cc1Swenshuai.xi 39*53ee8cc1Swenshuai.xi /* Structure of the password file. */ 40*53ee8cc1Swenshuai.xi struct spwd 41*53ee8cc1Swenshuai.xi { 42*53ee8cc1Swenshuai.xi char *sp_namp; /* Login name. */ 43*53ee8cc1Swenshuai.xi char *sp_pwdp; /* Encrypted password. */ 44*53ee8cc1Swenshuai.xi long int sp_lstchg; /* Date of last change. */ 45*53ee8cc1Swenshuai.xi long int sp_min; /* Minimum number of days between changes. */ 46*53ee8cc1Swenshuai.xi long int sp_max; /* Maximum number of days between changes. */ 47*53ee8cc1Swenshuai.xi long int sp_warn; /* Number of days to warn user to change 48*53ee8cc1Swenshuai.xi the password. */ 49*53ee8cc1Swenshuai.xi long int sp_inact; /* Number of days the account may be 50*53ee8cc1Swenshuai.xi inactive. */ 51*53ee8cc1Swenshuai.xi long int sp_expire; /* Number of days since 1970-01-01 until 52*53ee8cc1Swenshuai.xi account expires. */ 53*53ee8cc1Swenshuai.xi unsigned long int sp_flag; /* Reserved. */ 54*53ee8cc1Swenshuai.xi }; 55*53ee8cc1Swenshuai.xi 56*53ee8cc1Swenshuai.xi 57*53ee8cc1Swenshuai.xi /* Open database for reading. 58*53ee8cc1Swenshuai.xi 59*53ee8cc1Swenshuai.xi This function is not part of POSIX and therefore no official 60*53ee8cc1Swenshuai.xi cancellation point. But due to similarity with an POSIX interface 61*53ee8cc1Swenshuai.xi or due to the implementation it is a cancellation point and 62*53ee8cc1Swenshuai.xi therefore not marked with __THROW. */ 63*53ee8cc1Swenshuai.xi extern void setspent (void); 64*53ee8cc1Swenshuai.xi 65*53ee8cc1Swenshuai.xi /* Close database. 66*53ee8cc1Swenshuai.xi 67*53ee8cc1Swenshuai.xi This function is not part of POSIX and therefore no official 68*53ee8cc1Swenshuai.xi cancellation point. But due to similarity with an POSIX interface 69*53ee8cc1Swenshuai.xi or due to the implementation it is a cancellation point and 70*53ee8cc1Swenshuai.xi therefore not marked with __THROW. */ 71*53ee8cc1Swenshuai.xi extern void endspent (void); 72*53ee8cc1Swenshuai.xi 73*53ee8cc1Swenshuai.xi /* Get next entry from database, perhaps after opening the file. 74*53ee8cc1Swenshuai.xi 75*53ee8cc1Swenshuai.xi This function is not part of POSIX and therefore no official 76*53ee8cc1Swenshuai.xi cancellation point. But due to similarity with an POSIX interface 77*53ee8cc1Swenshuai.xi or due to the implementation it is a cancellation point and 78*53ee8cc1Swenshuai.xi therefore not marked with __THROW. */ 79*53ee8cc1Swenshuai.xi extern struct spwd *getspent (void); 80*53ee8cc1Swenshuai.xi 81*53ee8cc1Swenshuai.xi /* Get shadow entry matching NAME. 82*53ee8cc1Swenshuai.xi 83*53ee8cc1Swenshuai.xi This function is not part of POSIX and therefore no official 84*53ee8cc1Swenshuai.xi cancellation point. But due to similarity with an POSIX interface 85*53ee8cc1Swenshuai.xi or due to the implementation it is a cancellation point and 86*53ee8cc1Swenshuai.xi therefore not marked with __THROW. */ 87*53ee8cc1Swenshuai.xi extern struct spwd *getspnam (__const char *__name); 88*53ee8cc1Swenshuai.xi 89*53ee8cc1Swenshuai.xi /* Read shadow entry from STRING. 90*53ee8cc1Swenshuai.xi 91*53ee8cc1Swenshuai.xi This function is not part of POSIX and therefore no official 92*53ee8cc1Swenshuai.xi cancellation point. But due to similarity with an POSIX interface 93*53ee8cc1Swenshuai.xi or due to the implementation it is a cancellation point and 94*53ee8cc1Swenshuai.xi therefore not marked with __THROW. */ 95*53ee8cc1Swenshuai.xi extern struct spwd *sgetspent (__const char *__string); 96*53ee8cc1Swenshuai.xi 97*53ee8cc1Swenshuai.xi /* Read next shadow entry from STREAM. 98*53ee8cc1Swenshuai.xi 99*53ee8cc1Swenshuai.xi This function is not part of POSIX and therefore no official 100*53ee8cc1Swenshuai.xi cancellation point. But due to similarity with an POSIX interface 101*53ee8cc1Swenshuai.xi or due to the implementation it is a cancellation point and 102*53ee8cc1Swenshuai.xi therefore not marked with __THROW. */ 103*53ee8cc1Swenshuai.xi extern struct spwd *fgetspent (FILE *__stream); 104*53ee8cc1Swenshuai.xi 105*53ee8cc1Swenshuai.xi /* Write line containing shadow password entry to stream. 106*53ee8cc1Swenshuai.xi 107*53ee8cc1Swenshuai.xi This function is not part of POSIX and therefore no official 108*53ee8cc1Swenshuai.xi cancellation point. But due to similarity with an POSIX interface 109*53ee8cc1Swenshuai.xi or due to the implementation it is a cancellation point and 110*53ee8cc1Swenshuai.xi therefore not marked with __THROW. */ 111*53ee8cc1Swenshuai.xi extern int putspent (__const struct spwd *__p, FILE *__stream); 112*53ee8cc1Swenshuai.xi 113*53ee8cc1Swenshuai.xi 114*53ee8cc1Swenshuai.xi #ifdef __USE_MISC 115*53ee8cc1Swenshuai.xi /* Reentrant versions of some of the functions above. 116*53ee8cc1Swenshuai.xi 117*53ee8cc1Swenshuai.xi These functions are not part of POSIX and therefore no official 118*53ee8cc1Swenshuai.xi cancellation point. But due to similarity with an POSIX interface 119*53ee8cc1Swenshuai.xi or due to the implementation they are cancellation points and 120*53ee8cc1Swenshuai.xi therefore not marked with __THROW. */ 121*53ee8cc1Swenshuai.xi extern int getspent_r (struct spwd *__result_buf, char *__buffer, 122*53ee8cc1Swenshuai.xi size_t __buflen, struct spwd **__result); 123*53ee8cc1Swenshuai.xi 124*53ee8cc1Swenshuai.xi extern int getspnam_r (__const char *__name, struct spwd *__result_buf, 125*53ee8cc1Swenshuai.xi char *__buffer, size_t __buflen, 126*53ee8cc1Swenshuai.xi struct spwd **__result); 127*53ee8cc1Swenshuai.xi 128*53ee8cc1Swenshuai.xi extern int sgetspent_r (__const char *__string, struct spwd *__result_buf, 129*53ee8cc1Swenshuai.xi char *__buffer, size_t __buflen, 130*53ee8cc1Swenshuai.xi struct spwd **__result); 131*53ee8cc1Swenshuai.xi 132*53ee8cc1Swenshuai.xi extern int fgetspent_r (FILE *__stream, struct spwd *__result_buf, 133*53ee8cc1Swenshuai.xi char *__buffer, size_t __buflen, 134*53ee8cc1Swenshuai.xi struct spwd **__result); 135*53ee8cc1Swenshuai.xi #endif /* misc */ 136*53ee8cc1Swenshuai.xi 137*53ee8cc1Swenshuai.xi 138*53ee8cc1Swenshuai.xi /* The simple locking functionality provided here is not suitable for 139*53ee8cc1Swenshuai.xi multi-threaded applications. */ 140*53ee8cc1Swenshuai.xi 141*53ee8cc1Swenshuai.xi /* Protect password file against multi writers. */ 142*53ee8cc1Swenshuai.xi extern int lckpwdf (void) __THROW; 143*53ee8cc1Swenshuai.xi 144*53ee8cc1Swenshuai.xi /* Unlock password file. */ 145*53ee8cc1Swenshuai.xi extern int ulckpwdf (void) __THROW; 146*53ee8cc1Swenshuai.xi 147*53ee8cc1Swenshuai.xi __END_DECLS 148*53ee8cc1Swenshuai.xi 149*53ee8cc1Swenshuai.xi #endif /* shadow.h */ 150