diff options
-rw-r--r-- | source3/include/authdata.h | 2 | ||||
-rw-r--r-- | source3/libads/authdata.c | 14 |
2 files changed, 8 insertions, 8 deletions
diff --git a/source3/include/authdata.h b/source3/include/authdata.h index 194429ab67..dbaeda6b9a 100644 --- a/source3/include/authdata.h +++ b/source3/include/authdata.h @@ -42,7 +42,7 @@ typedef struct pac_logon_name { NTTIME logon_time; uint16 len; - uint16 *username; /* might not be null terminated, so not UNISTR */ + uint8 *username; /* Actually always little-endian. might not be null terminated, so not UNISTR */ } PAC_LOGON_NAME; typedef struct pac_signature_data { diff --git a/source3/libads/authdata.c b/source3/libads/authdata.c index 55e736ce6a..c3c160dafb 100644 --- a/source3/libads/authdata.c +++ b/source3/libads/authdata.c @@ -42,24 +42,24 @@ static BOOL pac_io_logon_name(const char *desc, PAC_LOGON_NAME *logon_name, if (!prs_uint16("len", ps, depth, &logon_name->len)) return False; + /* The following string is always in little endian 16 bit values, + copy as 8 bits to avoid endian reversal on big-endian machines. + len is the length in bytes. */ + if (UNMARSHALLING(ps) && logon_name->len) { - logon_name->username = PRS_ALLOC_MEM(ps, uint16, logon_name->len); + logon_name->username = PRS_ALLOC_MEM(ps, uint8, logon_name->len); if (!logon_name->username) { DEBUG(3, ("No memory available\n")); return False; } } - if (!prs_uint16s(True, "name", ps, depth, logon_name->username, - (logon_name->len / sizeof(uint16)))) + if (!prs_uint8s(True, "name", ps, depth, logon_name->username, logon_name->len)) return False; return True; - } - - #if 0 /* Unused (handled now in net_io_user_info3()) - Guenther */ static BOOL pac_io_krb_sids(const char *desc, KRB_SID_AND_ATTRS *sid_and_attr, prs_struct *ps, int depth) @@ -891,7 +891,7 @@ static void dump_pac_logon_info(PAC_LOGON_INFO *logon_info) { nt_status = NT_STATUS_INVALID_PARAMETER; goto out; } - rpcstr_pull(username, logon_name->username, sizeof(username), -1, STR_TERMINATE); + rpcstr_pull(username, logon_name->username, sizeof(username), logon_name->len, 0); ret = smb_krb5_parse_name_norealm(context, username, &client_principal_pac); if (ret) { |