diff options
author | Karolin Seeger <kseeger@samba.org> | 2009-01-09 19:39:46 -0800 |
---|---|---|
committer | Karolin Seeger <kseeger@samba.org> | 2009-01-12 09:38:21 +0100 |
commit | 9e030b967f340767a85553b39bf0f6f57dfb3013 (patch) | |
tree | 47c5e555b144d1d4fb95ba0964e6eb390b1dea5d /source/utils | |
parent | da752d5d212a5b2d3b84ce88e2141a0ecfb3f5a7 (diff) | |
download | samba-9e030b967f340767a85553b39bf0f6f57dfb3013.tar.gz |
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')
-rw-r--r-- | source/utils/smbpasswd.c | 9 |
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) { |