diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/grp_.h | 113 | ||||
-rw-r--r-- | include/pwd_.h | 105 | ||||
-rw-r--r-- | include/shadow_.h | 162 |
3 files changed, 269 insertions, 111 deletions
diff --git a/include/grp_.h b/include/grp_.h index 7cb0d4af6..b212b0b4a 100644 --- a/include/grp_.h +++ b/include/grp_.h | |||
@@ -1,39 +1,116 @@ | |||
1 | #ifndef __CONFIG_GRP_H | 1 | /* Copyright (C) 1991,92,95,96,97,98,99,2000,01 Free Software Foundation, Inc. |
2 | #define __CONFIG_GRP_H | 2 | This file is part of the GNU C Library. |
3 | |||
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. | ||
8 | |||
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. | ||
13 | |||
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. */ | ||
18 | |||
19 | /* | ||
20 | * POSIX Standard: 9.2.1 Group Database Access <grp.h> | ||
21 | */ | ||
22 | |||
3 | 23 | ||
4 | #if !defined CONFIG_USE_BB_PWD_GRP | 24 | #if !defined CONFIG_USE_BB_PWD_GRP |
5 | #include <grp.h> | 25 | #include <grp.h> |
6 | 26 | ||
7 | #else | 27 | #else |
8 | 28 | ||
29 | #ifndef _GRP_H | ||
30 | #define _GRP_H 1 | ||
31 | |||
32 | |||
9 | #include <sys/types.h> | 33 | #include <sys/types.h> |
10 | #include <features.h> | 34 | #include <features.h> |
11 | #include <stdio.h> | 35 | #include <stdio.h> |
12 | 36 | ||
13 | 37 | ||
14 | /* The group structure */ | 38 | /* The group structure. */ |
15 | struct group | 39 | struct group |
16 | { | 40 | { |
17 | char *gr_name; /* Group name. */ | 41 | char *gr_name; /* Group name. */ |
18 | char *gr_passwd; /* Password. */ | 42 | char *gr_passwd; /* Password. */ |
19 | gid_t gr_gid; /* Group ID. */ | 43 | gid_t gr_gid; /* Group ID. */ |
20 | char **gr_mem; /* Member list. */ | 44 | char **gr_mem; /* Member list. */ |
21 | }; | 45 | }; |
22 | 46 | ||
23 | extern void setgrent __P ((void)); | ||
24 | extern void endgrent __P ((void)); | ||
25 | extern struct group * getgrent __P ((void)); | ||
26 | 47 | ||
27 | extern struct group * getgrgid __P ((__const gid_t gid)); | 48 | /* Rewind the group-file stream. */ |
28 | extern struct group * getgrnam __P ((__const char * name)); | 49 | extern void setgrent (void); |
50 | |||
51 | /* Close the group-file stream. */ | ||
52 | extern void endgrent (void); | ||
53 | |||
54 | /* Read an entry from the group-file stream, opening it if necessary. */ | ||
55 | extern struct group *getgrent (void); | ||
56 | |||
57 | /* Read a group entry from STREAM. */ | ||
58 | extern struct group *fgetgrent (FILE *__stream); | ||
59 | |||
60 | /* Write the given entry onto the given stream. */ | ||
61 | extern int putgrent (__const struct group *__restrict __p, | ||
62 | FILE *__restrict __f); | ||
63 | |||
64 | /* Search for an entry with a matching group ID. */ | ||
65 | extern struct group *getgrgid (gid_t __gid); | ||
66 | |||
67 | /* Search for an entry with a matching group name. */ | ||
68 | extern struct group *getgrnam (__const char *__name); | ||
69 | |||
70 | /* Reentrant versions of some of the functions above. | ||
71 | |||
72 | PLEASE NOTE: the `getgrent_r' function is not (yet) standardized. | ||
73 | The interface may change in later versions of this library. But | ||
74 | the interface is designed following the principals used for the | ||
75 | other reentrant functions so the chances are good this is what the | ||
76 | POSIX people would choose. */ | ||
77 | |||
78 | extern int getgrent_r (struct group *__restrict __resultbuf, | ||
79 | char *__restrict __buffer, size_t __buflen, | ||
80 | struct group **__restrict __result); | ||
81 | |||
82 | /* Search for an entry with a matching group ID. */ | ||
83 | extern int getgrgid_r (gid_t __gid, struct group *__restrict __resultbuf, | ||
84 | char *__restrict __buffer, size_t __buflen, | ||
85 | struct group **__restrict __result); | ||
86 | |||
87 | /* Search for an entry with a matching group name. */ | ||
88 | extern int getgrnam_r (__const char *__restrict __name, | ||
89 | struct group *__restrict __resultbuf, | ||
90 | char *__restrict __buffer, size_t __buflen, | ||
91 | struct group **__restrict __result); | ||
92 | |||
93 | /* Read a group entry from STREAM. This function is not standardized | ||
94 | an probably never will. */ | ||
95 | extern int fgetgrent_r (FILE *__restrict __stream, | ||
96 | struct group *__restrict __resultbuf, | ||
97 | char *__restrict __buffer, size_t __buflen, | ||
98 | struct group **__restrict __result); | ||
29 | 99 | ||
30 | extern struct group * fgetgrent __P ((FILE * file)); | 100 | /* Set the group set for the current user to GROUPS (N of them). */ |
101 | extern int setgroups (size_t __n, __const gid_t *__groups); | ||
31 | 102 | ||
32 | extern int setgroups __P ((size_t n, __const gid_t * groups)); | 103 | /* Store at most *NGROUPS members of the group set for USER into |
33 | extern int initgroups __P ((__const char * user, gid_t gid)); | 104 | *GROUPS. Also include GROUP. The actual number of groups found is |
105 | returned in *NGROUPS. Return -1 if the if *NGROUPS is too small. */ | ||
106 | extern int getgrouplist (__const char *__user, gid_t __group, | ||
107 | gid_t *__groups, int *__ngroups); | ||
34 | 108 | ||
35 | extern struct group * bb_getgrent __P ((int grp_fd)); | 109 | /* Initialize the group set for the current user |
110 | by reading the group database and using all groups | ||
111 | of which USER is a member. Also include GROUP. */ | ||
112 | extern int initgroups (__const char *__user, gid_t __group); | ||
36 | 113 | ||
37 | #endif /* USE_SYSTEM_PWD_GRP */ | ||
38 | #endif /* __CONFIG_GRP_H */ | ||
39 | 114 | ||
115 | #endif /* grp.h */ | ||
116 | #endif | ||
diff --git a/include/pwd_.h b/include/pwd_.h index 3f081e872..72151203e 100644 --- a/include/pwd_.h +++ b/include/pwd_.h | |||
@@ -1,11 +1,33 @@ | |||
1 | #ifndef __CONFIG_PWD_H | 1 | /* Copyright (C) 1991,92,95,96,97,98,99,2001 Free Software Foundation, Inc. |
2 | #define __CONFIG_PWD_H | 2 | This file is part of the GNU C Library. |
3 | |||
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. | ||
8 | |||
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. | ||
13 | |||
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. */ | ||
18 | |||
19 | /* | ||
20 | * POSIX Standard: 9.2.2 User Database Access <pwd.h> | ||
21 | */ | ||
3 | 22 | ||
4 | #if !defined CONFIG_USE_BB_PWD_GRP | 23 | #if !defined CONFIG_USE_BB_PWD_GRP |
5 | #include <pwd.h> | 24 | #include <pwd.h> |
6 | 25 | ||
7 | #else | 26 | #else |
8 | 27 | ||
28 | #ifndef _PWD_H | ||
29 | #define _PWD_H 1 | ||
30 | |||
9 | #include <sys/types.h> | 31 | #include <sys/types.h> |
10 | #include <features.h> | 32 | #include <features.h> |
11 | #include <stdio.h> | 33 | #include <stdio.h> |
@@ -13,29 +35,72 @@ | |||
13 | /* The passwd structure. */ | 35 | /* The passwd structure. */ |
14 | struct passwd | 36 | struct passwd |
15 | { | 37 | { |
16 | char *pw_name; /* Username. */ | 38 | char *pw_name; /* Username. */ |
17 | char *pw_passwd; /* Password. */ | 39 | char *pw_passwd; /* Password. */ |
18 | uid_t pw_uid; /* User ID. */ | 40 | uid_t pw_uid; /* User ID. */ |
19 | gid_t pw_gid; /* Group ID. */ | 41 | gid_t pw_gid; /* Group ID. */ |
20 | char *pw_gecos; /* Real name. */ | 42 | char *pw_gecos; /* Real name. */ |
21 | char *pw_dir; /* Home directory. */ | 43 | char *pw_dir; /* Home directory. */ |
22 | char *pw_shell; /* Shell program. */ | 44 | char *pw_shell; /* Shell program. */ |
23 | }; | 45 | }; |
24 | 46 | ||
25 | extern void setpwent __P ((void)); | ||
26 | extern void endpwent __P ((void)); | ||
27 | extern struct passwd * getpwent __P ((void)); | ||
28 | 47 | ||
29 | extern int putpwent __P ((__const struct passwd * __p, FILE * __f)); | 48 | /* Rewind the password-file stream. */ |
30 | extern int getpw __P ((uid_t uid, char *buf)); | 49 | extern void setpwent (void); |
50 | |||
51 | /* Close the password-file stream. */ | ||
52 | extern void endpwent (void); | ||
53 | |||
54 | /* Read an entry from the password-file stream, opening it if necessary. */ | ||
55 | extern struct passwd *getpwent (void); | ||
56 | |||
57 | /* Read an entry from STREAM. */ | ||
58 | extern struct passwd *fgetpwent (FILE *__stream); | ||
59 | |||
60 | /* Write the given entry onto the given stream. */ | ||
61 | extern int putpwent (__const struct passwd *__restrict __p, | ||
62 | FILE *__restrict __f); | ||
63 | |||
64 | /* Search for an entry with a matching user ID. */ | ||
65 | extern struct passwd *getpwuid (uid_t __uid); | ||
66 | |||
67 | /* Search for an entry with a matching username. */ | ||
68 | extern struct passwd *getpwnam (__const char *__name); | ||
69 | |||
70 | /* Reentrant versions of some of the functions above. | ||
71 | |||
72 | PLEASE NOTE: the `getpwent_r' function is not (yet) standardized. | ||
73 | The interface may change in later versions of this library. But | ||
74 | the interface is designed following the principals used for the | ||
75 | other reentrant functions so the chances are good this is what the | ||
76 | POSIX people would choose. */ | ||
77 | |||
78 | extern int getpwent_r (struct passwd *__restrict __resultbuf, | ||
79 | char *__restrict __buffer, size_t __buflen, | ||
80 | struct passwd **__restrict __result); | ||
81 | |||
82 | extern int getpwuid_r (uid_t __uid, | ||
83 | struct passwd *__restrict __resultbuf, | ||
84 | char *__restrict __buffer, size_t __buflen, | ||
85 | struct passwd **__restrict __result); | ||
31 | 86 | ||
32 | extern struct passwd * fgetpwent __P ((FILE * file)); | 87 | extern int getpwnam_r (__const char *__restrict __name, |
88 | struct passwd *__restrict __resultbuf, | ||
89 | char *__restrict __buffer, size_t __buflen, | ||
90 | struct passwd **__restrict __result); | ||
33 | 91 | ||
34 | extern struct passwd * getpwuid __P ((__const uid_t)); | ||
35 | extern struct passwd * getpwnam __P ((__const char *)); | ||
36 | 92 | ||
37 | extern struct passwd * __getpwent __P ((__const int passwd_fd)); | 93 | /* Read an entry from STREAM. This function is not standardized and |
94 | probably never will. */ | ||
95 | extern int fgetpwent_r (FILE *__restrict __stream, | ||
96 | struct passwd *__restrict __resultbuf, | ||
97 | char *__restrict __buffer, size_t __buflen, | ||
98 | struct passwd **__restrict __result); | ||
38 | 99 | ||
39 | #endif /* USE_SYSTEM_PWD_GRP */ | 100 | /* Re-construct the password-file line for the given uid |
40 | #endif /* __CONFIG_PWD_H */ | 101 | in the given buffer. This knows the format that the caller |
102 | will expect, but this need not be the format of the password file. */ | ||
103 | extern int getpw (uid_t __uid, char *__buffer); | ||
41 | 104 | ||
105 | #endif /* pwd.h */ | ||
106 | #endif | ||
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 | ||