summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
Diffstat (limited to 'source3')
-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);
}