summaryrefslogtreecommitdiffstats
path: root/source3/utils
diff options
context:
space:
mode:
authorJim McDonough <jmcd@samba.org>2003-10-23 14:33:19 +0000
committerJim McDonough <jmcd@samba.org>2003-10-23 14:33:19 +0000
commitc3125b6e2f1e1916faeb02460ab9064ab65dc8a9 (patch)
treede671ea33b95897219f6098782df79be68935ab1 /source3/utils
parenta804eee9ec05680b6af23d5c435a6682f82dfd71 (diff)
downloadsamba-c3125b6e2f1e1916faeb02460ab9064ab65dc8a9.tar.gz
samba-c3125b6e2f1e1916faeb02460ab9064ab65dc8a9.tar.xz
samba-c3125b6e2f1e1916faeb02460ab9064ab65dc8a9.zip
Fix bug 451. Stop net -P from prompting for machine account password.
Based on work by Ken Cross (kcross@nssolutions.com). (This used to be commit 8ef7ac22ef1a60dca0a2d01dc6ff4ba14bc1549a)
Diffstat (limited to 'source3/utils')
-rw-r--r--source3/utils/net.c4
-rw-r--r--source3/utils/net.h1
-rw-r--r--source3/utils/net_ads.c2
3 files changed, 4 insertions, 3 deletions
diff --git a/source3/utils/net.c b/source3/utils/net.c
index 38c144caa8..75fa607cae 100644
--- a/source3/utils/net.c
+++ b/source3/utils/net.c
@@ -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);
diff --git a/source3/utils/net.h b/source3/utils/net.h
index f83d0169bf..78c0aad86a 100644
--- a/source3/utils/net.h
+++ b/source3/utils/net.h
@@ -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;
diff --git a/source3/utils/net_ads.c b/source3/utils/net_ads.c
index 3b955742d8..cad93608dc 100644
--- a/source3/utils/net_ads.c
+++ b/source3/utils/net_ads.c
@@ -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);