svn commit: samba r18845 - in branches/SAMBA_3_0/source/rpc_parse: .

vlendec at samba.org vlendec at samba.org
Sat Sep 23 17:59:53 GMT 2006


Author: vlendec
Date: 2006-09-23 17:59:52 +0000 (Sat, 23 Sep 2006)
New Revision: 18845

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

Log:
Fix a type-punned warning that turned out to be a real bug: The secdesc
revision is now an enum that might be represented as anything, in particular
as an int. It's definitely not a uint16 :-)

Volker

Modified:
   branches/SAMBA_3_0/source/rpc_parse/parse_sec.c


Changeset:
Modified: branches/SAMBA_3_0/source/rpc_parse/parse_sec.c
===================================================================
--- branches/SAMBA_3_0/source/rpc_parse/parse_sec.c	2006-09-23 09:13:48 UTC (rev 18844)
+++ branches/SAMBA_3_0/source/rpc_parse/parse_sec.c	2006-09-23 17:59:52 UTC (rev 18845)
@@ -128,6 +128,7 @@
 	uint32 old_offset;
 	uint32 offset_acl_size;
 	SEC_ACL *psa;
+	uint16 revision;
 
 	/*
 	 * Note that the size is always a multiple of 4 bytes due to the
@@ -155,9 +156,17 @@
 	
 	old_offset = prs_offset(ps);
 
-	if(!prs_uint16("revision", ps, depth, (uint16 *)&psa->revision))
+	if (MARSHALLING(ps)) {
+		revision = (uint16)psa->revision;
+	}
+
+	if(!prs_uint16("revision", ps, depth, &revision))
 		return False;
 
+	if (UNMARSHALLING(ps)) {
+		psa->revision = (enum security_acl_revision)revision;
+	}
+
 	if(!prs_uint16_pre("size     ", ps, depth, &psa->size, &offset_acl_size))
 		return False;
 
@@ -212,6 +221,7 @@
 	uint32 max_offset = 0; /* after we're done, move offset to end */
 	uint32 tmp_offset = 0;
 	uint32 off_sacl, off_dacl, off_owner_sid, off_grp_sid;
+	uint16 revision;
 
 	SEC_DESC *psd;
 
@@ -237,9 +247,17 @@
 	/* start of security descriptor stored for back-calc offset purposes */
 	old_offset = prs_offset(ps);
 
-	if(!prs_uint16("revision ", ps, depth, (uint16*)&psd->revision))
+	if (MARSHALLING(ps)) {
+		revision = (uint16)psd->revision;
+	}
+
+	if(!prs_uint16("revision", ps, depth, &revision))
 		return False;
 
+	if (UNMARSHALLING(ps)) {
+		psd->revision = (enum security_acl_revision)revision;
+	}
+
 	if(!prs_uint16("type     ", ps, depth, &psd->type))
 		return False;
 



More information about the samba-cvs mailing list