summaryrefslogtreecommitdiffstats
path: root/libc
diff options
context:
space:
mode:
Diffstat (limited to 'libc')
-rw-r--r--libc/gen/pw_scan.c16
-rw-r--r--libc/gen/pw_scan.h1
2 files changed, 17 insertions, 0 deletions
diff --git a/libc/gen/pw_scan.c b/libc/gen/pw_scan.c
index a7dbdf2..619092d 100644
--- a/libc/gen/pw_scan.c
+++ b/libc/gen/pw_scan.c
@@ -65,6 +65,22 @@ __FBSDID("$FreeBSD$");
*/
static int pw_big_ids_warning = 0;
+void
+__pw_initpwd(struct passwd *pwd)
+{
+ static char nul[] = "";
+
+ memset(pwd, 0, sizeof(*pwd));
+ pwd->pw_uid = (uid_t)-1; /* Considered least likely to lead to */
+ pwd->pw_gid = (gid_t)-1; /* a security issue. */
+ pwd->pw_name = nul;
+ pwd->pw_passwd = nul;
+ pwd->pw_class = nul;
+ pwd->pw_gecos = nul;
+ pwd->pw_dir = nul;
+ pwd->pw_shell = nul;
+}
+
int
__pw_scan(char *bp, struct passwd *pw, int flags)
{
diff --git a/libc/gen/pw_scan.h b/libc/gen/pw_scan.h
index 44ff818..b567036 100644
--- a/libc/gen/pw_scan.h
+++ b/libc/gen/pw_scan.h
@@ -35,4 +35,5 @@
#define _PWSCAN_MASTER 0x01
#define _PWSCAN_WARN 0x02
+extern void __pw_initpwd(struct passwd *);
extern int __pw_scan(char *, struct passwd *, int);