From 3bb5e3e0b44c25eede60925cfdc89d7df0d0e486 Mon Sep 17 00:00:00 2001 From: Karolin Seeger Date: Fri, 9 Jan 2009 19:43:13 -0800 Subject: [PATCH] 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 --- source/utils/smbpasswd.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/source/utils/smbpasswd.c b/source/utils/smbpasswd.c index 493a249bea8..041b02a6440 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) { -- 2.11.4.GIT