summaryrefslogtreecommitdiff
path: root/source3/rpc_parse
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2003-11-17 22:07:23 +0000
committerJeremy Allison <jra@samba.org>2003-11-17 22:07:23 +0000
commitc86a6b04c8fc279548f3a2a8fe638450c72e15c5 (patch)
tree906355ef561c4f1d9c7ebe26bbe811794a5a88f2 /source3/rpc_parse
parentbfbc3486045f819a3e7ac9c7460a8793d5a1f0e5 (diff)
downloadsamba-c86a6b04c8fc279548f3a2a8fe638450c72e15c5.tar.gz
samba-c86a6b04c8fc279548f3a2a8fe638450c72e15c5.tar.bz2
samba-c86a6b04c8fc279548f3a2a8fe638450c72e15c5.zip
Fix from Andrew Bartlett to fix up the munged-dial problem.
Jeremy. (This used to be commit 5df3d16c9226bf884226e8302b996a484017f8c3)
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 cd59d390aa..7cd3c795e6 100644
--- a/source3/rpc_parse/parse_misc.c
+++ b/source3/rpc_parse/parse_misc.c
@@ -1043,7 +1043,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;