summaryrefslogtreecommitdiff
path: root/usr/src/lib/libsmbfs/smb/acl_api.c
diff options
context:
space:
mode:
authorGordon Ross <Gordon.Ross@Sun.COM>2010-01-19 20:50:08 -0500
committerGordon Ross <Gordon.Ross@Sun.COM>2010-01-19 20:50:08 -0500
commitbd7c6f51f14365fc31d408903b38c02177384d3d (patch)
tree99b966dabc161d75968995faf17ff7775e6174aa /usr/src/lib/libsmbfs/smb/acl_api.c
parent791dfaa708ef5838f55bf4e97e7c960beb186419 (diff)
downloadillumos-joyent-bd7c6f51f14365fc31d408903b38c02177384d3d.tar.gz
6706181 Make smbfs present real ACLs for ls -V, libsec
Diffstat (limited to 'usr/src/lib/libsmbfs/smb/acl_api.c')
-rw-r--r--usr/src/lib/libsmbfs/smb/acl_api.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/usr/src/lib/libsmbfs/smb/acl_api.c b/usr/src/lib/libsmbfs/smb/acl_api.c
index b5b6123063..052539316b 100644
--- a/usr/src/lib/libsmbfs/smb/acl_api.c
+++ b/usr/src/lib/libsmbfs/smb/acl_api.c
@@ -20,7 +20,7 @@
*/
/*
- * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -274,10 +274,14 @@ out:
int
smbfs_acl_set(int fd, acl_t *acl, uid_t uid, gid_t gid)
{
+ struct stat st;
i_ntsd_t *sd = NULL;
uint32_t selector;
int error;
+ if (acl && acl->acl_type != ACE_T)
+ return (EINVAL);
+
/*
* Which parts of the SD are being modified?
* XXX: Ditto comments above re. SACL.
@@ -292,14 +296,25 @@ smbfs_acl_set(int fd, acl_t *acl, uid_t uid, gid_t gid)
if (selector == 0)
return (0);
- if (acl && acl->acl_type != ACE_T)
- return (EINVAL);
+ if (uid == (uid_t)-1 || gid == (gid_t)-1) {
+ /*
+ * If not setting owner or group, we need the
+ * current owner and group for translating
+ * references via owner@ or group@ ACEs.
+ */
+ if (fstat(fd, &st) != 0)
+ return (errno);
+ if (uid == (uid_t)-1)
+ uid = st.st_uid;
+ if (gid == (gid_t)-1)
+ gid = st.st_gid;
+ }
/*
* Convert the ZFS ACL to an internal SD.
* Returns allocated data in sd
*/
- error = smbfs_acl_zfs2sd(acl, uid, gid, &sd);
+ error = smbfs_acl_zfs2sd(acl, uid, gid, selector, &sd);
if (error == 0)
error = smbfs_acl_setsd(fd, selector, sd);