diff options
Diffstat (limited to 'libpwdgrp')
-rw-r--r-- | libpwdgrp/pwd_grp.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/libpwdgrp/pwd_grp.c b/libpwdgrp/pwd_grp.c index ac65d4c5b..ddfdfec2e 100644 --- a/libpwdgrp/pwd_grp.c +++ b/libpwdgrp/pwd_grp.c | |||
@@ -52,7 +52,9 @@ | |||
52 | 52 | ||
53 | extern int __parsepwent(void *pw, char *line); | 53 | extern int __parsepwent(void *pw, char *line); |
54 | extern int __parsegrent(void *gr, char *line); | 54 | extern int __parsegrent(void *gr, char *line); |
55 | #if ENABLE_USE_BB_SHADOW | ||
55 | extern int __parsespent(void *sp, char *line); | 56 | extern int __parsespent(void *sp, char *line); |
57 | #endif | ||
56 | 58 | ||
57 | extern int __pgsreader(int (*__parserfunc)(void *d, char *line), void *data, | 59 | extern int __pgsreader(int (*__parserfunc)(void *d, char *line), void *data, |
58 | char *__restrict line_buff, size_t buflen, FILE *f); | 60 | char *__restrict line_buff, size_t buflen, FILE *f); |
@@ -103,6 +105,7 @@ int fgetgrent_r(FILE *__restrict stream, struct group *__restrict resultbuf, | |||
103 | return rv; | 105 | return rv; |
104 | } | 106 | } |
105 | 107 | ||
108 | #if ENABLE_USE_BB_SHADOW | ||
106 | int fgetspent_r(FILE *__restrict stream, struct spwd *__restrict resultbuf, | 109 | int fgetspent_r(FILE *__restrict stream, struct spwd *__restrict resultbuf, |
107 | char *__restrict buffer, size_t buflen, | 110 | char *__restrict buffer, size_t buflen, |
108 | struct spwd **__restrict result) | 111 | struct spwd **__restrict result) |
@@ -117,6 +120,7 @@ int fgetspent_r(FILE *__restrict stream, struct spwd *__restrict resultbuf, | |||
117 | 120 | ||
118 | return rv; | 121 | return rv; |
119 | } | 122 | } |
123 | #endif | ||
120 | 124 | ||
121 | /**********************************************************************/ | 125 | /**********************************************************************/ |
122 | /* For the various fget??ent funcs, return NULL on failure and a | 126 | /* For the various fget??ent funcs, return NULL on failure and a |
@@ -144,6 +148,7 @@ struct group *fgetgrent(FILE *stream) | |||
144 | return result; | 148 | return result; |
145 | } | 149 | } |
146 | 150 | ||
151 | #if ENABLE_USE_BB_SHADOW | ||
147 | extern int fgetspent_r(FILE *__restrict stream, struct spwd *__restrict resultbuf, | 152 | extern int fgetspent_r(FILE *__restrict stream, struct spwd *__restrict resultbuf, |
148 | char *__restrict buffer, size_t buflen, | 153 | char *__restrict buffer, size_t buflen, |
149 | struct spwd **__restrict result); | 154 | struct spwd **__restrict result); |
@@ -184,6 +189,7 @@ int sgetspent_r(const char *string, struct spwd *result_buf, | |||
184 | DONE: | 189 | DONE: |
185 | return rv; | 190 | return rv; |
186 | } | 191 | } |
192 | #endif | ||
187 | 193 | ||
188 | /**********************************************************************/ | 194 | /**********************************************************************/ |
189 | 195 | ||
@@ -207,6 +213,7 @@ int sgetspent_r(const char *string, struct spwd *result_buf, | |||
207 | #define DO_GETXXKEY_R_PATHNAME _PATH_GROUP | 213 | #define DO_GETXXKEY_R_PATHNAME _PATH_GROUP |
208 | #include "pwd_grp_internal.c" | 214 | #include "pwd_grp_internal.c" |
209 | 215 | ||
216 | #if ENABLE_USE_BB_SHADOW | ||
210 | #define GETXXKEY_R_FUNC getspnam_R | 217 | #define GETXXKEY_R_FUNC getspnam_R |
211 | #define GETXXKEY_R_PARSER __parsespent | 218 | #define GETXXKEY_R_PARSER __parsespent |
212 | #define GETXXKEY_R_ENTTYPE struct spwd | 219 | #define GETXXKEY_R_ENTTYPE struct spwd |
@@ -214,6 +221,7 @@ int sgetspent_r(const char *string, struct spwd *result_buf, | |||
214 | #define DO_GETXXKEY_R_KEYTYPE const char *__restrict | 221 | #define DO_GETXXKEY_R_KEYTYPE const char *__restrict |
215 | #define DO_GETXXKEY_R_PATHNAME _PATH_SHADOW | 222 | #define DO_GETXXKEY_R_PATHNAME _PATH_SHADOW |
216 | #include "pwd_grp_internal.c" | 223 | #include "pwd_grp_internal.c" |
224 | #endif | ||
217 | 225 | ||
218 | #define GETXXKEY_R_FUNC getpwuid_R | 226 | #define GETXXKEY_R_FUNC getpwuid_R |
219 | #define GETXXKEY_R_PARSER __parsepwent | 227 | #define GETXXKEY_R_PARSER __parsepwent |
@@ -253,6 +261,7 @@ struct group *getgrgid(gid_t gid) | |||
253 | return result; | 261 | return result; |
254 | } | 262 | } |
255 | 263 | ||
264 | #if 0 //ENABLE_USE_BB_SHADOW | ||
256 | /* This function is non-standard and is currently not built. It seems | 265 | /* This function is non-standard and is currently not built. It seems |
257 | * to have been created as a reentrant version of the non-standard | 266 | * to have been created as a reentrant version of the non-standard |
258 | * functions getspuid. Why getspuid was added, I do not know. */ | 267 | * functions getspuid. Why getspuid was added, I do not know. */ |
@@ -286,6 +295,7 @@ struct spwd *getspuid(uid_t uid) | |||
286 | getspuid_r(uid, &resultbuf, buffer, sizeof(buffer), &result); | 295 | getspuid_r(uid, &resultbuf, buffer, sizeof(buffer), &result); |
287 | return result; | 296 | return result; |
288 | } | 297 | } |
298 | #endif | ||
289 | 299 | ||
290 | struct passwd *getpwnam(const char *name) | 300 | struct passwd *getpwnam(const char *name) |
291 | { | 301 | { |
@@ -307,6 +317,7 @@ struct group *getgrnam(const char *name) | |||
307 | return result; | 317 | return result; |
308 | } | 318 | } |
309 | 319 | ||
320 | #if ENABLE_USE_BB_SHADOW | ||
310 | struct spwd *getspnam(const char *name) | 321 | struct spwd *getspnam(const char *name) |
311 | { | 322 | { |
312 | static char buffer[PWD_BUFFER_SIZE]; | 323 | static char buffer[PWD_BUFFER_SIZE]; |
@@ -316,6 +327,7 @@ struct spwd *getspnam(const char *name) | |||
316 | getspnam_r(name, &resultbuf, buffer, sizeof(buffer), &result); | 327 | getspnam_r(name, &resultbuf, buffer, sizeof(buffer), &result); |
317 | return result; | 328 | return result; |
318 | } | 329 | } |
330 | #endif | ||
319 | 331 | ||
320 | int getpw(uid_t uid, char *buf) | 332 | int getpw(uid_t uid, char *buf) |
321 | { | 333 | { |
@@ -444,6 +456,7 @@ int getgrent_r(struct group *__restrict resultbuf, | |||
444 | return rv; | 456 | return rv; |
445 | } | 457 | } |
446 | 458 | ||
459 | #if ENABLE_USE_BB_SHADOW | ||
447 | static FILE *spf /*= NULL*/; | 460 | static FILE *spf /*= NULL*/; |
448 | void setspent(void) | 461 | void setspent(void) |
449 | { | 462 | { |
@@ -488,6 +501,7 @@ int getspent_r(struct spwd *resultbuf, char *buffer, | |||
488 | UNLOCK; | 501 | UNLOCK; |
489 | return rv; | 502 | return rv; |
490 | } | 503 | } |
504 | #endif | ||
491 | 505 | ||
492 | struct passwd *getpwent(void) | 506 | struct passwd *getpwent(void) |
493 | { | 507 | { |
@@ -509,6 +523,7 @@ struct group *getgrent(void) | |||
509 | return result; | 523 | return result; |
510 | } | 524 | } |
511 | 525 | ||
526 | #if ENABLE_USE_BB_SHADOW | ||
512 | struct spwd *getspent(void) | 527 | struct spwd *getspent(void) |
513 | { | 528 | { |
514 | static char line_buff[PWD_BUFFER_SIZE]; | 529 | static char line_buff[PWD_BUFFER_SIZE]; |
@@ -528,6 +543,7 @@ struct spwd *sgetspent(const char *string) | |||
528 | sgetspent_r(string, &spwd, line_buff, sizeof(line_buff), &result); | 543 | sgetspent_r(string, &spwd, line_buff, sizeof(line_buff), &result); |
529 | return result; | 544 | return result; |
530 | } | 545 | } |
546 | #endif | ||
531 | 547 | ||
532 | int initgroups(const char *user, gid_t gid) | 548 | int initgroups(const char *user, gid_t gid) |
533 | { | 549 | { |
@@ -643,6 +659,7 @@ int putgrent(const struct group *__restrict p, FILE *__restrict f) | |||
643 | return rv; | 659 | return rv; |
644 | } | 660 | } |
645 | 661 | ||
662 | #if ENABLE_USE_BB_SHADOW | ||
646 | static const unsigned char _sp_off[] = { | 663 | static const unsigned char _sp_off[] = { |
647 | offsetof(struct spwd, sp_lstchg), /* 2 - not a char ptr */ | 664 | offsetof(struct spwd, sp_lstchg), /* 2 - not a char ptr */ |
648 | offsetof(struct spwd, sp_min), /* 3 - not a char ptr */ | 665 | offsetof(struct spwd, sp_min), /* 3 - not a char ptr */ |
@@ -688,6 +705,7 @@ int putspent(const struct spwd *p, FILE *stream) | |||
688 | DO_UNLOCK: | 705 | DO_UNLOCK: |
689 | return rv; | 706 | return rv; |
690 | } | 707 | } |
708 | #endif | ||
691 | 709 | ||
692 | /**********************************************************************/ | 710 | /**********************************************************************/ |
693 | /* Internal uClibc functions. */ | 711 | /* Internal uClibc functions. */ |
@@ -846,6 +864,7 @@ int __parsegrent(void *data, char *line) | |||
846 | 864 | ||
847 | /**********************************************************************/ | 865 | /**********************************************************************/ |
848 | 866 | ||
867 | #if ENABLE_USE_BB_SHADOW | ||
849 | static const unsigned char sp_off[] = { | 868 | static const unsigned char sp_off[] = { |
850 | offsetof(struct spwd, sp_namp), /* 0 */ | 869 | offsetof(struct spwd, sp_namp), /* 0 */ |
851 | offsetof(struct spwd, sp_pwdp), /* 1 */ | 870 | offsetof(struct spwd, sp_pwdp), /* 1 */ |
@@ -900,6 +919,7 @@ int __parsespent(void *data, char * line) | |||
900 | 919 | ||
901 | return EINVAL; | 920 | return EINVAL; |
902 | } | 921 | } |
922 | #endif | ||
903 | 923 | ||
904 | /**********************************************************************/ | 924 | /**********************************************************************/ |
905 | 925 | ||