summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/client/client.c11
-rw-r--r--source3/include/popt_common.h1
-rw-r--r--source3/lib/popt_common.c25
-rw-r--r--source3/rpcclient/rpcclient.c15
-rw-r--r--source3/utils/regedit.c5
-rw-r--r--source3/utils/smbcacls.c5
-rw-r--r--source3/utils/smbcquotas.c12
-rw-r--r--source3/utils/smbtree.c5
8 files changed, 31 insertions, 48 deletions
diff --git a/source3/client/client.c b/source3/client/client.c
index 82521288be9..cde9776db9a 100644
--- a/source3/client/client.c
+++ b/source3/client/client.c
@@ -5765,6 +5765,7 @@ int main(int argc,char *argv[])
lp_set_cmdline("log level", "1");
+ popt_common_credentials_set_ignore_missing_conf();
popt_common_credentials_set_delay_post();
/* skip argv(0) */
@@ -5901,16 +5902,6 @@ int main(int argc,char *argv[])
poptGetArg(pc));
}
- if ( override_logfile )
- setup_logging( lp_logfile(talloc_tos()), DEBUG_FILE );
-
- if (!lp_load_client(get_dyn_CONFIGFILE())) {
- fprintf(stderr, "%s: Can't load %s - run testparm to debug it\n",
- argv[0], get_dyn_CONFIGFILE());
- }
-
- load_interfaces();
-
if (service_opt && service) {
size_t len;
diff --git a/source3/include/popt_common.h b/source3/include/popt_common.h
index ec7568c9fc3..2abfa04095c 100644
--- a/source3/include/popt_common.h
+++ b/source3/include/popt_common.h
@@ -50,6 +50,7 @@ extern const struct poptOption popt_common_dynconfig[];
extern struct user_auth_info *cmdline_auth_info;
+void popt_common_credentials_set_ignore_missing_conf(void);
void popt_common_credentials_set_delay_post(void);
void popt_common_credentials_post(void);
void popt_burn_cmdline_password(int argc, char *argv[]);
diff --git a/source3/lib/popt_common.c b/source3/lib/popt_common.c
index b2fd39c56b4..e229ad2ec71 100644
--- a/source3/lib/popt_common.c
+++ b/source3/lib/popt_common.c
@@ -348,8 +348,14 @@ static void get_credentials_file(struct user_auth_info *auth_info,
*/
struct user_auth_info *cmdline_auth_info;
+static bool popt_common_credentials_ignore_missing_conf;
static bool popt_common_credentials_delay_post;
+void popt_common_credentials_set_ignore_missing_conf(void)
+{
+ popt_common_credentials_delay_post = true;
+}
+
void popt_common_credentials_set_delay_post(void)
{
popt_common_credentials_delay_post = true;
@@ -412,6 +418,25 @@ static void popt_common_credentials_callback(poptContext con,
}
if (reason == POPT_CALLBACK_REASON_POST) {
+ bool ok;
+
+ if (override_logfile) {
+ setup_logging(lp_logfile(talloc_tos()), DEBUG_FILE );
+ }
+
+ ok = lp_load_client(get_dyn_CONFIGFILE());
+ if (!ok) {
+ const char *pname = poptGetInvocationName(con);
+
+ fprintf(stderr, "%s: Can't load %s - run testparm to debug it\n",
+ pname, get_dyn_CONFIGFILE());
+ if (!popt_common_credentials_ignore_missing_conf) {
+ exit(1);
+ }
+ }
+
+ load_interfaces();
+
if (popt_common_credentials_delay_post) {
return;
}
diff --git a/source3/rpcclient/rpcclient.c b/source3/rpcclient/rpcclient.c
index 138fdba0b52..9faf01b0890 100644
--- a/source3/rpcclient/rpcclient.c
+++ b/source3/rpcclient/rpcclient.c
@@ -949,7 +949,6 @@ out_free:
char *user, *domain, *q;
const char *host;
int signing_state = SMB_SIGNING_IPC_DEFAULT;
- bool ok;
/* make sure the vars that get altered (4th field) are in
a fixed location or certain compilers complain */
@@ -1016,17 +1015,6 @@ out_free:
popt_burn_cmdline_password(argc, argv);
rpcclient_auth_info = cmdline_auth_info;
- /* Load smb.conf file */
-
- ok = lp_load_global(get_dyn_CONFIGFILE());
- if (!ok) {
- fprintf(stderr,
- "Can't load %s - run testparm to debug it\n",
- get_dyn_CONFIGFILE());
- result = 1;
- goto done;
- }
-
nt_status = messaging_init_client(talloc_autofree_context(),
samba_tevent_context_init(talloc_autofree_context()),
&rpcclient_msg_ctx);
@@ -1045,9 +1033,6 @@ out_free:
goto done;
}
- /* We must load interfaces after we load the smb.conf */
- load_interfaces();
-
if (!init_names()) {
result = 1;
goto done;
diff --git a/source3/utils/regedit.c b/source3/utils/regedit.c
index 476897f4e78..14e75c25bfa 100644
--- a/source3/utils/regedit.c
+++ b/source3/utils/regedit.c
@@ -781,11 +781,6 @@ int main(int argc, const char **argv)
/* TODO */
}
- if (!lp_load_global(get_dyn_CONFIGFILE())) {
- DEBUG(0, ("ERROR loading config file...\n"));
- exit(1);
- }
-
rv = reg_open_samba3(frame, &ctx);
if (!W_ERROR_IS_OK(rv)) {
fprintf(stderr, "Unable to open registry: %s\n",
diff --git a/source3/utils/smbcacls.c b/source3/utils/smbcacls.c
index 7705eb4c9f2..255ff9729b7 100644
--- a/source3/utils/smbcacls.c
+++ b/source3/utils/smbcacls.c
@@ -831,6 +831,8 @@ int main(int argc, char *argv[])
setlinebuf(stdout);
+ popt_common_credentials_set_ignore_missing_conf();
+
pc = poptGetContext("smbcacls", argc, argv_const, long_options, 0);
poptSetOtherOptionHelp(pc, "//server1/share1 filename\nACLs look like: "
@@ -894,9 +896,6 @@ int main(int argc, char *argv[])
return -1;
}
- lp_load_global(get_dyn_CONFIGFILE());
- load_interfaces();
-
filename = talloc_strdup(frame, poptGetArg(pc));
if (!filename) {
return -1;
diff --git a/source3/utils/smbcquotas.c b/source3/utils/smbcquotas.c
index ba80926580a..a1cf70a1935 100644
--- a/source3/utils/smbcquotas.c
+++ b/source3/utils/smbcquotas.c
@@ -575,7 +575,6 @@ int main(int argc, char *argv[])
static bool test_args = False;
struct cli_state *cli;
bool fix_user = False;
- bool ok;
SMB_NTQUOTA_STRUCT qt;
TALLOC_CTX *frame = talloc_stackframe();
poptContext pc;
@@ -700,17 +699,6 @@ FSQFLAGS:QUOTA_ENABLED/DENY_DISK/LOG_SOFTLIMIT/LOG_HARD_LIMIT", "SETSTRING" },
poptFreeContext(pc);
popt_burn_cmdline_password(argc, argv);
- ok = lp_load_global(get_dyn_CONFIGFILE());
- if (!ok) {
- DBG_ERR("ERROR: Loading config file %s - "
- "run testparm to debug it\n",
- get_dyn_CONFIGFILE());
- exit(EXIT_PARSE_ERROR);
- }
-
- /* We must load interfaces after we load the smb.conf */
- load_interfaces();
-
string_replace(path, '/', '\\');
server = SMB_STRDUP(path+2);
diff --git a/source3/utils/smbtree.c b/source3/utils/smbtree.c
index 2f11dced12e..ba7b3182b64 100644
--- a/source3/utils/smbtree.c
+++ b/source3/utils/smbtree.c
@@ -307,15 +307,14 @@ int main(int argc, char *argv[])
setup_logging(argv[0], DEBUG_STDERR);
+ popt_common_credentials_set_ignore_missing_conf();
+
pc = poptGetContext("smbtree", argc, argv_const, long_options,
POPT_CONTEXT_KEEP_FIRST);
while(poptGetNextOpt(pc) != -1);
poptFreeContext(pc);
popt_burn_cmdline_password(argc, argv);
- lp_load_global(get_dyn_CONFIGFILE());
- load_interfaces();
-
/* Now do our stuff */
if (!print_tree(cmdline_auth_info)) {