summaryrefslogtreecommitdiffstats
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
commit81cbfaacb11747830354f4a58be441015fe19ba8 (patch)
treefc214317fcbeb923669139b865f8df2901107ee8
parent2245f4908ee3d33fd05f0a19abda89053cbfceb9 (diff)
downloadsamba-81cbfaacb11747830354f4a58be441015fe19ba8.tar.gz
samba-81cbfaacb11747830354f4a58be441015fe19ba8.tar.xz
samba-81cbfaacb11747830354f4a58be441015fe19ba8.zip
Added check for getpwnam returning NULL.
Jeremy.
-rw-r--r--source/utils/smbpasswd.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/source/utils/smbpasswd.c b/source/utils/smbpasswd.c
index 22271b75de9..425308bec63 100644
--- a/source/utils/smbpasswd.c
+++ b/source/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);
}