summaryrefslogtreecommitdiffstats
path: root/pw/pw_vpw.c
diff options
context:
space:
mode:
authorBaptiste Daroussin <bapt@FreeBSD.org>2015-09-12 11:41:31 +0000
committerBaptiste Daroussin <bapt@FreeBSD.org>2015-09-12 11:41:31 +0000
commitdfac825697674070ff717c02263d3aab9c9d62bd (patch)
treed0a9241fb6cc89559109f7e769218add7566865b /pw/pw_vpw.c
parentcdfbaf3700b5e6732bc50f13b3e65ef7c576086c (diff)
parent9c04af5e0b95f4cebcc065c168ec58a4851b4764 (diff)
downloadpw-darwin-dfac825697674070ff717c02263d3aab9c9d62bd.tar.gz
pw-darwin-dfac825697674070ff717c02263d3aab9c9d62bd.zip
Merge from head
Diffstat (limited to 'pw/pw_vpw.c')
-rw-r--r--pw/pw_vpw.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/pw/pw_vpw.c b/pw/pw_vpw.c
index 99663be..a23c66e 100644
--- a/pw/pw_vpw.c
+++ b/pw/pw_vpw.c
@@ -38,6 +38,7 @@ static const char rcsid[] =
#include <string.h>
#include <stdlib.h>
#include <sys/param.h>
+#include <err.h>
#include "pwupd.h"
@@ -80,6 +81,9 @@ vnextpwent(char const *nam, uid_t uid, int doclose)
if (line[linelen - 1 ] == '\n')
line[linelen - 1] = '\0';
pw = pw_scan(line, PWSCAN_MASTER);
+ if (pw == NULL)
+ errx(EXIT_FAILURE, "Invalid user entry in '%s':"
+ " '%s'", getpwpath(_MASTERPASSWD), line);
if (uid != (uid_t)-1) {
if (uid == pw->pw_uid)
break;
@@ -160,6 +164,9 @@ vnextgrent(char const *nam, gid_t gid, int doclose)
if (line[linelen - 1 ] == '\n')
line[linelen - 1] = '\0';
gr = gr_scan(line);
+ if (gr == NULL)
+ errx(EXIT_FAILURE, "Invalid group entry in '%s':"
+ " '%s'", getgrpath(_GROUP), line);
if (gid != (gid_t)-1) {
if (gid == gr->gr_gid)
break;