diff options
author | Jeremy Allison <jra@samba.org> | 1998-11-16 20:19:57 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 1998-11-16 20:19:57 +0000 |
commit | f4447df41b59f6939528f517a07078c596d2b8b5 (patch) | |
tree | 81241789711d4a3b5829af0fa3b736f518d967c9 /source3/utils | |
parent | 67d5258486da64e0b272093614d16e6e8794ee1c (diff) | |
download | samba-f4447df41b59f6939528f517a07078c596d2b8b5.tar.gz samba-f4447df41b59f6939528f517a07078c596d2b8b5.tar.bz2 samba-f4447df41b59f6939528f517a07078c596d2b8b5.zip |
Added fixes for machine accounts.
Jeremy.
(This used to be commit 7aa644c2f996433f8ec125bfd4221aec49bece2b)
Diffstat (limited to 'source3/utils')
-rw-r--r-- | source3/utils/smbpasswd.c | 42 |
1 files changed, 32 insertions, 10 deletions
diff --git a/source3/utils/smbpasswd.c b/source3/utils/smbpasswd.c index a96a1c0f7b..902f59b245 100644 --- a/source3/utils/smbpasswd.c +++ b/source3/utils/smbpasswd.c @@ -254,6 +254,12 @@ handle password changing for root *************************************************************/ static int process_root(int argc, char *argv[]) { + /* + * Next two lines needed for SunOS and don't + * hurt anything else... + */ + extern char *optarg; + extern int optind; struct passwd *pwd; int ch; BOOL joining_domain = False; @@ -359,29 +365,39 @@ static int process_root(int argc, char *argv[]) exit(1); } - if (!remote_machine && !Get_Pwnam(user_name, True)) { - fprintf(stderr, "User \"%s\" was not found in system password file.\n", - user_name); - exit(1); - } - - if (user_name[strlen(user_name)-1] == '$') { - user_name[strlen(user_name)-1] = 0; - } - if (trust_account) { /* add the $ automatically */ static fstring buf; + /* + * Remove any trailing '$' before we + * generate the initial machine password. + */ + + if (user_name[strlen(user_name)-1] == '$') { + user_name[strlen(user_name)-1] = 0; + } + if (add_user) { new_passwd = xstrdup(user_name); strlower(new_passwd); } + /* + * Now ensure the username ends in '$' for + * the machine add. + */ + slprintf(buf, sizeof(buf)-1, "%s$", user_name); user_name = buf; } + if (!remote_machine && !Get_Pwnam(user_name, True)) { + fprintf(stderr, "User \"%s\" was not found in system password file.\n", + user_name); + exit(1); + } + if (remote_machine != NULL) { old_passwd = get_pass("Old SMB password:",stdin_passwd_get); } @@ -433,6 +449,12 @@ handle password changing for non-root *************************************************************/ static int process_nonroot(int argc, char *argv[]) { + /* + * Next two lines needed for SunOS and don't + * hurt anything else... + */ + extern char *optarg; + extern int optind; struct passwd *pwd = NULL; int ch; BOOL stdin_passwd_get = False; |