From: Andreas Schneider Date: Tue, 12 Jan 2021 11:53:08 +0000 (+0100) Subject: s3:torture: Migrate pdbtest to new cmdline option parser X-Git-Tag: tevent-0.11.0~780 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=de159c40c5be8862270ca07b40c522cd9bacf6f4;p=thirdparty%2Fsamba.git s3:torture: Migrate pdbtest to new cmdline option parser Signed-off-by: Andreas Schneider Reviewed-by: Andrew Bartlett --- diff --git a/source3/torture/pdbtest.c b/source3/torture/pdbtest.c index 06aee9c5db1..1a95a3c8646 100644 --- a/source3/torture/pdbtest.c +++ b/source3/torture/pdbtest.c @@ -22,7 +22,7 @@ #include "includes.h" -#include "popt_common.h" +#include "lib/cmdline/cmdline.h" #include "passdb.h" #include "../librpc/gen_ndr/drsblobs.h" @@ -563,11 +563,13 @@ int main(int argc, const char **argv) poptContext pc; static const char *backend = NULL; static const char *unix_user = "nobody"; + bool ok; struct poptOption long_options[] = { {"username", 'u', POPT_ARG_STRING, &unix_user, 0, "Unix user to use for testing", "USERNAME" }, {"backend", 'b', POPT_ARG_STRING, &backend, 0, "Backend to use if not default", "BACKEND[:SETTINGS]" }, POPT_AUTOHELP POPT_COMMON_SAMBA + POPT_COMMON_VERSION POPT_TABLEEND }; @@ -575,7 +577,19 @@ int main(int argc, const char **argv) smb_init_locale(); - pc = poptGetContext("pdbtest", argc, argv, long_options, 0); + ok = samba_cmdline_init(ctx, + SAMBA_CMDLINE_CONFIG_CLIENT, + true /* require_smbconf */); + if (!ok) { + TALLOC_FREE(ctx); + exit(1); + } + + pc = samba_popt_get_context(getprogname(), argc, argv, long_options, 0); + if (pc == NULL) { + TALLOC_FREE(ctx); + exit(1); + } poptSetOtherOptionHelp(pc, "backend[:settings] username"); @@ -583,10 +597,6 @@ int main(int argc, const char **argv) poptFreeContext(pc); - /* Load configuration */ - lp_load_global(get_dyn_CONFIGFILE()); - setup_logging("pdbtest", DEBUG_STDOUT); - if (backend == NULL) { backend = lp_passdb_backend(); } diff --git a/source3/wscript_build b/source3/wscript_build index 9838809f48d..fd7f614cf5d 100644 --- a/source3/wscript_build +++ b/source3/wscript_build @@ -1301,7 +1301,7 @@ bld.SAMBA3_BINARY('pdbtest', deps=''' talloc pdb - popt_samba3 + CMDLINE_S3 AUTH_COMMON auth ''',