svn commit: samba r13588 - in branches/SAMBA_3_0/source: include libads

jra at samba.org jra at samba.org
Tue Feb 21 03:29:04 GMT 2006


Author: jra
Date: 2006-02-21 03:29:02 +0000 (Tue, 21 Feb 2006)
New Revision: 13588

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

Log:
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.

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


Changeset:
Modified: branches/SAMBA_3_0/source/include/authdata.h
===================================================================
--- branches/SAMBA_3_0/source/include/authdata.h	2006-02-21 03:28:55 UTC (rev 13587)
+++ branches/SAMBA_3_0/source/include/authdata.h	2006-02-21 03:29:02 UTC (rev 13588)
@@ -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/source/libads/authdata.c
===================================================================
--- branches/SAMBA_3_0/source/libads/authdata.c	2006-02-21 03:28:55 UTC (rev 13587)
+++ branches/SAMBA_3_0/source/libads/authdata.c	2006-02-21 03:29:02 UTC (rev 13588)
@@ -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