summaryrefslogtreecommitdiff
path: root/source3/utils/smbpasswd.c
diff options
context:
space:
mode:
authorKarolin Seeger <kseeger@samba.org>2009-01-09 15:54:16 +0100
committerKarolin Seeger <kseeger@samba.org>2009-01-09 16:11:58 +0100
commit1b9ae1a6bb771ee16908e66fa35dada514a8f36d (patch)
treedb4b8bfd12ccc23be8883b7311ee524c5feb05a3 /source3/utils/smbpasswd.c
parent49a6d757b4d944cd22c91b2838beb83f04fbe1e9 (diff)
downloadsamba-1b9ae1a6bb771ee16908e66fa35dada514a8f36d.tar.gz
samba-1b9ae1a6bb771ee16908e66fa35dada514a8f36d.tar.bz2
samba-1b9ae1a6bb771ee16908e66fa35dada514a8f36d.zip
s3/smbpasswd: Check if Unix account exists before asking for the password.
Admins shouldn't have to type in the password twice when the passdb account cannot be created because the Unix account is missing. Karolin
Diffstat (limited to 'source3/utils/smbpasswd.c')
-rw-r--r--source3/utils/smbpasswd.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/source3/utils/smbpasswd.c b/source3/utils/smbpasswd.c
index d2652ad95a..93e2f81585 100644
--- a/source3/utils/smbpasswd.c
+++ b/source3/utils/smbpasswd.c
@@ -430,6 +430,15 @@ static int process_root(int local_flags)
}
if((local_flags & LOCAL_SET_PASSWORD) && (new_passwd == NULL)) {
+ struct passwd *passwd;
+
+ passwd = getpwnam_alloc(NULL, user_name);
+ if (!passwd) {
+ DEBUG(0, ("Cannot locate Unix account for "
+ "'%s'!\n", user_name));
+ exit(1);;
+ }
+
new_passwd = prompt_for_new_password(stdin_passwd_get);
if(!new_passwd) {