mirror of
https://github.com/samba-team/samba.git
synced 2025-08-04 08:22:08 +03:00
Fix bug 451. Stop net -P from prompting for machine account password.
Based on work by Ken Cross (kcross@nssolutions.com).
This commit is contained in:
@ -72,7 +72,7 @@ const char *opt_container = "cn=Users";
|
|||||||
int opt_flags = -1;
|
int opt_flags = -1;
|
||||||
int opt_timeout = 0;
|
int opt_timeout = 0;
|
||||||
const char *opt_target_workgroup = NULL;
|
const char *opt_target_workgroup = NULL;
|
||||||
static int opt_machine_pass = 0;
|
int opt_machine_pass = 0;
|
||||||
|
|
||||||
BOOL opt_have_ip = False;
|
BOOL opt_have_ip = False;
|
||||||
struct in_addr opt_dest_ip;
|
struct in_addr opt_dest_ip;
|
||||||
@ -130,7 +130,7 @@ NTSTATUS connect_to_ipc(struct cli_state **c, struct in_addr *server_ip,
|
|||||||
{
|
{
|
||||||
NTSTATUS nt_status;
|
NTSTATUS nt_status;
|
||||||
|
|
||||||
if (!opt_password) {
|
if (!opt_password && !opt_machine_pass) {
|
||||||
char *pass = getpass("Password:");
|
char *pass = getpass("Password:");
|
||||||
if (pass) {
|
if (pass) {
|
||||||
opt_password = strdup(pass);
|
opt_password = strdup(pass);
|
||||||
|
@ -48,6 +48,7 @@ extern const char *opt_workgroup;
|
|||||||
extern int opt_long_list_entries;
|
extern int opt_long_list_entries;
|
||||||
extern int opt_reboot;
|
extern int opt_reboot;
|
||||||
extern int opt_force;
|
extern int opt_force;
|
||||||
|
extern int opt_machine_pass;
|
||||||
extern int opt_timeout;
|
extern int opt_timeout;
|
||||||
extern const char *opt_host;
|
extern const char *opt_host;
|
||||||
extern const char *opt_user_name;
|
extern const char *opt_user_name;
|
||||||
|
@ -145,7 +145,7 @@ static ADS_STRUCT *ads_startup(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
retry:
|
retry:
|
||||||
if (!opt_password && need_password) {
|
if (!opt_password && need_password && !opt_machine_pass) {
|
||||||
char *prompt;
|
char *prompt;
|
||||||
asprintf(&prompt,"%s password: ", opt_user_name);
|
asprintf(&prompt,"%s password: ", opt_user_name);
|
||||||
opt_password = getpass(prompt);
|
opt_password = getpass(prompt);
|
||||||
|
Reference in New Issue
Block a user