s3: Convert some callers of vfs_stat_smb_fname to SMB_VFS_STAT()
[samba.git] / source3 / smbd / posix_acls.c
index fb2cda40ce0019e68aa2103df802ececf47aa426..0a3b0dff7597a22d9da813465e9113262881252a 100644 (file)
@@ -3372,33 +3372,45 @@ NTSTATUS posix_fget_nt_acl(struct files_struct *fsp, uint32_t security_info,
 NTSTATUS posix_get_nt_acl(struct connection_struct *conn, const char *name,
                          uint32_t security_info, SEC_DESC **ppdesc)
 {
-       SMB_STRUCT_STAT sbuf;
        SMB_ACL_T posix_acl = NULL;
        SMB_ACL_T def_acl = NULL;
        struct pai_val *pal;
+       struct smb_filename *smb_fname = NULL;
+       NTSTATUS status;
 
        *ppdesc = NULL;
 
        DEBUG(10,("posix_get_nt_acl: called for file %s\n", name ));
 
+       status = create_synthetic_smb_fname(talloc_tos(), name, NULL, NULL,
+                                           &smb_fname);
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
        /* Get the stat struct for the owner info. */
-       if(vfs_stat_smb_fname(conn, name, &sbuf) != 0) {
-               return map_nt_error_from_unix(errno);
+       if(SMB_VFS_STAT(conn, smb_fname) != 0) {
+               status = map_nt_error_from_unix(errno);
+               goto out;
        }
 
        /* Get the ACL from the path. */
        posix_acl = SMB_VFS_SYS_ACL_GET_FILE(conn, name, SMB_ACL_TYPE_ACCESS);
 
        /* If it's a directory get the default POSIX ACL. */
-       if(S_ISDIR(sbuf.st_ex_mode)) {
+       if(S_ISDIR(smb_fname->st.st_ex_mode)) {
                def_acl = SMB_VFS_SYS_ACL_GET_FILE(conn, name, SMB_ACL_TYPE_DEFAULT);
                def_acl = free_empty_sys_acl(conn, def_acl);
        }
 
        pal = load_inherited_info(conn, name);
 
-       return posix_get_nt_acl_common(conn, name, &sbuf, pal, posix_acl,
-                                      def_acl, security_info, ppdesc);
+       status = posix_get_nt_acl_common(conn, name, &smb_fname->st, pal,
+                                        posix_acl, def_acl, security_info,
+                                        ppdesc);
+ out:
+       TALLOC_FREE(smb_fname);
+       return status;
 }
 
 /****************************************************************************