summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Lendecke <vlendec@samba.org>2006-09-23 17:59:52 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:01:04 -0500
commit35a852150198e057b7e8a6463db16443d9ff2e40 (patch)
tree49db653a9f89d10662958fbb247200dafec1c182
parent61761288e929fad9eabd547c9597140dafbabc54 (diff)
downloadsamba-35a852150198e057b7e8a6463db16443d9ff2e40.tar.gz
samba-35a852150198e057b7e8a6463db16443d9ff2e40.tar.bz2
samba-35a852150198e057b7e8a6463db16443d9ff2e40.zip
r18845: 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 (This used to be commit 7c5d66c97111389b679aadb7b8b6721f07496bda)
-rw-r--r--source3/rpc_parse/parse_sec.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/source3/rpc_parse/parse_sec.c b/source3/rpc_parse/parse_sec.c
index 32a8a8cd32..be789b2ef5 100644
--- a/source3/rpc_parse/parse_sec.c
+++ b/source3/rpc_parse/parse_sec.c
@@ -128,6 +128,7 @@ BOOL sec_io_acl(const char *desc, SEC_ACL **ppsa, prs_struct *ps, int depth)
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 @@ BOOL sec_io_acl(const char *desc, SEC_ACL **ppsa, prs_struct *ps, int depth)
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 @@ BOOL sec_io_desc(const char *desc, SEC_DESC **ppsd, prs_struct *ps, int depth)
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 @@ BOOL sec_io_desc(const char *desc, SEC_DESC **ppsd, prs_struct *ps, int depth)
/* 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;