Apply latest of Derrell Lippman's changes to libsmbclient.
[Samba/gebeck_regimport.git] / packaging / SuSE / samba3-net_ads_password.diff
blobcc800fb7bfd1f5420855e816a8d4d5a77b2f9a7b
1 Index: source/utils/net_ads.c
2 ===================================================================
3 RCS file: /cvsroot/samba/source/utils/net_ads.c,v
4 retrieving revision 1.37.2.22
5 diff -u -r1.37.2.22 net_ads.c
6 --- source/utils/net_ads.c 10 Jun 2003 04:15:55 -0000 1.37.2.22
7 +++ source/utils/net_ads.c 20 Jun 2003 19:59:36 -0000
8 @@ -44,9 +44,9 @@
9 "\n\tdump the machine account details to stdout\n"
10 "\nnet ads lookup"\
11 "\n\tperform a CLDAP search on the server\n"
12 -"\nnet ads password <username@realm> -Uadmin_username@realm%%admin_pass"\
13 +"\nnet ads password <username@realm> <password> -Uadmin_username@realm%%admin_pass"\
14 "\n\tchange a user's password using an admin account"\
15 -"\n\t(note: use realm in UPPERCASE)\n"\
16 +"\n\t(note: use realm in UPPERCASE, prompts if password is obmitted)\n"\
17 "\nnet ads changetrustpw"\
18 "\n\tchange the trust account password of this machine in the AD tree\n"\
19 "\nnet ads printer [info | publish | remove] <printername> <servername>"\
20 @@ -909,7 +909,7 @@
24 - if (argc != 1) {
25 + if (argc < 1) {
26 d_printf("ERROR: You must say which username to change password for\n");
27 return -1;
29 @@ -941,22 +941,24 @@
30 return -1;
33 - asprintf(&prompt, "Enter new password for %s:", user);
35 - new_password = getpass(prompt);
36 + if (argv[1]) {
37 + new_password = (char *)argv[1];
38 + } else {
39 + asprintf(&prompt, "Enter new password for %s:", user);
40 + new_password = getpass(prompt);
41 + free(prompt);
42 + }
44 ret = kerberos_set_password(ads->auth.kdc_server, auth_principal,
45 auth_password, user, new_password, ads->auth.time_offset);
46 if (!ADS_ERR_OK(ret)) {
47 d_printf("Password change failed :-( ...\n");
48 ads_destroy(&ads);
49 - free(prompt);
50 return -1;
53 d_printf("Password change for %s completed.\n", user);
54 ads_destroy(&ads);
55 - free(prompt);
57 return 0;