Fix bug 451. Stop net -P from prompting for machine account password.
authorJim McDonough <jmcd@samba.org>
Thu, 23 Oct 2003 14:33:19 +0000 (14:33 +0000)
committerJim McDonough <jmcd@samba.org>
Thu, 23 Oct 2003 14:33:19 +0000 (14:33 +0000)
Based on work by Ken Cross (kcross@nssolutions.com).
(This used to be commit 8ef7ac22ef1a60dca0a2d01dc6ff4ba14bc1549a)

source3/utils/net.c
source3/utils/net.h
source3/utils/net_ads.c

index 38c144caa8499e433ef7cf7b8f39ed3eb76e0c72..75fa607caefb83e0433ae062aff1f1099f338d27 100644 (file)
@@ -72,7 +72,7 @@ const char *opt_container = "cn=Users";
 int opt_flags = -1;
 int opt_timeout = 0;
 const char *opt_target_workgroup = NULL;
-static int opt_machine_pass = 0;
+int opt_machine_pass = 0;
 
 BOOL opt_have_ip = False;
 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;
 
-       if (!opt_password) {
+       if (!opt_password && !opt_machine_pass) {
                char *pass = getpass("Password:");
                if (pass) {
                        opt_password = strdup(pass);
index f83d0169bfda70985b713c1b24dc995b1fb8f375..78c0aad86a7c1b537493d44eb7f3b94a9a7152e6 100644 (file)
@@ -48,6 +48,7 @@ extern const char *opt_workgroup;
 extern int opt_long_list_entries;
 extern int opt_reboot;
 extern int opt_force;
+extern int opt_machine_pass;
 extern int opt_timeout;
 extern const char *opt_host;
 extern const char *opt_user_name;
index 3b955742d845e7102378177f28e7c4294b316d51..cad93608dc42396e13e7607433029f90cd701498 100644 (file)
@@ -145,7 +145,7 @@ static ADS_STRUCT *ads_startup(void)
        }
 
 retry:
-       if (!opt_password && need_password) {
+       if (!opt_password && need_password && !opt_machine_pass) {
                char *prompt;
                asprintf(&prompt,"%s password: ", opt_user_name);
                opt_password = getpass(prompt);