svn commit: samba r13636 - in branches/SAMBA_3_0_RELEASE/source: include libads

jerry at samba.org jerry at samba.org
Wed Feb 22 15:59:15 GMT 2006


Author: jerry
Date: 2006-02-22 15:59:14 +0000 (Wed, 22 Feb 2006)
New Revision: 13636

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=13636

Log:
Merge the usernamd parsing fix for the Krb5 PAC

svn merge -r13579:13588 $SVNURL/branches/SAMBA_3_0


Modified:
   branches/SAMBA_3_0_RELEASE/source/include/authdata.h
   branches/SAMBA_3_0_RELEASE/source/libads/authdata.c


Changeset:
Modified: branches/SAMBA_3_0_RELEASE/source/include/authdata.h
===================================================================
--- branches/SAMBA_3_0_RELEASE/source/include/authdata.h	2006-02-22 15:08:05 UTC (rev 13635)
+++ branches/SAMBA_3_0_RELEASE/source/include/authdata.h	2006-02-22 15:59:14 UTC (rev 13636)
@@ -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 {

Modified: branches/SAMBA_3_0_RELEASE/source/libads/authdata.c
===================================================================
--- branches/SAMBA_3_0_RELEASE/source/libads/authdata.c	2006-02-22 15:08:05 UTC (rev 13635)
+++ branches/SAMBA_3_0_RELEASE/source/libads/authdata.c	2006-02-22 15:59:14 UTC (rev 13636)
@@ -42,24 +42,24 @@
 	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 @@
 		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) {



More information about the samba-cvs mailing list