Remove use of global_loadparm when comparing nt status error - use
authorJelmer Vernooij <jelmer@samba.org>
Sun, 2 Nov 2008 16:11:20 +0000 (17:11 +0100)
committerJelmer Vernooij <jelmer@samba.org>
Sun, 2 Nov 2008 16:11:20 +0000 (17:11 +0100)
global variable instead.

libcli/util/ntstatus.h
source4/libcli/util/errormap.c
source4/param/loadparm.c

index bf03d51d02221185be09330439445bf115d33352..fa4553df1e0b173540aa671bad346208b5aaa52d 100644 (file)
@@ -628,6 +628,9 @@ const char *get_nt_error_c_code(NTSTATUS nt_code);
  *****************************************************************************/
 NTSTATUS nt_status_string_to_code(const char *nt_status_str);
 
+/** Used by ntstatus_dos_equal: */
+extern bool ntstatus_check_dos_mapping;
+
 #define NT_STATUS_IS_OK(x) (NT_STATUS_V(x) == 0)
 #define NT_STATUS_IS_ERR(x) ((NT_STATUS_V(x) & 0xc0000000) == 0xc0000000)
 /* checking for DOS error mapping here is ugly, but unfortunately the
index 4260c0dd7dfee3eb31b3e02c69ab0db3b0787d24..5c0d0af8d80645c5055fb434d5259d01fb82069a 100644 (file)
@@ -1160,6 +1160,8 @@ static const struct {
        {NT_STATUS_OK, WERR_OK}
 };
 
+bool ntstatus_check_dos_mapping = true;
+
 /*
   check if a DOS encoded NTSTATUS code maps to the given NTSTATUS code
 */
@@ -1169,7 +1171,7 @@ bool ntstatus_dos_equal(NTSTATUS status1, NTSTATUS status2)
           the mapping of dos codes, as we want to catch the cases where
           a forced dos code is needed
        */
-       if (lp_nt_status_support(global_loadparm)) {
+       if (ntstatus_check_dos_mapping) {
                return NT_STATUS_V(status1) == NT_STATUS_V(status2);
        }
 
index 201013609eb5cf2a8e2cb4f2d8e76ecce7e3321f..b79be28ac059abae1f2d2542d91778817c71d6c0 100644 (file)
@@ -2480,6 +2480,8 @@ bool lp_load(struct loadparm_context *lp_ctx, const char *filename)
 
        reload_charcnv(lp_ctx);
 
+       ntstatus_check_dos_mapping = lp_nt_status_support(lp_ctx);
+
        /* FIXME: Check locale in environment for this: */
        if (strcmp(lp_display_charset(lp_ctx), lp_unix_charset(lp_ctx)) != 0)
                d_set_iconv(smb_iconv_open(lp_display_charset(lp_ctx), lp_unix_charset(lp_ctx)));