summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorVolker Lendecke <vlendec@samba.org>2003-12-26 19:38:36 +0000
committerVolker Lendecke <vlendec@samba.org>2003-12-26 19:38:36 +0000
commit8bfc33f5ed1338a7a6a7f2b99aa9563aa51649f4 (patch)
tree846ff5cfa2a40a033e510cb10ac4adae59598519 /source3
parent66f039d58cd21fdc4039866b9d804576a54967ee (diff)
downloadsamba-8bfc33f5ed1338a7a6a7f2b99aa9563aa51649f4.tar.gz
samba-8bfc33f5ed1338a7a6a7f2b99aa9563aa51649f4.tar.bz2
samba-8bfc33f5ed1338a7a6a7f2b99aa9563aa51649f4.zip
Collecting some minor patches...
This adds the ability to specify the new user password for 'net ads password' on the command line. As this needs the admin password on the command line, the information leak is minimally more. Patch from gd@suse.de Volker (This used to be commit e6b4b956f68bfea69b2de3608b4c829250d24a7a)
Diffstat (limited to 'source3')
-rw-r--r--source3/utils/net_ads.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/source3/utils/net_ads.c b/source3/utils/net_ads.c
index 9404ae4b24..9ee2f3c093 100644
--- a/source3/utils/net_ads.c
+++ b/source3/utils/net_ads.c
@@ -44,9 +44,9 @@ int net_ads_usage(int argc, const char **argv)
"\n\tdump the machine account details to stdout\n"
"\nnet ads lookup"\
"\n\tperform a CLDAP search on the server\n"
-"\nnet ads password <username@realm> -Uadmin_username@realm%%admin_pass"\
+"\nnet ads password <username@realm> <password> -Uadmin_username@realm%%admin_pass"\
"\n\tchange a user's password using an admin account"\
-"\n\t(note: use realm in UPPERCASE)\n"\
+"\n\t(note: use realm in UPPERCASE, prompts if password is obmitted)\n"\
"\nnet ads changetrustpw"\
"\n\tchange the trust account password of this machine in the AD tree\n"\
"\nnet ads printer [info | publish | remove] <printername> <servername>"\
@@ -1016,7 +1016,7 @@ static int net_ads_password(int argc, const char **argv)
}
- if (argc != 1) {
+ if (argc < 1) {
d_printf("ERROR: You must say which username to change password for\n");
return -1;
}
@@ -1048,22 +1048,24 @@ static int net_ads_password(int argc, const char **argv)
return -1;
}
- asprintf(&prompt, "Enter new password for %s:", user);
-
- new_password = getpass(prompt);
+ if (argv[1]) {
+ new_password = (char *)argv[1];
+ } else {
+ asprintf(&prompt, "Enter new password for %s:", user);
+ new_password = getpass(prompt);
+ free(prompt);
+ }
ret = kerberos_set_password(ads->auth.kdc_server, auth_principal,
auth_password, user, new_password, ads->auth.time_offset);
if (!ADS_ERR_OK(ret)) {
d_printf("Password change failed :-( ...\n");
ads_destroy(&ads);
- free(prompt);
return -1;
}
d_printf("Password change for %s completed.\n", user);
ads_destroy(&ads);
- free(prompt);
return 0;
}