s3:utils: Fix setting the debug level
authorAndreas Schneider <asn@samba.org>
Wed, 6 Dec 2023 07:48:34 +0000 (08:48 +0100)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 7 Dec 2023 05:33:21 +0000 (05:33 +0000)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15525

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Thu Dec  7 05:33:21 UTC 2023 on atb-devel-224

source3/utils/smbget.c

index a43679328c12105176c17be39353375f8b9eb5d9..dc8dace8a55988a6dbbe94999660746840c0d09b 100644 (file)
@@ -849,6 +849,7 @@ int main(int argc, char **argv)
        uint32_t gensec_features;
        bool use_wbccache = false;
        SMBCCTX *smb_ctx = NULL;
+       int dbg_lvl = -1;
        int rc;
 
        smb_init_locale();
@@ -922,13 +923,16 @@ int main(int argc, char **argv)
 
        samba_cmdline_burn(argc, argv);
 
+       /* smbc_new_context() will set the log level to 0 */
+       dbg_lvl = debuglevel_get();
+
        smb_ctx = smbc_new_context();
        if (smb_ctx == NULL) {
                fprintf(stderr, "Unable to initialize libsmbclient\n");
                ok = false;
                goto done;
        }
-       smbc_setDebug(smb_ctx, debuglevel_get());
+       smbc_setDebug(smb_ctx, dbg_lvl);
 
        rc = smbc_setConfiguration(smb_ctx, lp_default_path());
        if (rc < 0) {