summaryrefslogtreecommitdiff
path: root/source3/utils
diff options
context:
space:
mode:
Diffstat (limited to 'source3/utils')
-rw-r--r--source3/utils/net.c3
-rw-r--r--source3/utils/nmblookup.c3
-rw-r--r--source3/utils/ntlm_auth.c10
-rw-r--r--source3/utils/pdbedit.c4
-rw-r--r--source3/utils/smbcacls.c45
-rw-r--r--source3/utils/smbtree.c8
-rw-r--r--source3/utils/status.c6
-rw-r--r--source3/utils/testparm.c4
8 files changed, 21 insertions, 62 deletions
diff --git a/source3/utils/net.c b/source3/utils/net.c
index 33c125901b..d6945ceefb 100644
--- a/source3/utils/net.c
+++ b/source3/utils/net.c
@@ -515,7 +515,6 @@ static struct functable net_func[] = {
struct poptOption long_options[] = {
{"help", 'h', POPT_ARG_NONE, 0, 'h'},
{"workgroup", 'w', POPT_ARG_STRING, &opt_target_workgroup},
- {"myworkgroup", 'W', POPT_ARG_STRING, &opt_workgroup},
{"user", 'U', POPT_ARG_STRING, &opt_user_name, 'U'},
{"ipaddress", 'I', POPT_ARG_STRING, 0,'I'},
{"port", 'p', POPT_ARG_INT, &opt_port},
@@ -532,8 +531,6 @@ static struct functable net_func[] = {
{"timeout", 't', POPT_ARG_INT, &opt_timeout},
{"machine-pass",'P', POPT_ARG_NONE, &opt_machine_pass},
POPT_COMMON_SAMBA
- { NULL, 0, POPT_ARG_INCLUDE_TABLE, popt_common_debug },
- { NULL, 0, POPT_ARG_INCLUDE_TABLE, popt_common_configfile },
{ 0, 0, 0, 0}
};
diff --git a/source3/utils/nmblookup.c b/source3/utils/nmblookup.c
index 97cea3a7bb..88038fb566 100644
--- a/source3/utils/nmblookup.c
+++ b/source3/utils/nmblookup.c
@@ -203,9 +203,6 @@ int main(int argc,char *argv[])
{ "root-port", 'r', POPT_ARG_VAL, &RootPort, True, "Use root port 137 (Win95 only replies to this)" },
{ "lookup-by-ip", 'A', POPT_ARG_VAL, &lookup_by_ip, True, "Do a node status on <name> as an IP Address" },
POPT_COMMON_SAMBA
- { NULL, 0, POPT_ARG_INCLUDE_TABLE, popt_common_scope },
- { NULL, 0, POPT_ARG_INCLUDE_TABLE, popt_common_configfile },
- { NULL, 0, POPT_ARG_INCLUDE_TABLE, popt_common_debug },
{ 0, 0, 0, 0 }
};
diff --git a/source3/utils/ntlm_auth.c b/source3/utils/ntlm_auth.c
index ac456769f2..a28bbf9364 100644
--- a/source3/utils/ntlm_auth.c
+++ b/source3/utils/ntlm_auth.c
@@ -439,14 +439,13 @@ enum {
OPT_NT_KEY
};
-int main(int argc, const char **argv)
+ int main(int argc, const char **argv)
{
int opt;
poptContext pc;
struct poptOption long_options[] = {
POPT_AUTOHELP
-
{ "helper-protocol", 0, POPT_ARG_STRING, &helper_protocol, OPT_DOMAIN, "operate as a stdio-based helper", "helper protocol to use"},
{ "username", 0, POPT_ARG_STRING, &username, OPT_USERNAME, "username"},
{ "domain", 0, POPT_ARG_STRING, &domain, OPT_DOMAIN, "domain name"},
@@ -457,10 +456,9 @@ int main(int argc, const char **argv)
{ "password", 0, POPT_ARG_STRING, &password, OPT_PASSWORD, "User's plaintext password"},
{ "request-lm-key", 0, POPT_ARG_NONE, &request_lm_key, OPT_LM_KEY, "Retreive LM session key"},
{ "request-nt-key", 0, POPT_ARG_NONE, &request_nt_key, OPT_NT_KEY, "Retreive NT session key"},
- { NULL, 0, POPT_ARG_INCLUDE_TABLE, popt_common_debug },
- { NULL, 0, POPT_ARG_INCLUDE_TABLE, popt_common_configfile },
- { NULL, 0, POPT_ARG_INCLUDE_TABLE, popt_common_version},
- { 0, 0, 0, 0 }
+ POPT_COMMON_SAMBA
+ POPT_CREDENTIALS
+ POPT_TABLEEND
};
/* Samba client initialisation */
diff --git a/source3/utils/pdbedit.c b/source3/utils/pdbedit.c
index f373adcb0a..03be2571e5 100644
--- a/source3/utils/pdbedit.c
+++ b/source3/utils/pdbedit.c
@@ -537,9 +537,7 @@ int main (int argc, char **argv)
{"value", 'C', POPT_ARG_LONG, &account_policy_value, 'C',"set the account policy to this value", NULL},
{"account-control", 'c', POPT_ARG_STRING, &account_control, 0, "Values of account control", NULL},
POPT_COMMON_SAMBA
- { NULL, 0, POPT_ARG_INCLUDE_TABLE, popt_common_debug },
- { NULL, 0, POPT_ARG_INCLUDE_TABLE, popt_common_configfile },
- {0,0,0,0}
+ POPT_TABLEEND
};
setup_logging("pdbedit", True);
diff --git a/source3/utils/smbcacls.c b/source3/utils/smbcacls.c
index af5bf09e48..ac15cf1aa0 100644
--- a/source3/utils/smbcacls.c
+++ b/source3/utils/smbcacls.c
@@ -24,11 +24,8 @@
#include "includes.h"
-static fstring password;
-static pstring username;
static pstring owner_username;
static fstring server;
-static int got_pass;
static int test_args = False;
static TALLOC_CTX *ctx;
@@ -716,19 +713,19 @@ static struct cli_state *connect_one(const char *share)
NTSTATUS nt_status;
zero_ip(&ip);
- if (!got_pass) {
+ if (!cmdline_auth_info.got_pass) {
char *pass = getpass("Password: ");
if (pass) {
- fstrcpy(password, pass);
- got_pass = True;
+ pstrcpy(cmdline_auth_info.password, pass);
+ cmdline_auth_info.got_pass = True;
}
}
if (NT_STATUS_IS_OK(nt_status = cli_full_connection(&c, global_myname(), server,
&ip, 0,
share, "?????",
- username, lp_workgroup(),
- password, 0, NULL))) {
+ cmdline_auth_info.username, lp_workgroup(),
+ cmdline_auth_info.password, 0, NULL))) {
return c;
} else {
DEBUG(0,("cli_full_connection failed! (%s)\n", nt_errstr(nt_status)));
@@ -743,7 +740,6 @@ static struct cli_state *connect_one(const char *share)
{
char *share;
int opt;
- char *p;
enum acl_mode mode = SMB_ACL_SET;
static char *the_acl = NULL;
enum chown_mode change_mode = REQUEST_NONE;
@@ -759,12 +755,10 @@ static struct cli_state *connect_one(const char *share)
{ "set", 'S', POPT_ARG_STRING, NULL, 'S', "Set acls", "ACLS" },
{ "chown", 'C', POPT_ARG_STRING, NULL, 'C', "Change ownership of a file", "USERNAME" },
{ "chgrp", 'G', POPT_ARG_STRING, NULL, 'G', "Change group ownership of a file", "GROUPNAME" },
- { "numeric", 'n', POPT_ARG_VAL, &numeric, True, "Don't resolve sids or masks to names" },
- { "test-args", 't', POPT_ARG_VAL, &test_args, True, "Test arguments"},
- { NULL, 0, POPT_ARG_INCLUDE_TABLE, popt_common_debug },
- { NULL, 0, POPT_ARG_INCLUDE_TABLE, popt_common_version },
- { NULL, 0, POPT_ARG_INCLUDE_TABLE, popt_common_configfile },
- {"username", 'U', POPT_ARG_STRING, NULL, 'U', "User to authenticate as", "user%password" },
+ { "numeric", 0, POPT_ARG_NONE, &numeric, True, "Don't resolve sids or masks to names" },
+ { "test-args", 't', POPT_ARG_NONE, &test_args, True, "Test arguments"},
+ POPT_COMMON_SAMBA
+ POPT_CREDENTIALS
{ NULL }
};
@@ -781,33 +775,12 @@ static struct cli_state *connect_one(const char *share)
lp_load(dyn_CONFIGFILE,True,False,False);
load_interfaces();
- if (getenv("USER")) {
- pstrcpy(username,getenv("USER"));
-
- if ((p=strchr_m(username,'%'))) {
- *p = 0;
- fstrcpy(password,p+1);
- got_pass = True;
- memset(strchr_m(getenv("USER"), '%') + 1, 'X',
- strlen(password));
- }
- }
pc = poptGetContext("smbcacls", argc, argv, long_options, 0);
poptSetOtherOptionHelp(pc, "//server1/share1 filename");
while ((opt = poptGetNextOpt(pc)) != -1) {
switch (opt) {
- case 'U':
- pstrcpy(username,poptGetOptArg(pc));
- p = strchr_m(username,'%');
- if (p) {
- *p = 0;
- fstrcpy(password, p+1);
- got_pass = 1;
- }
- break;
-
case 'S':
the_acl = smb_xstrdup(poptGetOptArg(pc));
mode = SMB_ACL_SET;
diff --git a/source3/utils/smbtree.c b/source3/utils/smbtree.c
index a55dd4dd00..32506c4101 100644
--- a/source3/utils/smbtree.c
+++ b/source3/utils/smbtree.c
@@ -247,14 +247,12 @@ static BOOL print_tree(struct user_auth_info *user_info)
{
struct poptOption long_options[] = {
POPT_AUTOHELP
- { NULL, 0, POPT_ARG_INCLUDE_TABLE, popt_common_credentials },
- { NULL, 0, POPT_ARG_INCLUDE_TABLE, popt_common_debug },
- { NULL, 0, POPT_ARG_INCLUDE_TABLE, popt_common_version },
- { NULL, 0, POPT_ARG_INCLUDE_TABLE, popt_common_configfile },
{ "broadcast", 'b', POPT_ARG_VAL, &use_bcast, True, "Use broadcast instead of using the master browser" },
{ "domains", 'D', POPT_ARG_VAL, &level, LEV_WORKGROUP, "List only domains (workgroups) of tree" },
{ "servers", 'S', POPT_ARG_VAL, &level, LEV_SERVER, "List domains(workgroups) and servers of tree" },
- { 0 }
+ POPT_COMMON_SAMBA
+ POPT_CREDENTIALS
+ POPT_TABLEEND
};
poptContext pc;
diff --git a/source3/utils/status.c b/source3/utils/status.c
index 8014b133d9..7e87701752 100644
--- a/source3/utils/status.c
+++ b/source3/utils/status.c
@@ -559,10 +559,8 @@ static int traverse_sessionid(TDB_CONTEXT *tdb, TDB_DATA kbuf, TDB_DATA dbuf, vo
{"profile", 'P', POPT_ARG_NONE, &profile_only, 'P', "Do profiling" },
#endif /* WITH_PROFILE */
{"byterange", 'B', POPT_ARG_NONE, &show_brl, 'B', "Include byte range locks"},
- { NULL, 0, POPT_ARG_INCLUDE_TABLE, popt_common_debug },
- { NULL, 0, POPT_ARG_INCLUDE_TABLE, popt_common_version},
- { NULL, 0, POPT_ARG_INCLUDE_TABLE, popt_common_configfile },
- { 0, 0, 0, 0}
+ POPT_COMMON_SAMBA
+ POPT_TABLEEND
};
setup_logging(argv[0],True);
diff --git a/source3/utils/testparm.c b/source3/utils/testparm.c
index 22964214be..c0e4f7606e 100644
--- a/source3/utils/testparm.c
+++ b/source3/utils/testparm.c
@@ -186,7 +186,7 @@ via the %%o substitution. With encrypted passwords this is not possible.\n", lp_
return ret;
}
-int main(int argc, const char *argv[])
+ int main(int argc, const char *argv[])
{
const char *config_file = dyn_CONFIGFILE;
int s;
@@ -206,7 +206,7 @@ int main(int argc, const char *argv[])
{"verbose", 'v', POPT_ARG_NONE, &show_defaults, 1, "Show default options too"},
{"server", 'L',POPT_ARG_STRING, &new_local_machine, 0, "Set %%L macro to servername\n"},
{"encoding", 't', POPT_ARG_STRING, &term_code, 0, "Print parameters with encoding"},
- {NULL, 0, POPT_ARG_INCLUDE_TABLE, popt_common_version},
+ POPT_COMMON_SAMBA
{0,0,0,0}
};