summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>1998-04-07 17:44:02 +0000
committerJeremy Allison <jra@samba.org>1998-04-07 17:44:02 +0000
commitdb55744684ba35e2c1c9763da56353d82a9252bc (patch)
tree021c01d2072f8ff7e8baf509a681a55166252660
parent0f8acce8ebb5b70ca0f3be96396ff9584e7db735 (diff)
downloadsamba-db55744684ba35e2c1c9763da56353d82a9252bc.tar.gz
samba-db55744684ba35e2c1c9763da56353d82a9252bc.tar.bz2
samba-db55744684ba35e2c1c9763da56353d82a9252bc.zip
Added check for getpwnam returning NULL.
Jeremy. (This used to be commit 81cbfaacb11747830354f4a58be441015fe19ba8)
-rw-r--r--source3/utils/smbpasswd.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/source3/utils/smbpasswd.c b/source3/utils/smbpasswd.c
index 22271b75de..425308bec6 100644
--- a/source3/utils/smbpasswd.c
+++ b/source3/utils/smbpasswd.c
@@ -582,9 +582,13 @@ int main(int argc, char **argv)
usage(prog_name, True);
}
- if(*user_name)
- pwd = getpwnam(user_name);
- else {
+ if(*user_name) {
+ if((pwd = getpwnam(user_name)) == NULL) {
+ fprintf(stderr, "%s: User \"%s\" was not found in system password file.\n",
+ prog_name, user_name);
+ exit(1);
+ }
+ } else {
if((pwd = getpwuid(real_uid)) != NULL)
pstrcpy( user_name, pwd->pw_name);
}