diff options
author | vda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2006-12-30 21:11:57 +0000 |
---|---|---|
committer | vda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2006-12-30 21:11:57 +0000 |
commit | 42a8c1bf937d50f9d9d94255064bba1577f5ae2d (patch) | |
tree | adde9e8d46920ae48f3768e6b7fa76bdd123f618 /include/pwd_.h | |
parent | a3adb6f4577bd75a302749299472c8227995c1bf (diff) | |
download | busybox-w32-42a8c1bf937d50f9d9d94255064bba1577f5ae2d.tar.gz busybox-w32-42a8c1bf937d50f9d9d94255064bba1577f5ae2d.tar.bz2 busybox-w32-42a8c1bf937d50f9d9d94255064bba1577f5ae2d.zip |
fixdep.c: avoit doing memcmp in most cases
uidgid_get.c: add forgotten copyright notice
pwd/grp/shadow: avoid collisions with libc names
git-svn-id: svn://busybox.net/trunk/busybox@17112 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'include/pwd_.h')
-rw-r--r-- | include/pwd_.h | 71 |
1 files changed, 43 insertions, 28 deletions
diff --git a/include/pwd_.h b/include/pwd_.h index d161c0e8f..f47e4eb2c 100644 --- a/include/pwd_.h +++ b/include/pwd_.h | |||
@@ -21,52 +21,68 @@ | |||
21 | * POSIX Standard: 9.2.2 User Database Access <pwd.h> | 21 | * POSIX Standard: 9.2.2 User Database Access <pwd.h> |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #if !defined CONFIG_USE_BB_PWD_GRP | 24 | #if !ENABLE_USE_BB_PWD_GRP |
25 | |||
25 | #include <pwd.h> | 26 | #include <pwd.h> |
26 | 27 | ||
27 | #else | 28 | #else |
28 | 29 | ||
29 | #ifndef _PWD_H | 30 | #ifndef _PWD_H |
30 | #define _PWD_H 1 | 31 | #define _PWD_H 1 |
31 | |||
32 | #include <sys/types.h> | ||
33 | #include <features.h> | ||
34 | #include <stdio.h> | ||
35 | 32 | ||
36 | /* The passwd structure. */ | 33 | /* The passwd structure. */ |
37 | struct passwd | 34 | struct passwd { |
38 | { | 35 | char *pw_name; /* Username. */ |
39 | char *pw_name; /* Username. */ | 36 | char *pw_passwd; /* Password. */ |
40 | char *pw_passwd; /* Password. */ | 37 | uid_t pw_uid; /* User ID. */ |
41 | uid_t pw_uid; /* User ID. */ | 38 | gid_t pw_gid; /* Group ID. */ |
42 | gid_t pw_gid; /* Group ID. */ | 39 | char *pw_gecos; /* Real name. */ |
43 | char *pw_gecos; /* Real name. */ | 40 | char *pw_dir; /* Home directory. */ |
44 | char *pw_dir; /* Home directory. */ | 41 | char *pw_shell; /* Shell program. */ |
45 | char *pw_shell; /* Shell program. */ | ||
46 | }; | 42 | }; |
47 | 43 | ||
48 | 44 | ||
45 | #define setpwent bb_internal_setpwent | ||
46 | #define endpwent bb_internal_endpwent | ||
47 | #define getpwent bb_internal_getpwent | ||
48 | #define fgetpwent bb_internal_fgetpwent | ||
49 | #define putpwent bb_internal_putpwent | ||
50 | #define getpwuid bb_internal_getpwuid | ||
51 | #define getpwnam bb_internal_getpwnam | ||
52 | #define getpwent_r bb_internal_getpwent_r | ||
53 | #define getpwuid_r bb_internal_getpwuid_r | ||
54 | #define getpwnam_r bb_internal_getpwnam_r | ||
55 | #define fgetpwent_r bb_internal_fgetpwent_r | ||
56 | #define getpw bb_internal_getpw | ||
57 | |||
58 | |||
59 | /* All function names below should be remapped by #defines above | ||
60 | * in order to not collide with libc names. | ||
61 | * In theory it isn't necessary, but I saw weird interactions at link time. | ||
62 | * Let's play safe */ | ||
63 | |||
64 | |||
49 | /* Rewind the password-file stream. */ | 65 | /* Rewind the password-file stream. */ |
50 | extern void setpwent (void); | 66 | extern void setpwent(void); |
51 | 67 | ||
52 | /* Close the password-file stream. */ | 68 | /* Close the password-file stream. */ |
53 | extern void endpwent (void); | 69 | extern void endpwent(void); |
54 | 70 | ||
55 | /* Read an entry from the password-file stream, opening it if necessary. */ | 71 | /* Read an entry from the password-file stream, opening it if necessary. */ |
56 | extern struct passwd *getpwent (void); | 72 | extern struct passwd *getpwent(void); |
57 | 73 | ||
58 | /* Read an entry from STREAM. */ | 74 | /* Read an entry from STREAM. */ |
59 | extern struct passwd *fgetpwent (FILE *__stream); | 75 | extern struct passwd *fgetpwent(FILE *__stream); |
60 | 76 | ||
61 | /* Write the given entry onto the given stream. */ | 77 | /* Write the given entry onto the given stream. */ |
62 | extern int putpwent (__const struct passwd *__restrict __p, | 78 | extern int putpwent(__const struct passwd *__restrict __p, |
63 | FILE *__restrict __f); | 79 | FILE *__restrict __f); |
64 | 80 | ||
65 | /* Search for an entry with a matching user ID. */ | 81 | /* Search for an entry with a matching user ID. */ |
66 | extern struct passwd *getpwuid (uid_t __uid); | 82 | extern struct passwd *getpwuid(uid_t __uid); |
67 | 83 | ||
68 | /* Search for an entry with a matching username. */ | 84 | /* Search for an entry with a matching username. */ |
69 | extern struct passwd *getpwnam (__const char *__name); | 85 | extern struct passwd *getpwnam(__const char *__name); |
70 | 86 | ||
71 | /* Reentrant versions of some of the functions above. | 87 | /* Reentrant versions of some of the functions above. |
72 | 88 | ||
@@ -76,24 +92,23 @@ extern struct passwd *getpwnam (__const char *__name); | |||
76 | other reentrant functions so the chances are good this is what the | 92 | other reentrant functions so the chances are good this is what the |
77 | POSIX people would choose. */ | 93 | POSIX people would choose. */ |
78 | 94 | ||
79 | extern int getpwent_r (struct passwd *__restrict __resultbuf, | 95 | extern int getpwent_r(struct passwd *__restrict __resultbuf, |
80 | char *__restrict __buffer, size_t __buflen, | 96 | char *__restrict __buffer, size_t __buflen, |
81 | struct passwd **__restrict __result); | 97 | struct passwd **__restrict __result); |
82 | 98 | ||
83 | extern int getpwuid_r (uid_t __uid, | 99 | extern int getpwuid_r(uid_t __uid, |
84 | struct passwd *__restrict __resultbuf, | 100 | struct passwd *__restrict __resultbuf, |
85 | char *__restrict __buffer, size_t __buflen, | 101 | char *__restrict __buffer, size_t __buflen, |
86 | struct passwd **__restrict __result); | 102 | struct passwd **__restrict __result); |
87 | 103 | ||
88 | extern int getpwnam_r (__const char *__restrict __name, | 104 | extern int getpwnam_r(__const char *__restrict __name, |
89 | struct passwd *__restrict __resultbuf, | 105 | struct passwd *__restrict __resultbuf, |
90 | char *__restrict __buffer, size_t __buflen, | 106 | char *__restrict __buffer, size_t __buflen, |
91 | struct passwd **__restrict __result); | 107 | struct passwd **__restrict __result); |
92 | 108 | ||
93 | |||
94 | /* Read an entry from STREAM. This function is not standardized and | 109 | /* Read an entry from STREAM. This function is not standardized and |
95 | probably never will. */ | 110 | probably never will. */ |
96 | extern int fgetpwent_r (FILE *__restrict __stream, | 111 | extern int fgetpwent_r(FILE *__restrict __stream, |
97 | struct passwd *__restrict __resultbuf, | 112 | struct passwd *__restrict __resultbuf, |
98 | char *__restrict __buffer, size_t __buflen, | 113 | char *__restrict __buffer, size_t __buflen, |
99 | struct passwd **__restrict __result); | 114 | struct passwd **__restrict __result); |
@@ -101,7 +116,7 @@ extern int fgetpwent_r (FILE *__restrict __stream, | |||
101 | /* Re-construct the password-file line for the given uid | 116 | /* Re-construct the password-file line for the given uid |
102 | in the given buffer. This knows the format that the caller | 117 | in the given buffer. This knows the format that the caller |
103 | will expect, but this need not be the format of the password file. */ | 118 | will expect, but this need not be the format of the password file. */ |
104 | extern int getpw (uid_t __uid, char *__buffer); | 119 | extern int getpw(uid_t __uid, char *__buffer); |
105 | 120 | ||
106 | #endif /* pwd.h */ | 121 | #endif /* pwd.h */ |
107 | #endif | 122 | #endif |