diff options
author | Jeremy Allison <jra@samba.org> | 2006-02-21 03:29:02 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 11:10:16 -0500 |
commit | a57f37420b2b41b1905e2eefa385036b9ddb5bcf (patch) | |
tree | 3d357d11a3bf190cb037d909256a18a222fd9e6d | |
parent | 115996503ced64c478ed1cc857bd5a1528644b46 (diff) | |
download | samba-a57f37420b2b41b1905e2eefa385036b9ddb5bcf.tar.gz samba-a57f37420b2b41b1905e2eefa385036b9ddb5bcf.tar.bz2 samba-a57f37420b2b41b1905e2eefa385036b9ddb5bcf.zip |
r13588: Second attempt to fix Bug #3330 - treat the string as a
uint8 array and copy as such. Gunther please check (sorry
I reverted your earlier fix).
Jeremy.
(This used to be commit 7a17b39c80703909f102487690d2117d874b0e15)
-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) { |