From 55c45110e6994fe95867f4df3243c6829116e093 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 18 Mar 2010 14:06:13 +1100 Subject: charset: fixed a problem with the global use of the iconv_convenience structure We had a crash bug where a cached copy of a iconv convenience pointer was used after being freed when loadparm asked for iconv to reload. This could happen if a python module used a iconv based function before loadparm was completed. The fix is to ensure that any use of this pointer remains valid, by reusing the pointer itself when it has already been initialised, but filling in the child elements with the updated values. --- source4/scripting/python/modules.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'source4/scripting/python') diff --git a/source4/scripting/python/modules.h b/source4/scripting/python/modules.h index 4d1067cdd4..c73cfff19c 100644 --- a/source4/scripting/python/modules.h +++ b/source4/scripting/python/modules.h @@ -23,6 +23,7 @@ void py_load_samba_modules(void); bool py_update_path(const char *bindir); -#define py_iconv_convenience(mem_ctx) smb_iconv_convenience_init(mem_ctx, "ASCII", PyUnicode_GetDefaultEncoding(), true) +#define py_iconv_convenience(mem_ctx) smb_iconv_convenience_reinit(mem_ctx, "ASCII", \ + PyUnicode_GetDefaultEncoding(), true, NULL) #endif /* __SAMBA_PYTHON_MODULES_H__ */ -- cgit