summaryrefslogtreecommitdiff
path: root/source3/client
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2003-04-28 06:59:08 +0000
committerTim Potter <tpot@samba.org>2003-04-28 06:59:08 +0000
commita2e4ac9eef9eba7eafbab8731f23a5146ee4221f (patch)
tree2d88ce4df8fd88550d3daddb6367f85cfb80b4c6 /source3/client
parent5ef616cd5ec8d604bb5cdd14bb644a9c0b0c1bca (diff)
downloadsamba-a2e4ac9eef9eba7eafbab8731f23a5146ee4221f.tar.gz
samba-a2e4ac9eef9eba7eafbab8731f23a5146ee4221f.tar.bz2
samba-a2e4ac9eef9eba7eafbab8731f23a5146ee4221f.zip
Merge of -W fixes for bug #39:
>Replace workgroup global variable with lp_workgroup() > >Call lp_load() before parsing command line options so we can override >the workgroup value with the -W switch. (This used to be commit 272d06369d79250b484a22bc7e531eecd03e7c90)
Diffstat (limited to 'source3/client')
-rw-r--r--source3/client/client.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/source3/client/client.c b/source3/client/client.c
index 167f91ae16..f885106275 100644
--- a/source3/client/client.c
+++ b/source3/client/client.c
@@ -37,7 +37,6 @@ static pstring service;
static pstring desthost;
static pstring username;
static pstring password;
-static pstring workgroup;
static BOOL use_kerberos;
static BOOL got_pass;
static char *cmdstr = NULL;
@@ -2552,10 +2551,10 @@ static struct cli_state *do_connect(const char *server, const char *share)
if (!cli_session_setup(c, username,
password, strlen(password),
password, strlen(password),
- workgroup)) {
+ lp_workgroup())) {
/* if a password was not supplied then try again with a null username */
if (password[0] || !username[0] || use_kerberos ||
- !cli_session_setup(c, "", "", 0, "", 0, workgroup)) {
+ !cli_session_setup(c, "", "", 0, "", 0, lp_workgroup())) {
d_printf("session setup failed: %s\n", cli_errstr(c));
cli_shutdown(c);
return NULL;
@@ -2620,7 +2619,7 @@ static int do_host_query(char *query_host)
return 1;
browse_host(True);
- list_servers(workgroup);
+ list_servers(lp_workgroup());
cli_shutdown(cli);
@@ -2761,6 +2760,11 @@ static void remember_query_host(const char *arg,
setup_logging(argv[0],True);
+ if (!lp_load(dyn_CONFIGFILE,True,False,False)) {
+ fprintf(stderr, "%s: Can't load %s - run testparm to debug it\n",
+ argv[0], dyn_CONFIGFILE);
+ }
+
pc = poptGetContext("smbclient", argc, (const char **) argv, long_options,
POPT_CONTEXT_KEEP_FIRST);
poptSetOtherOptionHelp(pc, "service <password>");
@@ -2816,11 +2820,6 @@ static void remember_query_host(const char *arg,
}
}
- if (!lp_load(dyn_CONFIGFILE,True,False,False)) {
- fprintf(stderr, "%s: Can't load %s - run testparm to debug it\n",
- argv[0], dyn_CONFIGFILE);
- }
-
poptGetArg(pc);
load_interfaces();
@@ -2856,7 +2855,6 @@ static void remember_query_host(const char *arg,
pstrcpy(username, cmdline_auth_info.username);
pstrcpy(password, cmdline_auth_info.password);
- pstrcpy(workgroup, lp_workgroup());
use_kerberos = cmdline_auth_info.use_kerberos;
got_pass = cmdline_auth_info.got_pass;