summaryrefslogtreecommitdiff
path: root/source3/rpc_parse
diff options
context:
space:
mode:
Diffstat (limited to 'source3/rpc_parse')
-rw-r--r--source3/rpc_parse/parse_misc.c6
-rw-r--r--source3/rpc_parse/parse_samr.c16
2 files changed, 16 insertions, 6 deletions
diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c
index 203122e73c..afdf0fc4c9 100644
--- a/source3/rpc_parse/parse_misc.c
+++ b/source3/rpc_parse/parse_misc.c
@@ -1015,7 +1015,11 @@ void init_unistr2_from_datablob(UNISTR2 *str, DATA_BLOB *blob)
str->uni_str_len = blob->length / sizeof(uint16);
str->uni_max_len = str->uni_str_len;
str->offset = 0;
- str->buffer = (uint16 *) memdup(blob->data, blob->length);
+ if (blob->length) {
+ str->buffer = (uint16 *) memdup(blob->data, blob->length);
+ } else {
+ str->buffer = NULL;
+ }
if ((str->buffer == NULL) && (blob->length > 0)) {
smb_panic("init_unistr2_from_datablob: malloc fail\n");
}
diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c
index 73107f8f61..20adf0c756 100644
--- a/source3/rpc_parse/parse_samr.c
+++ b/source3/rpc_parse/parse_samr.c
@@ -5938,7 +5938,7 @@ NTSTATUS init_sam_user_info21A(SAM_USER_INFO_21 *usr, SAM_ACCOUNT *pw, DOM_SID *
const char* description = pdb_get_acct_desc(pw);
const char* workstations = pdb_get_workstations(pw);
const char* munged_dial = pdb_get_munged_dial(pw);
- DATA_BLOB blob = base64_decode_data_blob(munged_dial);
+ DATA_BLOB munged_dial_blob;
uint32 user_rid;
const DOM_SID *user_sid;
@@ -5946,6 +5946,12 @@ NTSTATUS init_sam_user_info21A(SAM_USER_INFO_21 *usr, SAM_ACCOUNT *pw, DOM_SID *
uint32 group_rid;
const DOM_SID *group_sid;
+ if (munged_dial) {
+ munged_dial_blob = base64_decode_data_blob(munged_dial);
+ } else {
+ munged_dial_blob = data_blob(NULL, 0);
+ }
+
/* Create NTTIME structs */
unix_to_nt_time (&logon_time, pdb_get_logon_time(pw));
unix_to_nt_time (&logoff_time, pdb_get_logoff_time(pw));
@@ -5975,7 +5981,7 @@ NTSTATUS init_sam_user_info21A(SAM_USER_INFO_21 *usr, SAM_ACCOUNT *pw, DOM_SID *
user_name,
sid_to_string(user_sid_string, user_sid),
sid_to_string(domain_sid_string, domain_sid)));
- data_blob_free(&blob);
+ data_blob_free(&munged_dial_blob);
return NT_STATUS_UNSUCCESSFUL;
}
@@ -5989,7 +5995,7 @@ NTSTATUS init_sam_user_info21A(SAM_USER_INFO_21 *usr, SAM_ACCOUNT *pw, DOM_SID *
user_name,
sid_to_string(group_sid_string, group_sid),
sid_to_string(domain_sid_string, domain_sid)));
- data_blob_free(&blob);
+ data_blob_free(&munged_dial_blob);
return NT_STATUS_UNSUCCESSFUL;
}
@@ -6049,9 +6055,9 @@ NTSTATUS init_sam_user_info21A(SAM_USER_INFO_21 *usr, SAM_ACCOUNT *pw, DOM_SID *
init_unistr2(&usr->uni_unknown_str, NULL, UNI_STR_TERMINATE);
init_uni_hdr(&usr->hdr_unknown_str, &usr->uni_unknown_str);
- init_unistr2_from_datablob(&usr->uni_munged_dial, &blob);
+ init_unistr2_from_datablob(&usr->uni_munged_dial, &munged_dial_blob);
init_uni_hdr(&usr->hdr_munged_dial, &usr->uni_munged_dial);
- data_blob_free(&blob);
+ data_blob_free(&munged_dial_blob);
usr->unknown_6 = pdb_get_unknown_6(pw);
usr->padding4 = 0;