Fix UNISTR2 length bug in LsaQueryInfo(3) that cause SID resolution to fail on local...
authorGerald Carter <jerry@samba.org>
Wed, 10 Dec 2003 21:13:44 +0000 (21:13 +0000)
committerGerald Carter <jerry@samba.org>
Wed, 10 Dec 2003 21:13:44 +0000 (21:13 +0000)
(This used to be commit c6594e35573186966a4d57404f1c06b98670db06)

source3/include/rpc_misc.h
source3/rpc_parse/parse_misc.c
source3/rpc_server/srv_lsa_nt.c

index aaaad55c20c751fbffa4a30d11ff22890dd91af2..29ae21218575feebc2dd6b74c530cdccf2fb8aeb 100644 (file)
@@ -403,5 +403,5 @@ typedef struct buffer4_info
 }
 BUFFER4;
 
-enum unistr2_term_codes { UNI_FLAGS_NONE = 0, UNI_STR_TERMINATE = 1, UNI_MAXLEN_TERMINATE = 2 };
+enum unistr2_term_codes { UNI_FLAGS_NONE = 0, UNI_STR_TERMINATE = 1, UNI_MAXLEN_TERMINATE = 2, UNI_BROKEN_NON_NULL = 3 };
 #endif /* _RPC_MISC_H */
index afdf0fc4c9b43ba55dbb909b2c001bcfe6a84cc0..976ba2068105a0ad1570c9e79ef869d63f20fb9e 100644 (file)
@@ -914,7 +914,7 @@ void init_unistr2(UNISTR2 *str, const char *buf, enum unistr2_term_codes flags)
        str->uni_max_len = num_chars;
        str->offset = 0;
        str->uni_str_len = num_chars;
-       if (num_chars && (flags == UNI_MAXLEN_TERMINATE))
+       if ( num_chars && ((flags == UNI_MAXLEN_TERMINATE) || (flags == UNI_BROKEN_NON_NULL)) )
                str->uni_max_len++;
 }
 
index e545d8c2673ac5ec8db4da3f5c54d4faa4d2fc77..2b2cb91924510db2914ce6afd07fb85e2e1e864a 100644 (file)
@@ -66,7 +66,7 @@ static void init_dom_query(DOM_QUERY *d_q, const char *dom_name, DOM_SID *dom_si
 
        /* this string is supposed to be non-null terminated. */
        /* But the maxlen in this UNISTR2 must include the terminating null. */
-       init_unistr2(&d_q->uni_domain_name, dom_name, UNI_MAXLEN_TERMINATE);
+       init_unistr2(&d_q->uni_domain_name, dom_name, UNI_BROKEN_NON_NULL);
 
        /*
         * I'm not sure why this really odd combination of length