mirror of
https://github.com/samba-team/samba.git
synced 2025-08-03 04:22:09 +03:00
Fix client authentication with -P switch in client tools (Bug 5435).
Guenther
(This used to be commit d077ef64cd
)
This commit is contained in:
@ -514,35 +514,7 @@ static void popt_common_credentials_callback(poptContext con,
|
||||
}
|
||||
break;
|
||||
case 'P':
|
||||
{
|
||||
char *opt_password = NULL;
|
||||
char *pwd = NULL;
|
||||
|
||||
/* it is very useful to be able to make ads queries as the
|
||||
machine account for testing purposes and for domain leave */
|
||||
|
||||
if (!secrets_init()) {
|
||||
d_printf("ERROR: Unable to open secrets database\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
opt_password = secrets_fetch_machine_password(lp_workgroup(), NULL, NULL);
|
||||
|
||||
if (!opt_password) {
|
||||
d_printf("ERROR: Unable to fetch machine password\n");
|
||||
exit(1);
|
||||
}
|
||||
if (asprintf(&pwd, "%s$", global_myname()) < 0) {
|
||||
exit(ENOMEM);
|
||||
}
|
||||
set_cmdline_auth_info_username(pwd);
|
||||
set_cmdline_auth_info_password(opt_password);
|
||||
SAFE_FREE(pwd);
|
||||
SAFE_FREE(opt_password);
|
||||
|
||||
/* machine accounts only work with kerberos */
|
||||
set_cmdline_auth_info_use_krb5_ticket();
|
||||
}
|
||||
set_cmdline_auth_info_use_machine_account();
|
||||
break;
|
||||
case 'N':
|
||||
set_cmdline_auth_info_password("");
|
||||
|
Reference in New Issue
Block a user