s3:torture: Use lpcfg_set_cmdline()
authorPavel Kalugin <pkalugin@inno.tech>
Mon, 14 Aug 2023 03:01:28 +0000 (06:01 +0300)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 14 Sep 2023 21:35:29 +0000 (21:35 +0000)
Signed-off-by: Pavel Kalugin <pkalugin@inno.tech>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source3/torture/torture.c

index bfce1c9dcd659df64c6d52b885678b7b082a8565..486fb4c8115ec32c39e23d948d08f5709c40875e 100644 (file)
@@ -16233,6 +16233,7 @@ static void usage(void)
        bool correct = True;
        TALLOC_CTX *frame = talloc_stackframe();
        int seed = time(NULL);
+       struct loadparm_context *lp_ctx = NULL;
 
 #ifdef HAVE_SETBUFFER
        setbuffer(stdout, NULL, 0);
@@ -16243,6 +16244,13 @@ static void usage(void)
        smb_init_locale();
        fault_setup();
 
+       lp_ctx = loadparm_init_s3(frame, loadparm_s3_helpers());
+       if (lp_ctx == NULL) {
+               fprintf(stderr,
+                       "Failed to initialise the global parameter structure.\n");
+               return 1;
+       }
+
        if (is_default_dyn_CONFIGFILE()) {
                if(getenv("SMB_CONF_PATH")) {
                        set_dyn_CONFIGFILE(getenv("SMB_CONF_PATH"));
@@ -16299,7 +16307,7 @@ static void usage(void)
                        fstrcpy(workgroup,optarg);
                        break;
                case 'm':
-                       lp_set_cmdline("client max protocol", optarg);
+                       lpcfg_set_cmdline(lp_ctx, "client max protocol", optarg);
                        break;
                case 'N':
                        torture_nprocs = atoi(optarg);
@@ -16308,7 +16316,7 @@ static void usage(void)
                        torture_numops = atoi(optarg);
                        break;
                case 'd':
-                       lp_set_cmdline("log level", optarg);
+                       lpcfg_set_cmdline(lp_ctx, "log level", optarg);
                        break;
                case 'O':
                        sockops = optarg;