summaryrefslogtreecommitdiffstats
path: root/source/utils/smbpasswd.c
diff options
context:
space:
mode:
authorKarolin Seeger <kseeger@samba.org>2009-01-09 19:39:46 -0800
committerKarolin Seeger <kseeger@samba.org>2009-01-12 09:38:21 +0100
commit9e030b967f340767a85553b39bf0f6f57dfb3013 (patch)
tree47c5e555b144d1d4fb95ba0964e6eb390b1dea5d /source/utils/smbpasswd.c
parentda752d5d212a5b2d3b84ce88e2141a0ecfb3f5a7 (diff)
downloadsamba-9e030b967f340767a85553b39bf0f6f57dfb3013.tar.gz
samba-9e030b967f340767a85553b39bf0f6f57dfb3013.tar.xz
samba-9e030b967f340767a85553b39bf0f6f57dfb3013.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 (cherry picked from commit af0ceb784af1ea8d591f5c35fb010d60b178a8d2)
Diffstat (limited to 'source/utils/smbpasswd.c')
-rw-r--r--source/utils/smbpasswd.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/source/utils/smbpasswd.c b/source/utils/smbpasswd.c
index b18ab5579de..78c1ce86fdb 100644
--- a/source/utils/smbpasswd.c
+++ b/source/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 = getpwnam_alloc(NULL, user_name);
+
+ if (!passwd) {
+ fprintf(stderr, "Cannot locate Unix account for "
+ "'%s'!\n", user_name);
+ exit(1);
+ }
+ TALLOC_FREE(passwd);
+
new_passwd = prompt_for_new_password(stdin_passwd_get);
if(!new_passwd) {