1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-27 03:21:53 +03:00

r12840: Add -W to smbpasswd. Thanks to William Jojo <jojowil@hvcc.edu>.

Volker
This commit is contained in:
Volker Lendecke 2006-01-11 12:09:30 +00:00 committed by Gerald (Jerry) Carter
parent 9c44fef5be
commit 2942f3594b

View File

@ -92,7 +92,7 @@ static int process_options(int argc, char **argv, int local_flags)
user_name[0] = '\0'; user_name[0] = '\0';
while ((ch = getopt(argc, argv, "c:axdehminjr:sw:R:D:U:L")) != EOF) { while ((ch = getopt(argc, argv, "c:axdehminjr:sw:R:D:U:LW")) != EOF) {
switch(ch) { switch(ch) {
case 'L': case 'L':
local_flags |= LOCAL_AM_ROOT; local_flags |= LOCAL_AM_ROOT;
@ -153,6 +153,10 @@ static int process_options(int argc, char **argv, int local_flags)
got_username = True; got_username = True;
fstrcpy(user_name, optarg); fstrcpy(user_name, optarg);
break; break;
case 'W':
local_flags |= LOCAL_SET_LDAP_ADMIN_PW;
*ldap_secret = '\0';
break;
} }
case 'h': case 'h':
default: default:
@ -325,6 +329,10 @@ static int process_root(int local_flags)
if (local_flags & LOCAL_SET_LDAP_ADMIN_PW) { if (local_flags & LOCAL_SET_LDAP_ADMIN_PW) {
printf("Setting stored password for \"%s\" in secrets.tdb\n", printf("Setting stored password for \"%s\" in secrets.tdb\n",
lp_ldap_admin_dn()); lp_ldap_admin_dn());
if ( ! *ldap_secret ) {
new_passwd = prompt_for_new_password(stdin_passwd_get);
fstrcpy(ldap_secret, new_passwd);
}
if (!store_ldap_admin_pw(ldap_secret)) if (!store_ldap_admin_pw(ldap_secret))
DEBUG(0,("ERROR: Failed to store the ldap admin password!\n")); DEBUG(0,("ERROR: Failed to store the ldap admin password!\n"));
goto done; goto done;