]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:torture: Migrate pdbtest to new cmdline option parser
authorAndreas Schneider <asn@samba.org>
Tue, 12 Jan 2021 11:53:08 +0000 (12:53 +0100)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 20 May 2021 02:58:36 +0000 (02:58 +0000)
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source3/torture/pdbtest.c
source3/wscript_build

index 06aee9c5db126b336ef31536ebfe76c6414b0492..1a95a3c8646f0875f46db7f95ee2d0e667fe5649 100644 (file)
@@ -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();
        }
index 9838809f48ddfbea2af31a1f100ef6bb4017c17c..fd7f614cf5d853b5d8d99fbdf6272ae8f56d6740 100644 (file)
@@ -1301,7 +1301,7 @@ bld.SAMBA3_BINARY('pdbtest',
                  deps='''
                       talloc
                       pdb
-                      popt_samba3
+                      CMDLINE_S3
                       AUTH_COMMON
                       auth
                       ''',