The Samba-Bugzilla – Attachment 11430 Details for
Bug 11471
Memory leak in libsmbclient library
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Proposing patch for supporting multi-threaded smbclient library
0001-Patch-to-provide-multi-threaded-libsmbclient-library.patch (text/plain), 3.34 KB, created by
hargagan
on 2015-09-11 08:27:52 UTC
(
hide
)
Description:
Proposing patch for supporting multi-threaded smbclient library
Filename:
MIME Type:
Creator:
hargagan
Created:
2015-09-11 08:27:52 UTC
Size:
3.34 KB
patch
obsolete
>From 5e8bbb78ccea6aa4eeb828c28486675d372d7a41 Mon Sep 17 00:00:00 2001 >From: Har Gagan Sahai <SHarGagan@novell.com> >Date: Fri, 11 Sep 2015 13:54:33 +0530 >Subject: [PATCH] Patch to provide multi threaded libsmbclient library. > >Signed-off-by: Har Gagan Sahai <SHarGagan@novell.com> >--- > lib/util/charset/convert_string.c | 2 +- > lib/util/smb_threads.h | 3 +++ > libcli/auth/smbencrypt.c | 5 ++++- > source3/include/libsmbclient.h | 7 +++++++ > source3/libsmb/wscript | 2 ++ > 5 files changed, 17 insertions(+), 2 deletions(-) > >diff --git a/lib/util/charset/convert_string.c b/lib/util/charset/convert_string.c >index 50065f8..0beac97 100644 >--- a/lib/util/charset/convert_string.c >+++ b/lib/util/charset/convert_string.c >@@ -540,7 +540,7 @@ _PUBLIC_ bool convert_string_talloc(TALLOC_CTX *ctx, > void const *src, size_t srclen, > void *dest, size_t *converted_size) > { >- return convert_string_talloc_handle(ctx, get_iconv_handle(), >+ return convert_string_talloc_handle(ctx, smb_iconv_handle_reinit(ctx, "ASCII", "UTF-8", true, NULL), > from, to, src, srclen, dest, > converted_size); > } >diff --git a/lib/util/smb_threads.h b/lib/util/smb_threads.h >index 9a09616..b412e81 100644 >--- a/lib/util/smb_threads.h >+++ b/lib/util/smb_threads.h >@@ -119,6 +119,9 @@ static int smb_set_tls_pthread(void *pkey, const void *pval, const char *locatio > \ > static void *smb_get_tls_pthread(void *pkey, const char *location) \ > { \ >+ if (pkey == NULL) {\ >+ return NULL; \ >+ }\ > return pthread_getspecific(*(pthread_key_t *)pkey); \ > } \ > \ >diff --git a/libcli/auth/smbencrypt.c b/libcli/auth/smbencrypt.c >index e9eaadf..6559f0b 100644 >--- a/libcli/auth/smbencrypt.c >+++ b/libcli/auth/smbencrypt.c >@@ -74,12 +74,14 @@ bool E_md4hash(const char *passwd, uint8_t p16[16]) > size_t len; > smb_ucs2_t *wpwd; > bool ret; >+ TALLOC_CTX *frame = talloc_stackframe(); > >- ret = push_ucs2_talloc(NULL, &wpwd, passwd, &len); >+ ret = push_ucs2_talloc(frame, &wpwd, passwd, &len); > if (!ret || len < 2) { > /* We don't want to return fixed data, as most callers > * don't check */ > mdfour(p16, (const uint8_t *)passwd, strlen(passwd)); >+ TALLOC_FREE(frame); > return false; > } > >@@ -87,6 +89,7 @@ bool E_md4hash(const char *passwd, uint8_t p16[16]) > mdfour(p16, (const uint8_t *)wpwd, len); > > talloc_free(wpwd); >+ TALLOC_FREE(frame); > return true; > } > >diff --git a/source3/include/libsmbclient.h b/source3/include/libsmbclient.h >index cf67b1d..dae8983 100644 >--- a/source3/include/libsmbclient.h >+++ b/source3/include/libsmbclient.h >@@ -2820,9 +2820,16 @@ smbc_set_credentials_with_fallback(SMBCCTX *ctx, > * > * @return {void} > */ >+#ifdef __cplusplus >+extern "C" { >+#endif >+ > void > smbc_thread_posix(void); > >+#ifdef __cplusplus >+} >+#endif > /** > * @ingroup threads > * >diff --git a/source3/libsmb/wscript b/source3/libsmb/wscript >index 4f8b217..f3d30f7 100644 >--- a/source3/libsmb/wscript >+++ b/source3/libsmb/wscript >@@ -13,6 +13,8 @@ def build(bld): > libsmb_misc.c > libsmb_path.c > libsmb_printjob.c >+ libsmb_thread_posix.c >+ libsmb_thread_impl.c > libsmb_server.c > libsmb_stat.c > libsmb_xattr.c >-- >1.8.4.5 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 11471
:
11375
|
11377
|
11397
| 11430 |
11432