aboutsummaryrefslogtreecommitdiff
path: root/include/pwd_.h
diff options
context:
space:
mode:
authorandersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277>2004-07-15 12:53:49 +0000
committerandersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277>2004-07-15 12:53:49 +0000
commit48fb8b8392bda5c2a944489eb35572e5a9942bfa (patch)
tree863532a14dd40a1009cee3dac1dfa7fdd8bea653 /include/pwd_.h
parent8d067d680796f811a61decb8bbd6f63bf05c1f41 (diff)
downloadbusybox-w32-48fb8b8392bda5c2a944489eb35572e5a9942bfa.tar.gz
busybox-w32-48fb8b8392bda5c2a944489eb35572e5a9942bfa.tar.bz2
busybox-w32-48fb8b8392bda5c2a944489eb35572e5a9942bfa.zip
Replace the old and somewhat buggy pwd_grp stuff with the shiny
new stuff mjn3 wrote for uClibc git-svn-id: svn://busybox.net/trunk/busybox@8956 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'include/pwd_.h')
-rw-r--r--include/pwd_.h105
1 files changed, 85 insertions, 20 deletions
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