summaryrefslogtreecommitdiff
path: root/source4/utils
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2005-06-13 08:12:39 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:18:06 -0500
commit2b4791ae733488845b2c36bca64db695203de571 (patch)
treee6c3836a90b412e61b10d30f3b256092b46811c7 /source4/utils
parent8fd5825a890db4f08966e4b262b03fb7868cc4c2 (diff)
downloadsamba-2b4791ae733488845b2c36bca64db695203de571.tar.gz
samba-2b4791ae733488845b2c36bca64db695203de571.tar.bz2
samba-2b4791ae733488845b2c36bca64db695203de571.zip
r7525: Unify lp_load(), load_interfaces and logging setup into popt().
There is now a new --debug-stderr option to enable debug to STDERR. popt isn't perfect, but the callbacks are used in all the main Samba binaries, and should be used in the rest. This avoids duplicated code, and ensures every binary is setup correctly. This also ensures the setup happens early enough to have -s function, and have a correct impact on the credentials code. (Fixing a bug that frustrated tridge earlier today). The only 'subtle' aspect of all this is that I'm pretty sure that the SAMBA_COMMON popt code must be above the CREDENTIALS code, in the popt tables. Andrew Bartlett (This used to be commit 50f3c2b3a22971f40e0d3a88127b5120bfc47591)
Diffstat (limited to 'source4/utils')
-rw-r--r--source4/utils/ndrdump.c2
-rw-r--r--source4/utils/net/net.c7
-rw-r--r--source4/utils/nmblookup.c5
-rw-r--r--source4/utils/ntlm_auth.c8
4 files changed, 2 insertions, 20 deletions
diff --git a/source4/utils/ndrdump.c b/source4/utils/ndrdump.c
index eabeaad537..58cdeb13c3 100644
--- a/source4/utils/ndrdump.c
+++ b/source4/utils/ndrdump.c
@@ -121,8 +121,6 @@ static char *stdin_load(TALLOC_CTX *mem_ctx, size_t *size)
POPT_TABLEEND
};
- setup_logging("ndrdump", DEBUG_STDOUT);
-
ndrdump_init_subsystems;
pc = poptGetContext("ndrdump", argc, argv, long_options, 0);
diff --git a/source4/utils/net/net.c b/source4/utils/net/net.c
index c7c6f7dec9..51b860234d 100644
--- a/source4/utils/net/net.c
+++ b/source4/utils/net/net.c
@@ -154,14 +154,12 @@ static int binary_net(int argc, const char **argv)
POPT_TABLEEND
};
- setup_logging("net", DEBUG_STDOUT);
-
#ifdef HAVE_SETBUFFER
setbuffer(stdout, NULL, 0);
#endif
pc = poptGetContext("net", argc, (const char **) argv, long_options,
- POPT_CONTEXT_KEEP_FIRST);
+ POPT_CONTEXT_KEEP_FIRST);
while((opt = poptGetNextOpt(pc)) != -1) {
switch (opt) {
@@ -173,9 +171,6 @@ static int binary_net(int argc, const char **argv)
}
}
- lp_load(dyn_CONFIGFILE,True,False,False);
- load_interfaces();
-
argv_new = (const char **)poptGetArgs(pc);
argc_new = argc;
diff --git a/source4/utils/nmblookup.c b/source4/utils/nmblookup.c
index fb21cb5529..900d55d6df 100644
--- a/source4/utils/nmblookup.c
+++ b/source4/utils/nmblookup.c
@@ -271,8 +271,6 @@ int main(int argc,char *argv[])
{ 0, 0, 0, 0 }
};
- setup_logging(argv[0], DEBUG_STDOUT);
-
pc = poptGetContext("nmblookup", argc, (const char **)argv, long_options,
POPT_CONTEXT_KEEP_FIRST);
@@ -288,9 +286,6 @@ int main(int argc,char *argv[])
exit(1);
}
- lp_load(dyn_CONFIGFILE,True,False,False);
- load_interfaces();
-
while (poptPeekArg(pc)) {
const char *name = poptGetArg(pc);
diff --git a/source4/utils/ntlm_auth.c b/source4/utils/ntlm_auth.c
index 4c7286a4c1..8e858e2970 100644
--- a/source4/utils/ntlm_auth.c
+++ b/source4/utils/ntlm_auth.c
@@ -865,13 +865,7 @@ enum {
/* Samba client initialisation */
- setup_logging("ntlm_auth", DEBUG_STDERR);
-
- if (!lp_load(dyn_CONFIGFILE, True, False, False)) {
- d_fprintf(stderr, "wbinfo: error opening config file %s. Error was %s\n",
- dyn_CONFIGFILE, strerror(errno));
- exit(1);
- }
+ setup_logging(NULL, DEBUG_STDERR);
/* Parse options */