summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorEric Andersen2001-01-27 06:01:43 +0000
committerEric Andersen2001-01-27 06:01:43 +0000
commitab050f5522e843bf08994685134adaaac7ffd392 (patch)
treee3f2fbeb43186bbe44fb58ba5a7f6a3c4843c1a5 /include
parent3654ca56fae6e3bdcb7369bc21d2b41d460ef732 (diff)
downloadbusybox-ab050f5522e843bf08994685134adaaac7ffd392.zip
busybox-ab050f5522e843bf08994685134adaaac7ffd392.tar.gz
Add in a patch to make busybox use the normal pwd.h and grp.h
functions. Add in simple implementations of these functions, which can, optionally, be used instead of the system versions. -Erik
Diffstat (limited to 'include')
-rw-r--r--include/grp.h47
-rw-r--r--include/pwd.h51
2 files changed, 98 insertions, 0 deletions
diff --git a/include/grp.h b/include/grp.h
new file mode 100644
index 0000000..f27c466
--- /dev/null
+++ b/include/grp.h
@@ -0,0 +1,47 @@
+#ifndef __BB_GRP_H
+#define __BB_GRP_H
+
+#if defined USE_SYSTEM_PWD_GRP
+#include <grp.h>
+#else
+
+#define bb_setgrent setgrent
+#define bb_endgrent endgrent
+#define bb_getgrent getgrent
+#define bb_getgrgid getgrgid
+#define bb_getgrnam getgrnam
+#define bb_fgetgrent fgetgrent
+#define bb_setgroups setgroups
+#define bb_initgroups initgroups
+#define __bb_getgrent __getgrent
+
+#include <sys/types.h>
+#include <features.h>
+#include <stdio.h>
+
+/* The group structure */
+struct group
+{
+ char *gr_name; /* Group name. */
+ char *gr_passwd; /* Password. */
+ gid_t gr_gid; /* Group ID. */
+ char **gr_mem; /* Member list. */
+};
+
+extern void bb_setgrent __P ((void));
+extern void bb_endgrent __P ((void));
+extern struct group * bb_getgrent __P ((void));
+
+extern struct group * bb_getgrgid __P ((__const gid_t gid));
+extern struct group * bb_getgrnam __P ((__const char * name));
+
+extern struct group * bb_fgetgrent __P ((FILE * file));
+
+extern int bb_setgroups __P ((size_t n, __const gid_t * groups));
+extern int bb_initgroups __P ((__const char * user, gid_t gid));
+
+extern struct group * __bb_getgrent __P ((int grp_fd));
+
+#endif /* USE_SYSTEM_PWD_GRP */
+#endif /* __BB_GRP_H */
+
diff --git a/include/pwd.h b/include/pwd.h
new file mode 100644
index 0000000..82743f5
--- /dev/null
+++ b/include/pwd.h
@@ -0,0 +1,51 @@
+#ifndef __BB_PWD_H
+#define __BB_PWD_H
+
+#if defined USE_SYSTEM_PWD_GRP
+#include <pwd.h>
+#else
+
+#define bb_setpwent setpwent
+#define bb_endpwent endpwent
+#define bb_getpwent getpwent
+#define bb_putpwent putpwent
+#define bb_getpw getpw
+#define bb_fgetpwent fgetpwent
+#define bb_getpwuid getpwuid
+#define bb_getpwnam getpwnam
+#define __bb_getpwent __bb_getpwent
+
+
+#include <sys/types.h>
+#include <features.h>
+#include <stdio.h>
+
+/* The passwd structure. */
+struct passwd
+{
+ char *pw_name; /* Username. */
+ char *pw_passwd; /* Password. */
+ uid_t pw_uid; /* User ID. */
+ gid_t pw_gid; /* Group ID. */
+ char *pw_gecos; /* Real name. */
+ char *pw_dir; /* Home directory. */
+ char *pw_shell; /* Shell program. */
+};
+
+extern void bb_setpwent __P ((void));
+extern void bb_endpwent __P ((void));
+extern struct passwd * bb_getpwent __P ((void));
+
+extern int bb_putpwent __P ((__const struct passwd * __p, FILE * __f));
+extern int bb_getpw __P ((uid_t uid, char *buf));
+
+extern struct passwd * bb_fgetpwent __P ((FILE * file));
+
+extern struct passwd * bb_getpwuid __P ((__const uid_t));
+extern struct passwd * bb_getpwnam __P ((__const char *));
+
+extern struct passwd * __bb_getpwent __P ((__const int passwd_fd));
+
+#endif /* USE_SYSTEM_PWD_GRP */
+#endif /* __BB_PWD_H */
+