summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2002-09-25 10:17:08 +0000
committerJelmer Vernooij <jelmer@samba.org>2002-09-25 10:17:08 +0000
commit237883d1e68e99a3ea3df9b6e182c70cb31b2523 (patch)
tree9d8a69a59fd8ef8a81d57fb79da7564553f22a3a
parentd5303d5c080212486329f7e5a65f732e11efbb37 (diff)
downloadsamba-237883d1e68e99a3ea3df9b6e182c70cb31b2523.tar.gz
samba-237883d1e68e99a3ea3df9b6e182c70cb31b2523.tar.xz
samba-237883d1e68e99a3ea3df9b6e182c70cb31b2523.zip
samtest should load smb.conf by default
add command-line option to samtest to specify alternate config file - use /dev/null to don't load any config file.. add 'conf' command to load specified config file
-rw-r--r--source/torture/samtest.c27
1 files changed, 26 insertions, 1 deletions
diff --git a/source/torture/samtest.c b/source/torture/samtest.c
index e68ff5a0bf3..5503887e628 100644
--- a/source/torture/samtest.c
+++ b/source/torture/samtest.c
@@ -53,6 +53,24 @@ static char* next_command (char** cmdstr)
return command;
}
+/* Load specified configuration file */
+static NTSTATUS cmd_conf(struct samtest_state *sam, TALLOC_CTX *mem_ctx,
+ int argc, char **argv)
+{
+ if (argc != 2) {
+ printf("Usage: %s <smb.conf>\n", argv[0]);
+ return NT_STATUS_OK;
+ }
+
+ if (!lp_load(argv[1], False, True, False)) {
+ printf("Error loading \"%s\"\n", argv[1]);
+ return NT_STATUS_OK;
+ }
+
+ printf("\"%s\" successfully loaded\n", argv[1]);
+ return NT_STATUS_OK;
+}
+
/* Display help on commands */
static NTSTATUS cmd_help(struct samtest_state *st, TALLOC_CTX *mem_ctx,
int argc, char **argv)
@@ -143,6 +161,7 @@ static struct cmd_set samtest_commands[] = {
{ "help", cmd_help, "Get help on commands", "" },
{ "?", cmd_help, "Get help on commands", "" },
+ { "conf", cmd_conf, "Load smb configuration file", "conf <smb.conf>" },
{ "debuglevel", cmd_debuglevel, "Set debug level", "" },
{ "exit", cmd_quit, "Exit program", "" },
{ "quit", cmd_quit, "Exit program", "" },
@@ -336,6 +355,7 @@ int main(int argc, char *argv[])
int opt;
static char *cmdstr = "";
static char *opt_logfile=NULL;
+ static char *config_file = dyn_CONFIGFILE;
pstring logfile;
struct cmd_set **cmd_set;
extern BOOL AllowDebugChange;
@@ -348,8 +368,9 @@ int main(int argc, char *argv[])
struct poptOption long_options[] = {
POPT_AUTOHELP
{ NULL, 0, POPT_ARG_INCLUDE_TABLE, popt_common_debug },
- {"command", 'c', POPT_ARG_STRING, &cmdstr, 'c', "Execute semicolon seperated cmds"},
+ {"command", 'e', POPT_ARG_STRING, &cmdstr, 'e', "Execute semicolon seperated cmds"},
{"logfile", 'l', POPT_ARG_STRING, &opt_logfile, 'l', "Logfile to use instead of stdout"},
+ {"configfile", 'c', POPT_ARG_STRING, &config_file, 0,"use different configuration file",NULL},
{ 0, 0, 0, 0}
};
@@ -374,6 +395,10 @@ int main(int argc, char *argv[])
}
}
+ if (!lp_load(config_file,True,False,False)) {
+ fprintf(stderr, "Can't load %s - run testparm to debug it\n", config_file);
+ exit(1);
+ }
poptFreeContext(pc);