s3: vfs: vfs_solarisacl. refuse_symlink() means we can always use STAT here.
authorJeremy Allison <jra@samba.org>
Sat, 12 Mar 2016 00:01:31 +0000 (16:01 -0800)
committerUri Simchoni <uri@samba.org>
Tue, 15 Mar 2016 07:29:30 +0000 (08:29 +0100)
For a posix acl call on a symlink, we've already refused it.
For a Windows acl mapped call on a symlink, we want to follow
it.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
source3/modules/vfs_solarisacl.c

index cf25abc5b2e09d89b20d5652b0392fa9dad6329d..b421016f445c42593df162dca3d9cc29db1a5259 100644 (file)
@@ -139,10 +139,12 @@ int solarisacl_sys_acl_set_file(vfs_handle_struct *handle,
                                SMB_ACL_T theacl)
 {
        int ret = -1;
-       struct stat_ex s;
        SOLARIS_ACL_T solaris_acl = NULL;
        int count;
-       
+       struct smb_filename smb_fname = {
+               .base_name = discard_const_p(char, name)
+       };
+
        DEBUG(10, ("solarisacl_sys_acl_set_file called for file '%s'\n",
                   name));
 
@@ -166,12 +168,18 @@ int solarisacl_sys_acl_set_file(vfs_handle_struct *handle,
         * the default acl as provided, we have to get the acl part 
         * that has not been specified in "type" from the file first 
         * and concatenate it with the acl provided.
+        *
+        * We can directly use SMB_VFS_STAT here, as if this was a
+        * POSIX call on a symlink, we've already refused it.
+        * For a Windows acl mapped call on a symlink, we want to follow
+        * it.
         */
-       if (vfs_stat_smb_basename(handle->conn, name, &s) != 0) {
+       ret = SMB_VFS_STAT(conn, &smb_fname);
+       if (ret != 0) {
                DEBUG(10, ("Error in stat call: %s\n", strerror(errno)));
                goto done;
        }
-       if (S_ISDIR(s.st_ex_mode)) {
+       if (S_ISDIR(smb_fname.st.st_ex_mode)) {
                SOLARIS_ACL_T other_acl = NULL;
                int other_count;
                SMB_ACL_TYPE_T other_type;