aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/grp_.h113
-rw-r--r--include/pwd_.h105
-rw-r--r--include/shadow_.h162
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. */
15struct group 39struct 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
23extern void setgrent __P ((void));
24extern void endgrent __P ((void));
25extern struct group * getgrent __P ((void));
26 47
27extern struct group * getgrgid __P ((__const gid_t gid)); 48/* Rewind the group-file stream. */
28extern struct group * getgrnam __P ((__const char * name)); 49extern void setgrent (void);
50
51/* Close the group-file stream. */
52extern void endgrent (void);
53
54/* Read an entry from the group-file stream, opening it if necessary. */
55extern struct group *getgrent (void);
56
57/* Read a group entry from STREAM. */
58extern struct group *fgetgrent (FILE *__stream);
59
60/* Write the given entry onto the given stream. */
61extern int putgrent (__const struct group *__restrict __p,
62 FILE *__restrict __f);
63
64/* Search for an entry with a matching group ID. */
65extern struct group *getgrgid (gid_t __gid);
66
67/* Search for an entry with a matching group name. */
68extern 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
78extern 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. */
83extern 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. */
88extern 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. */
95extern 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
30extern struct group * fgetgrent __P ((FILE * file)); 100/* Set the group set for the current user to GROUPS (N of them). */
101extern int setgroups (size_t __n, __const gid_t *__groups);
31 102
32extern int setgroups __P ((size_t n, __const gid_t * groups)); 103/* Store at most *NGROUPS members of the group set for USER into
33extern 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. */
106extern int getgrouplist (__const char *__user, gid_t __group,
107 gid_t *__groups, int *__ngroups);
34 108
35extern 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. */
112extern 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. */
14struct passwd 36struct 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
25extern void setpwent __P ((void));
26extern void endpwent __P ((void));
27extern struct passwd * getpwent __P ((void));
28 47
29extern int putpwent __P ((__const struct passwd * __p, FILE * __f)); 48/* Rewind the password-file stream. */
30extern int getpw __P ((uid_t uid, char *buf)); 49extern void setpwent (void);
50
51/* Close the password-file stream. */
52extern void endpwent (void);
53
54/* Read an entry from the password-file stream, opening it if necessary. */
55extern struct passwd *getpwent (void);
56
57/* Read an entry from STREAM. */
58extern struct passwd *fgetpwent (FILE *__stream);
59
60/* Write the given entry onto the given stream. */
61extern int putpwent (__const struct passwd *__restrict __p,
62 FILE *__restrict __f);
63
64/* Search for an entry with a matching user ID. */
65extern struct passwd *getpwuid (uid_t __uid);
66
67/* Search for an entry with a matching username. */
68extern 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
78extern int getpwent_r (struct passwd *__restrict __resultbuf,
79 char *__restrict __buffer, size_t __buflen,
80 struct passwd **__restrict __result);
81
82extern 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
32extern struct passwd * fgetpwent __P ((FILE * file)); 87extern 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
34extern struct passwd * getpwuid __P ((__const uid_t));
35extern struct passwd * getpwnam __P ((__const char *));
36 92
37extern struct passwd * __getpwent __P ((__const int passwd_fd)); 93/* Read an entry from STREAM. This function is not standardized and
94 probably never will. */
95extern 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. */
103extern 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
45typedef 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. */
51struct spwd { 38struct 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. */
56extern void setspent (void);
57
58/* Close database. */
59extern void endspent (void);
60
61/* Get next entry from database, perhaps after opening the file. */
62extern struct spwd *getspent (void);
63
64/* Get shadow entry matching NAME. */
65extern struct spwd *getspnam (__const char *__name);
66
67/* Read shadow entry from STRING. */
68extern struct spwd *sgetspent (__const char *__string);
69
70/* Read next shadow entry from STREAM. */
71extern struct spwd *fgetspent (FILE *__stream);
72
73/* Write line containing shadow password entry to stream. */
74extern int putspent (__const struct spwd *__p, FILE *__stream);
75
76/* Reentrant versions of some of the functions above. */
77extern int getspent_r (struct spwd *__result_buf, char *__buffer,
78 size_t __buflen, struct spwd **__result);
79
80extern int getspnam_r (__const char *__name, struct spwd *__result_buf,
81 char *__buffer, size_t __buflen,
82 struct spwd **__result)__THROW;
83
84extern int sgetspent_r (__const char *__string, struct spwd *__result_buf,
85 char *__buffer, size_t __buflen,
86 struct spwd **__result);
70 87
71extern struct spwd *getspent(void); 88extern int fgetspent_r (FILE *__stream, struct spwd *__result_buf,
72extern struct spwd *sgetspent(const char *); 89 char *__buffer, size_t __buflen,
73extern struct spwd *fgetspent(FILE *); 90 struct spwd **__result);
74extern void setspent(void); 91/* Protect password file against multi writers. */
75extern void endspent(void); 92extern int lckpwdf (void);
76extern int putspent(const struct spwd *, FILE *);
77extern struct spwd *getspnam(const char *name);
78extern struct spwd *pwd_to_spwd(const struct passwd *pw);
79 93
80#endif /* USE_LOCAL_SHADOW */ 94/* Unlock password file. */
95extern int ulckpwdf (void);
81 96
82#endif /* _H_SHADOW */ 97#endif /* shadow.h */
98#endif