aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2010-03-31 12:38:17 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2010-03-31 12:38:17 +0200
commit55301297d3e4c05ec37faf1e1695f79a74ce2cab (patch)
tree6295d785b8585a56ebe666dcec9c554dd51c884d
parent17fcd72add2a94c9542dba72124032b54838cb50 (diff)
downloadbusybox-w32-55301297d3e4c05ec37faf1e1695f79a74ce2cab.tar.gz
busybox-w32-55301297d3e4c05ec37faf1e1695f79a74ce2cab.tar.bz2
busybox-w32-55301297d3e4c05ec37faf1e1695f79a74ce2cab.zip
libpwdgrp: comment out functions with UNUSED_SINCE_WE_AVOID_STATIC_BUFS
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--include/grp_.h2
-rw-r--r--include/pwd_.h10
-rw-r--r--libpwdgrp/pwd_grp.c35
3 files changed, 9 insertions, 38 deletions
diff --git a/include/grp_.h b/include/grp_.h
index deaf9e6a3..7a95f88a6 100644
--- a/include/grp_.h
+++ b/include/grp_.h
@@ -55,6 +55,7 @@ extern void setgrent(void);
55/* Close the group-file stream. */ 55/* Close the group-file stream. */
56extern void endgrent(void); 56extern void endgrent(void);
57 57
58#ifdef UNUSED_SINCE_WE_AVOID_STATIC_BUFS
58/* Read an entry from the group-file stream, opening it if necessary. */ 59/* Read an entry from the group-file stream, opening it if necessary. */
59extern struct group *getgrent(void); 60extern struct group *getgrent(void);
60 61
@@ -64,6 +65,7 @@ extern struct group *fgetgrent(FILE *__stream);
64/* Write the given entry onto the given stream. */ 65/* Write the given entry onto the given stream. */
65extern int putgrent(const struct group *__restrict __p, 66extern int putgrent(const struct group *__restrict __p,
66 FILE *__restrict __f); 67 FILE *__restrict __f);
68#endif
67 69
68/* Search for an entry with a matching group ID. */ 70/* Search for an entry with a matching group ID. */
69extern struct group *getgrgid(gid_t __gid); 71extern struct group *getgrgid(gid_t __gid);
diff --git a/include/pwd_.h b/include/pwd_.h
index f52445ceb..aa63ac940 100644
--- a/include/pwd_.h
+++ b/include/pwd_.h
@@ -42,7 +42,6 @@ PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN
42#define getpwuid_r bb_internal_getpwuid_r 42#define getpwuid_r bb_internal_getpwuid_r
43#define getpwnam_r bb_internal_getpwnam_r 43#define getpwnam_r bb_internal_getpwnam_r
44#define fgetpwent_r bb_internal_fgetpwent_r 44#define fgetpwent_r bb_internal_fgetpwent_r
45//#define getpw bb_internal_getpw
46 45
47 46
48/* All function names below should be remapped by #defines above 47/* All function names below should be remapped by #defines above
@@ -55,6 +54,7 @@ extern void setpwent(void);
55/* Close the password-file stream. */ 54/* Close the password-file stream. */
56extern void endpwent(void); 55extern void endpwent(void);
57 56
57#ifdef UNUSED_SINCE_WE_AVOID_STATIC_BUFS
58/* Read an entry from the password-file stream, opening it if necessary. */ 58/* Read an entry from the password-file stream, opening it if necessary. */
59extern struct passwd *getpwent(void); 59extern struct passwd *getpwent(void);
60 60
@@ -64,6 +64,7 @@ extern struct passwd *fgetpwent(FILE *__stream);
64/* Write the given entry onto the given stream. */ 64/* Write the given entry onto the given stream. */
65extern int putpwent(const struct passwd *__restrict __p, 65extern int putpwent(const struct passwd *__restrict __p,
66 FILE *__restrict __f); 66 FILE *__restrict __f);
67#endif
67 68
68/* Search for an entry with a matching user ID. */ 69/* Search for an entry with a matching user ID. */
69extern struct passwd *getpwuid(uid_t __uid); 70extern struct passwd *getpwuid(uid_t __uid);
@@ -100,11 +101,6 @@ extern int fgetpwent_r(FILE *__restrict __stream,
100 char *__restrict __buffer, size_t __buflen, 101 char *__restrict __buffer, size_t __buflen,
101 struct passwd **__restrict __result); 102 struct passwd **__restrict __result);
102 103
103/* Re-construct the password-file line for the given uid
104 in the given buffer. This knows the format that the caller
105 will expect, but this need not be the format of the password file. */
106/* UNUSED extern int getpw(uid_t __uid, char *__buffer); */
107
108POP_SAVED_FUNCTION_VISIBILITY 104POP_SAVED_FUNCTION_VISIBILITY
109 105
110#endif /* pwd.h */ 106#endif
diff --git a/libpwdgrp/pwd_grp.c b/libpwdgrp/pwd_grp.c
index 26e8ff469..5c61e5638 100644
--- a/libpwdgrp/pwd_grp.c
+++ b/libpwdgrp/pwd_grp.c
@@ -187,7 +187,7 @@ int fgetspent_r(FILE *__restrict stream, struct spwd *__restrict resultbuf,
187 * TODO: audit & stop using these in bbox, they pull in static buffers */ 187 * TODO: audit & stop using these in bbox, they pull in static buffers */
188/**********************************************************************/ 188/**********************************************************************/
189 189
190#if 0 190#ifdef UNUSED_SINCE_WE_AVOID_STATIC_BUFS
191struct passwd *fgetpwent(FILE *stream) 191struct passwd *fgetpwent(FILE *stream)
192{ 192{
193 struct statics *S; 193 struct statics *S;
@@ -399,35 +399,6 @@ struct spwd *getspnam(const char *name)
399} 399}
400#endif 400#endif
401 401
402#ifdef THIS_ONE_IS_UNUSED
403/* This one doesn't use static buffers */
404int getpw(uid_t uid, char *buf)
405{
406 struct passwd resultbuf;
407 struct passwd *result;
408 char buffer[PWD_BUFFER_SIZE];
409
410 if (!buf) {
411 errno = EINVAL;
412 return -1;
413 }
414
415 if (!getpwuid_r(uid, &resultbuf, buffer, sizeof(buffer), &result)) {
416 if (sprintf(buf, "%s:%s:%lu:%lu:%s:%s:%s\n",
417 resultbuf.pw_name, resultbuf.pw_passwd,
418 (unsigned long)(resultbuf.pw_uid),
419 (unsigned long)(resultbuf.pw_gid),
420 resultbuf.pw_gecos, resultbuf.pw_dir,
421 resultbuf.pw_shell) >= 0
422 ) {
423 return 0;
424 }
425 }
426
427 return -1;
428}
429#endif
430
431/**********************************************************************/ 402/**********************************************************************/
432 403
433/* FIXME: we don't have such CONFIG_xx - ?! */ 404/* FIXME: we don't have such CONFIG_xx - ?! */
@@ -584,7 +555,7 @@ int getspent_r(struct spwd *resultbuf, char *buffer,
584} 555}
585#endif 556#endif
586 557
587#if 0 558#ifdef UNUSED_SINCE_WE_AVOID_STATIC_BUFS
588struct passwd *getpwent(void) 559struct passwd *getpwent(void)
589{ 560{
590 static char line_buff[PWD_BUFFER_SIZE]; 561 static char line_buff[PWD_BUFFER_SIZE];
@@ -687,6 +658,7 @@ int getgrouplist(const char *user, gid_t gid, gid_t *groups, int *ngroups)
687 return ngroups_old; 658 return ngroups_old;
688} 659}
689 660
661#ifdef UNUSED_SINCE_WE_AVOID_STATIC_BUFS
690int putpwent(const struct passwd *__restrict p, FILE *__restrict f) 662int putpwent(const struct passwd *__restrict p, FILE *__restrict f)
691{ 663{
692 int rv = -1; 664 int rv = -1;
@@ -749,6 +721,7 @@ int putgrent(const struct group *__restrict p, FILE *__restrict f)
749 721
750 return rv; 722 return rv;
751} 723}
724#endif
752 725
753#if ENABLE_USE_BB_SHADOW 726#if ENABLE_USE_BB_SHADOW
754static const unsigned char put_sp_off[] ALIGN1 = { 727static const unsigned char put_sp_off[] ALIGN1 = {