From 9a44c4f91ce7e517d5325fd3743e6ad9d54ef3f0 Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Thu, 28 Dec 2006 05:44:47 +0000 Subject: bb_xget[pw/gr]nam were horribly misnamed - fixed. uidgid_get -> get_uidgid, add additional param (numeric_ok). Make chown use it. chown: fix "chown user: ...." install: fix incorrect use of bb_xget[pw/gr]nam --- include/libbb.h | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'include') diff --git a/include/libbb.h b/include/libbb.h index a2b9a82..ece1c9d 100644 --- a/include/libbb.h +++ b/include/libbb.h @@ -338,17 +338,20 @@ uint16_t xatou16(const char *numstr); /* These parse entries in /etc/passwd and /etc/group. This is desirable * for BusyBox since we want to avoid using the glibc NSS stuff, which * increases target size and is often not needed on embedded systems. */ -extern long bb_xgetpwnam(const char *name); -extern long bb_xgetgrnam(const char *name); -/*extern char *bb_getug(char *buffer, char *idname, long id, int bufsize, char prefix);*/ -extern char *bb_getpwuid(char *name, long uid, int bufsize); -extern char *bb_getgrgid(char *group, long gid, int bufsize); -/* from chpst */ +extern long xuname2uid(const char *name); +extern long xgroup2gid(const char *name); +/* wrapper: allows string to contain numeric uid or gid */ +extern unsigned long get_ug_id(const char *s, long (*xname2id)(const char *)); +/* from chpst. Does not die, returns 0 on failure */ struct bb_uidgid_t { uid_t uid; gid_t gid; }; -extern unsigned uidgid_get(struct bb_uidgid_t*, const char* /*, unsigned*/); +extern int get_uidgid(struct bb_uidgid_t*, const char*, int numeric_ok); +/* what is this? */ +/*extern char *bb_getug(char *buffer, char *idname, long id, int bufsize, char prefix);*/ +extern char *bb_getpwuid(char *name, long uid, int bufsize); +extern char *bb_getgrgid(char *group, long gid, int bufsize); enum { BB_GETOPT_ERROR = 0x80000000 }; @@ -484,7 +487,6 @@ extern void vfork_daemon_rexec(int nochdir, int noclose, int argc, char **argv, char *foreground_opt); #endif extern int get_terminal_width_height(int fd, int *width, int *height); -extern unsigned long get_ug_id(const char *s, long (*__bb_getxxnam)(const char *)); int is_in_ino_dev_hashtable(const struct stat *statbuf, char **name); void add_to_ino_dev_hashtable(const struct stat *statbuf, const char *name); -- cgit v1.1