summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2012-09-07 15:49:47 +1000
committerAndrew Bartlett <abartlet@samba.org>2012-09-12 05:26:16 +0200
commitac804f0d7f5a93ff2710e213d9213ad9960a15d6 (patch)
tree938a8c734adc57e168459001135e3cfdf1302af5 /source3
parentbd2f1604d73f05f3b2f151a81f09824c7bb99ab5 (diff)
downloadsamba-ac804f0d7f5a93ff2710e213d9213ad9960a15d6.tar.gz
samba-ac804f0d7f5a93ff2710e213d9213ad9960a15d6.tar.bz2
samba-ac804f0d7f5a93ff2710e213d9213ad9960a15d6.zip
smbd-posix_acls: Use a IDL union to store the ACL entry
This is a clearer, long-term-stable structure we can hash without risking it changing. Andrew Bartlett
Diffstat (limited to 'source3')
-rw-r--r--source3/lib/sysacls.c16
-rw-r--r--source3/modules/vfs_posixacl.c8
2 files changed, 11 insertions, 13 deletions
diff --git a/source3/lib/sysacls.c b/source3/lib/sysacls.c
index 31966c6077..1b6eb9a35c 100644
--- a/source3/lib/sysacls.c
+++ b/source3/lib/sysacls.c
@@ -107,11 +107,11 @@ int sys_acl_get_permset(SMB_ACL_ENTRY_T entry_d, SMB_ACL_PERMSET_T *permset_p)
void *sys_acl_get_qualifier(SMB_ACL_ENTRY_T entry_d)
{
if (entry_d->a_type == SMB_ACL_USER) {
- return &entry_d->uid;
+ return &entry_d->info.user.uid;
}
if (entry_d->a_type == SMB_ACL_GROUP) {
- return &entry_d->gid;
+ return &entry_d->info.group.gid;
}
errno = EINVAL;
@@ -189,15 +189,15 @@ char *sys_acl_to_text(const struct smb_acl_t *acl_d, ssize_t *len_p)
break;
case SMB_ACL_USER:
- id = uidtoname(ap->uid);
+ id = uidtoname(ap->info.user.uid);
case SMB_ACL_USER_OBJ:
tag = "user";
break;
case SMB_ACL_GROUP:
- if ((gr = getgrgid(ap->gid)) == NULL) {
+ if ((gr = getgrgid(ap->info.group.gid)) == NULL) {
slprintf(idbuf, sizeof(idbuf)-1, "%ld",
- (long)ap->gid);
+ (long)ap->info.group.gid);
id = idbuf;
} else {
id = gr->gr_name;
@@ -294,8 +294,6 @@ int sys_acl_create_entry(SMB_ACL_T *acl_p, SMB_ACL_ENTRY_T *entry_p)
entry_d = &acl_d->acl[acl_d->count++];
entry_d->a_type = SMB_ACL_TAG_INVALID;
- entry_d->uid = -1;
- entry_d->gid = -1;
entry_d->a_perm = 0;
*entry_p = entry_d;
@@ -324,11 +322,11 @@ int sys_acl_set_tag_type(SMB_ACL_ENTRY_T entry_d, SMB_ACL_TAG_T tag_type)
int sys_acl_set_qualifier(SMB_ACL_ENTRY_T entry_d, void *qual_p)
{
if (entry_d->a_type == SMB_ACL_USER) {
- entry_d->uid = *((uid_t *)qual_p);
+ entry_d->info.user.uid = *((uid_t *)qual_p);
return 0;
}
if (entry_d->a_type == SMB_ACL_GROUP) {
- entry_d->gid = *((gid_t *)qual_p);
+ entry_d->info.group.gid = *((gid_t *)qual_p);
return 0;
}
diff --git a/source3/modules/vfs_posixacl.c b/source3/modules/vfs_posixacl.c
index 407a3a1724..c9f8bd5f2d 100644
--- a/source3/modules/vfs_posixacl.c
+++ b/source3/modules/vfs_posixacl.c
@@ -177,7 +177,7 @@ static bool smb_ace_to_internal(acl_entry_t posix_ace,
DEBUG(0, ("smb_acl_get_qualifier failed\n"));
return False;
}
- ace->uid = *puid;
+ ace->info.user.uid = *puid;
acl_free(puid);
break;
}
@@ -188,7 +188,7 @@ static bool smb_ace_to_internal(acl_entry_t posix_ace,
DEBUG(0, ("smb_acl_get_qualifier failed\n"));
return False;
}
- ace->gid = *pgid;
+ ace->info.group.gid = *pgid;
acl_free(pgid);
break;
}
@@ -323,14 +323,14 @@ static acl_t smb_acl_to_posix(const struct smb_acl_t *acl)
switch (entry->a_type) {
case SMB_ACL_USER:
- if (acl_set_qualifier(e, &entry->uid) != 0) {
+ if (acl_set_qualifier(e, &entry->info.user.uid) != 0) {
DEBUG(1, ("acl_set_qualifiier failed: %s\n",
strerror(errno)));
goto fail;
}
break;
case SMB_ACL_GROUP:
- if (acl_set_qualifier(e, &entry->gid) != 0) {
+ if (acl_set_qualifier(e, &entry->info.group.gid) != 0) {
DEBUG(1, ("acl_set_qualifiier failed: %s\n",
strerror(errno)));
goto fail;