(Hash Search Function): Describe that memory must be cleared before calling hcreate_r.
[glibc.git] / shadow / shadow.h
blob81ddc71f1ad5972c607c7698b25e01a85d4a431f
1 /* Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
2 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.
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, write to the Free
16 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
17 02111-1307 USA. */
19 /* Declaration of types and functions for shadow password suite. */
21 #ifndef _SHADOW_H
22 #define _SHADOW_H 1
24 #include <features.h>
26 #include <paths.h>
28 #define __need_FILE
29 #include <stdio.h>
30 #define __need_size_t
31 #include <stddef.h>
33 /* Paths to the user database files. */
34 #define SHADOW _PATH_SHADOW
37 __BEGIN_DECLS
39 /* Structure of the password file. */
40 struct spwd
42 char *sp_namp; /* Login name. */
43 char *sp_pwdp; /* Encrypted password. */
44 long int sp_lstchg; /* Date of last change. */
45 long int sp_min; /* Minimum number of days between changes. */
46 long int sp_max; /* Maximum number of days between changes. */
47 long int sp_warn; /* Number of days to warn user to change
48 the password. */
49 long int sp_inact; /* Number of days the account may be
50 inactive. */
51 long int sp_expire; /* Number of days since 1970-01-01 until
52 account expires. */
53 unsigned long int sp_flag; /* Reserved. */
57 /* Open database for reading. */
58 extern void setspent (void) __THROW;
60 /* Close database. */
61 extern void endspent (void) __THROW;
63 /* Get next entry from database, perhaps after opening the file. */
64 extern struct spwd *getspent (void) __THROW;
66 /* Get shadow entry matching NAME. */
67 extern struct spwd *getspnam (__const char *__name) __THROW;
69 /* Read shadow entry from STRING. */
70 extern struct spwd *sgetspent (__const char *__string) __THROW;
72 /* Read next shadow entry from STREAM. */
73 extern struct spwd *fgetspent (FILE *__stream) __THROW;
75 /* Write line containing shadow password entry to stream. */
76 extern int putspent (__const struct spwd *__p, FILE *__stream) __THROW;
79 #ifdef __USE_MISC
80 /* Reentrant versions of some of the functions above. */
81 extern int getspent_r (struct spwd *__result_buf, char *__buffer,
82 size_t __buflen, struct spwd **__result) __THROW;
84 extern int getspnam_r (__const char *__name, struct spwd *__result_buf,
85 char *__buffer, size_t __buflen,
86 struct spwd **__result)__THROW;
88 extern int sgetspent_r (__const char *__string, struct spwd *__result_buf,
89 char *__buffer, size_t __buflen,
90 struct spwd **__result) __THROW;
92 extern int fgetspent_r (FILE *__stream, struct spwd *__result_buf,
93 char *__buffer, size_t __buflen,
94 struct spwd **__result) __THROW;
95 #endif /* misc */
97 /* Protect password file against multi writers. */
98 extern int lckpwdf (void) __THROW;
100 /* Unlock password file. */
101 extern int ulckpwdf (void) __THROW;
103 __END_DECLS
105 #endif /* shadow.h */