libsmb: Provide a talloc_stackframe() to external users of libsmb_setget.c
authorAndrew Bartlett <abartlet@samba.org>
Sun, 30 Mar 2014 21:19:58 +0000 (10:19 +1300)
committerJeremy Allison <jra@samba.org>
Tue, 1 Apr 2014 22:31:48 +0000 (00:31 +0200)
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/libsmb/libsmb_setget.c

index b8adcca18b9be6dacfc302be065002fb3c3a9ee0..3255b522bb092148786f1efaa4a499d116f09267 100644 (file)
@@ -91,9 +91,11 @@ void
 smbc_setDebug(SMBCCTX *c, int debug)
 {
        char buf[32];
+       TALLOC_CTX *frame = talloc_stackframe();
        snprintf(buf, sizeof(buf), "%d", debug);
         c->debug = debug;
        lp_set_cmdline("log level", buf);
+       TALLOC_FREE(frame);
 }
 
 /**
@@ -139,10 +141,15 @@ smbc_setPort(SMBCCTX *c, uint16_t port)
 smbc_bool
 smbc_getOptionDebugToStderr(SMBCCTX *c)
 {
+       smbc_bool ret;
+       TALLOC_CTX *frame = talloc_stackframe();
+
        /* Because this is a global concept, it is better to check
         * what is really set, rather than what we wanted set
         * (particularly as you cannot go back to stdout). */
-        return debug_get_output_is_stderr();
+       ret = debug_get_output_is_stderr();
+       TALLOC_FREE(frame);
+       return ret;
 }
 
 /** Set whether to log to standard error instead of standard output.
@@ -154,6 +161,7 @@ smbc_getOptionDebugToStderr(SMBCCTX *c)
 void
 smbc_setOptionDebugToStderr(SMBCCTX *c, smbc_bool b)
 {
+       TALLOC_CTX *frame = talloc_stackframe();
        if (b) {
                /*
                 * We do not have a unique per-thread debug state? For
@@ -164,6 +172,7 @@ smbc_setOptionDebugToStderr(SMBCCTX *c, smbc_bool b)
                 */
                setup_logging("libsmbclient", DEBUG_STDERR);
        }
+       TALLOC_FREE(frame);
 }
 
 /**
@@ -498,7 +507,11 @@ smbc_setOptionUseNTHash(SMBCCTX *c, smbc_bool b)
 smbc_get_auth_data_fn
 smbc_getFunctionAuthData(SMBCCTX *c)
 {
-        return c->callbacks.auth_fn;
+       smbc_get_auth_data_fn ret;
+       TALLOC_CTX *frame = talloc_stackframe();
+       ret = c->callbacks.auth_fn;
+       TALLOC_FREE(frame);
+       return ret;
 }
 
 /** Set the function for obtaining authentication data */