summaryrefslogtreecommitdiff
path: root/source3/client/client.c
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2003-04-28 06:54:49 +0000
committerTim Potter <tpot@samba.org>2003-04-28 06:54:49 +0000
commit5bab7b987c1ace9f28e744d5de3b03b46c788a8c (patch)
treeb014167e08b377aced405680d0a24f2d55f03e43 /source3/client/client.c
parent90dbd21cd09f7fa32766dfbf09a646d2a524695c (diff)
downloadsamba-5bab7b987c1ace9f28e744d5de3b03b46c788a8c.tar.gz
samba-5bab7b987c1ace9f28e744d5de3b03b46c788a8c.tar.bz2
samba-5bab7b987c1ace9f28e744d5de3b03b46c788a8c.zip
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. Fixes bug #39. (This used to be commit 56f070cd5242ac6c10699ca35726ce68199dd274)
Diffstat (limited to 'source3/client/client.c')
-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 b6c4b704a9..f5be4e9859 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;
@@ -2411,10 +2410,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;
@@ -2479,7 +2478,7 @@ static int do_host_query(char *query_host)
return 1;
browse_host(True);
- list_servers(workgroup);
+ list_servers(lp_workgroup());
cli_shutdown(cli);
@@ -2620,6 +2619,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>");
@@ -2675,11 +2679,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();
@@ -2715,7 +2714,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;