s3-masktest: Fix cli_errstr() usage (part of bug #7864)
[idra/samba.git] / source3 / torture / masktest.c
index 82aa6bff3615c2c8988abd5045ceee5c17a28fab..887910284441c5553f55afd0f36d9f587fc02e0f 100644 (file)
@@ -34,7 +34,6 @@ static int ignore_dot_errors = 0;
 
 extern char *optarg;
 extern int optind;
-extern bool AllowDebugChange;
 
 /* a test fn for LANMAN mask support */
 static int ms_fnmatch_lanman_core(const char *pattern, const char *string)
@@ -227,11 +226,12 @@ static struct cli_state *connect_one(char *share)
                }
        }
 
-       if (!NT_STATUS_IS_OK(cli_session_setup(c, username, 
-                                              password, strlen(password),
-                                              password, strlen(password),
-                                              lp_workgroup()))) {
-               DEBUG(0,("session setup failed: %s\n", cli_errstr(c)));
+       status = cli_session_setup(c, username,
+                                  password, strlen(password),
+                                  password, strlen(password),
+                                  lp_workgroup());
+       if (!NT_STATUS_IS_OK(status)) {
+               DEBUG(0, ("session setup failed: %s\n", nt_errstr(status)));
                return NULL;
        }
 
@@ -484,10 +484,7 @@ static void usage(void)
 
        setlinebuf(stdout);
 
-       dbf = x_stderr;
-
-       DEBUGLEVEL = 0;
-       AllowDebugChange = False;
+       lp_set_cmdline("log level", "0");
 
        if (argc < 2 || argv[1][0] == '-') {
                usage();
@@ -498,7 +495,7 @@ static void usage(void)
 
        all_string_sub(share,"/","\\",0);
 
-       setup_logging(argv[0],True);
+       setup_logging(argv[0], DEBUG_STDERR);
 
        argc -= 1;
        argv += 1;
@@ -519,7 +516,7 @@ static void usage(void)
                        NumLoops = atoi(optarg);
                        break;
                case 'd':
-                       DEBUGLEVEL = atoi(optarg);
+                       lp_set_cmdline("log level", optarg);
                        break;
                case 'E':
                        die_on_error = 1;