const char *fromcode, bool native_iconv);
void load_case_tables(void);
+void load_case_tables_library(void);
bool smb_register_charset(const struct charset_functions *funcs_in);
/*
/*******************************************************************
load the case handling tables
+
+This is the function that should be called from library code.
********************************************************************/
-void load_case_tables(void)
+void load_case_tables_library(void)
{
TALLOC_CTX *mem_ctx;
}
}
+/*******************************************************************
+load the case handling tables
+
+This MUST only be called from main() in application code, never from a
+library. We don't know if the calling program has already done
+setlocale() to another value, and can't tell if they have.
+********************************************************************/
+void load_case_tables(void)
+{
+ /* This is a useful global hook where we can ensure that the
+ * locale is set from the environment. This is needed so that
+ * we can use LOCALE as a codepage */
+#ifdef HAVE_SETLOCALE
+ setlocale(LC_ALL, "");
+#endif
+ load_case_tables_library();
+}
+
/**
Convert a codepoint_t to upper case.
**/
return toupper(val);
}
if (upcase_table == NULL) {
- load_case_tables();
+ load_case_tables_library();
}
if (upcase_table == (void *)-1) {
return val;
return tolower(val);
}
if (lowcase_table == NULL) {
- load_case_tables();
+ load_case_tables_library();
}
if (lowcase_table == (void *)-1) {
return val;
static void nss_wins_init(void)
{
initialised = 1;
- load_case_tables();
+ load_case_tables_library();
lp_set_cmdline("log level", "0");
TimeInit();
void lazy_initialize_conv(void)
{
if (!initialized) {
- load_case_tables();
+ load_case_tables_library();
init_iconv();
initialized = true;
}
frame = talloc_stackframe();
/* Case tables must be loaded before any string comparisons occour */
- load_case_tables();
+ load_case_tables_library();
/* When libnetapi is invoked from an application, it does not
* want to be swamped with level 10 debug messages, even if
char *home = NULL;
TALLOC_CTX *frame = talloc_stackframe();
- load_case_tables();
+ load_case_tables_library();
setup_logging("libsmbclient", DEBUG_STDOUT);
void (*oldsig_handler)(int);
/* Samba initialization. */
- load_case_tables();
+ load_case_tables_library();
lp_set_in_client(True);
ctrl = set_ctrl(pamh, flags, argc, argv );
char *p = NULL;
/* Samba initialization. */
- load_case_tables();
+ load_case_tables_library();
lp_set_in_client(True);
ctrl = set_ctrl(pamh, flags, argc, argv);
char *pass_new;
/* Samba initialization. */
- load_case_tables();
+ load_case_tables_library();
lp_set_in_client(True);
ctrl = set_ctrl(pamh, flags, argc, argv);