diff options
author | Eric Andersen <andersen@codepoet.org> | 2004-07-15 12:53:49 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2004-07-15 12:53:49 +0000 |
commit | 9615a08218caa63c4221a6b5922c628328e719d1 (patch) | |
tree | 863532a14dd40a1009cee3dac1dfa7fdd8bea653 /include/shadow_.h | |
parent | 837f058fb307e0bcf7b9ad4f02a44ea3047f427e (diff) | |
download | busybox-w32-9615a08218caa63c4221a6b5922c628328e719d1.tar.gz busybox-w32-9615a08218caa63c4221a6b5922c628328e719d1.tar.bz2 busybox-w32-9615a08218caa63c4221a6b5922c628328e719d1.zip |
Replace the old and somewhat buggy pwd_grp stuff with the shiny
new stuff mjn3 wrote for uClibc
Diffstat (limited to 'include/shadow_.h')
-rw-r--r-- | include/shadow_.h | 162 |
1 files changed, 89 insertions, 73 deletions
diff --git a/include/shadow_.h b/include/shadow_.h index a677d5262..1b14f0a7b 100644 --- a/include/shadow_.h +++ b/include/shadow_.h | |||
@@ -1,82 +1,98 @@ | |||
1 | /* | 1 | /* Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc. |
2 | * Copyright 1988 - 1994, Julianne Frances Haugh <jockgrrl@austin.rr.com> | 2 | This file is part of the GNU C Library. |
3 | * All rights reserved. | 3 | |
4 | * | 4 | The GNU C Library is free software; you can redistribute it and/or |
5 | * Redistribution and use in source and binary forms, with or without | 5 | modify it under the terms of the GNU Lesser General Public |
6 | * modification, are permitted provided that the following conditions | 6 | License as published by the Free Software Foundation; either |
7 | * are met: | 7 | version 2.1 of the License, or (at your option) any later version. |
8 | * 1. Redistributions of source code must retain the above copyright | 8 | |
9 | * notice, this list of conditions and the following disclaimer. | 9 | The GNU C Library is distributed in the hope that it will be useful, |
10 | * 2. Redistributions in binary form must reproduce the above copyright | 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | * notice, this list of conditions and the following disclaimer in the | 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
12 | * documentation and/or other materials provided with the distribution. | 12 | Lesser General Public License for more details. |
13 | * 3. Neither the name of Julianne F. Haugh nor the names of its contributors | 13 | |
14 | * may be used to endorse or promote products derived from this software | 14 | You should have received a copy of the GNU Lesser General Public |
15 | * without specific prior written permission. | 15 | License along with the GNU C Library; if not, write to the Free |
16 | * | 16 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
17 | * THIS SOFTWARE IS PROVIDED BY JULIE HAUGH AND CONTRIBUTORS ``AS IS'' AND | 17 | 02111-1307 USA. */ |
18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 18 | |
19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 19 | /* Declaration of types and functions for shadow password suite. */ |
20 | * ARE DISCLAIMED. IN NO EVENT SHALL JULIE HAUGH OR CONTRIBUTORS BE LIABLE | 20 | |
21 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 21 | #if !defined CONFIG_USE_BB_SHADOW |
22 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
23 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
24 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
25 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
26 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
27 | * SUCH DAMAGE. | ||
28 | */ | ||
29 | |||
30 | #ifndef _H_SHADOW | ||
31 | #define _H_SHADOW | ||
32 | |||
33 | |||
34 | #ifdef USE_SYSTEM_SHADOW | ||
35 | #include <shadow.h> | 22 | #include <shadow.h> |
36 | #else | 23 | #else |
37 | 24 | ||
38 | /* | 25 | #ifndef _SHADOW_H |
39 | * This information is not derived from AT&T licensed sources. Posted | 26 | #define _SHADOW_H 1 |
40 | * to the USENET 11/88, and updated 11/90 with information from SVR4. | 27 | |
41 | * | 28 | #include <stdio.h> |
42 | * $Id: shadow_.h,v 1.1 2002/06/23 04:24:20 andersen Exp $ | 29 | |
43 | */ | 30 | /* Paths to the user database files. */ |
44 | 31 | #ifndef _PATH_SHADOW | |
45 | typedef long sptime; | 32 | #define _PATH_SHADOW "/etc/shadow" |
46 | 33 | #endif | |
47 | /* | 34 | #define SHADOW _PATH_SHADOW |
48 | * Shadow password security file structure. | 35 | |
49 | */ | 36 | |
50 | 37 | /* Structure of the password file. */ | |
51 | struct spwd { | 38 | struct spwd |
52 | char *sp_namp; /* login name */ | 39 | { |
53 | char *sp_pwdp; /* encrypted password */ | 40 | char *sp_namp; /* Login name. */ |
54 | sptime sp_lstchg; /* date of last change */ | 41 | char *sp_pwdp; /* Encrypted password. */ |
55 | sptime sp_min; /* minimum number of days between changes */ | 42 | long int sp_lstchg; /* Date of last change. */ |
56 | sptime sp_max; /* maximum number of days between changes */ | 43 | long int sp_min; /* Minimum number of days between changes. */ |
57 | sptime sp_warn; /* number of days of warning before password | 44 | long int sp_max; /* Maximum number of days between changes. */ |
58 | expires */ | 45 | long int sp_warn; /* Number of days to warn user to change |
59 | sptime sp_inact; /* number of days after password expires | 46 | the password. */ |
60 | until the account becomes unusable. */ | 47 | long int sp_inact; /* Number of days the account may be |
61 | sptime sp_expire; /* days since 1/1/70 until account expires */ | 48 | inactive. */ |
62 | unsigned long sp_flag; /* reserved for future use */ | 49 | long int sp_expire; /* Number of days since 1970-01-01 until |
50 | account expires. */ | ||
51 | unsigned long int sp_flag; /* Reserved. */ | ||
63 | }; | 52 | }; |
64 | 53 | ||
65 | /* | ||
66 | * Shadow password security file functions. | ||
67 | */ | ||
68 | 54 | ||
69 | #include <stdio.h> /* for FILE */ | 55 | /* Open database for reading. */ |
56 | extern void setspent (void); | ||
57 | |||
58 | /* Close database. */ | ||
59 | extern void endspent (void); | ||
60 | |||
61 | /* Get next entry from database, perhaps after opening the file. */ | ||
62 | extern struct spwd *getspent (void); | ||
63 | |||
64 | /* Get shadow entry matching NAME. */ | ||
65 | extern struct spwd *getspnam (__const char *__name); | ||
66 | |||
67 | /* Read shadow entry from STRING. */ | ||
68 | extern struct spwd *sgetspent (__const char *__string); | ||
69 | |||
70 | /* Read next shadow entry from STREAM. */ | ||
71 | extern struct spwd *fgetspent (FILE *__stream); | ||
72 | |||
73 | /* Write line containing shadow password entry to stream. */ | ||
74 | extern int putspent (__const struct spwd *__p, FILE *__stream); | ||
75 | |||
76 | /* Reentrant versions of some of the functions above. */ | ||
77 | extern int getspent_r (struct spwd *__result_buf, char *__buffer, | ||
78 | size_t __buflen, struct spwd **__result); | ||
79 | |||
80 | extern int getspnam_r (__const char *__name, struct spwd *__result_buf, | ||
81 | char *__buffer, size_t __buflen, | ||
82 | struct spwd **__result)__THROW; | ||
83 | |||
84 | extern int sgetspent_r (__const char *__string, struct spwd *__result_buf, | ||
85 | char *__buffer, size_t __buflen, | ||
86 | struct spwd **__result); | ||
70 | 87 | ||
71 | extern struct spwd *getspent(void); | 88 | extern int fgetspent_r (FILE *__stream, struct spwd *__result_buf, |
72 | extern struct spwd *sgetspent(const char *); | 89 | char *__buffer, size_t __buflen, |
73 | extern struct spwd *fgetspent(FILE *); | 90 | struct spwd **__result); |
74 | extern void setspent(void); | 91 | /* Protect password file against multi writers. */ |
75 | extern void endspent(void); | 92 | extern int lckpwdf (void); |
76 | extern int putspent(const struct spwd *, FILE *); | ||
77 | extern struct spwd *getspnam(const char *name); | ||
78 | extern struct spwd *pwd_to_spwd(const struct passwd *pw); | ||
79 | 93 | ||
80 | #endif /* USE_LOCAL_SHADOW */ | 94 | /* Unlock password file. */ |
95 | extern int ulckpwdf (void); | ||
81 | 96 | ||
82 | #endif /* _H_SHADOW */ | 97 | #endif /* shadow.h */ |
98 | #endif | ||