Changes from APPLIANCE_HEAD:
[samba.git] / source3 / smbd / unix_acls.c
index a564ec9ee5aef90738ac9bf7a399398f820807fc..9ab057f77aa3ed7cc2265e5057ef804fa9059b4a 100644 (file)
@@ -186,6 +186,7 @@ static BOOL unpack_nt_permissions(SMB_STRUCT_STAT *psbuf, uid_t *puser, gid_t *p
    */
 
   if (security_info_sent & OWNER_SECURITY_INFORMATION) {
+       sid_copy(&owner_sid, psd->owner_sid);
     if (!sid_to_uid( &owner_sid, puser, &sid_type))
       DEBUG(3,("unpack_nt_permissions: unable to validate owner sid.\n"));
   }
@@ -196,6 +197,7 @@ static BOOL unpack_nt_permissions(SMB_STRUCT_STAT *psbuf, uid_t *puser, gid_t *p
    */
 
   if (security_info_sent & GROUP_SECURITY_INFORMATION) {
+       sid_copy(&grp_sid, psd->grp_sid);
     if (!sid_to_gid( &grp_sid, pgrp, &sid_type))
       DEBUG(3,("unpack_nt_permissions: unable to validate group sid.\n"));
   }
@@ -352,21 +354,12 @@ size_t get_nt_acl(files_struct *fsp, SEC_DESC **ppdesc)
     sid_copy( &group_sid, &global_sid_World);
   } else {
 
-    /*
-     * If there is a VFS redirect, use it.
-     */
-
-    if ((fsp->is_directory || fsp->fd == -1) && fsp->conn->vfs_ops.get_nt_acl)
-      return fsp->conn->vfs_ops.get_nt_acl(dos_to_unix(fsp->fsp_name, False), ppdesc);
-    else if (fsp->conn->vfs_ops.fget_nt_acl)
-      return fsp->conn->vfs_ops.fget_nt_acl(fsp->fd, ppdesc);
-
     if(fsp->is_directory || fsp->fd == -1) {
       if(vfs_stat(fsp->conn,fsp->fsp_name, &sbuf) != 0) {
         return 0;
       }
     } else {
-      if(fsp->conn->vfs_ops.fstat(fsp->fd,&sbuf) != 0) {
+      if(fsp->conn->vfs_ops.fstat(fsp,fsp->fd,&sbuf) != 0) {
         return 0;
       }
     }
@@ -462,15 +455,6 @@ BOOL set_nt_acl(files_struct *fsp, uint32 security_info_sent, SEC_DESC *psd)
   SMB_STRUCT_STAT sbuf;  
   BOOL got_dacl = False;
 
-  /*
-   * If there is a VFS redirect, use it.
-   */
-
-  if ((fsp->is_directory || fsp->fd == -1) && fsp->conn->vfs_ops.set_nt_acl)
-    return fsp->conn->vfs_ops.set_nt_acl(dos_to_unix(fsp->fsp_name, False), security_info_sent, psd);
-  else if (fsp->conn->vfs_ops.fset_nt_acl)
-    return fsp->conn->vfs_ops.fset_nt_acl(fsp->fd, security_info_sent, psd);
-
   /*
    * Get the current state of the file.
    */
@@ -479,7 +463,7 @@ BOOL set_nt_acl(files_struct *fsp, uint32 security_info_sent, SEC_DESC *psd)
     if(vfs_stat(fsp->conn,fsp->fsp_name, &sbuf) != 0)
       return False;
   } else {
-    if(conn->vfs_ops.fstat(fsp->fd,&sbuf) != 0)
+    if(conn->vfs_ops.fstat(fsp,fsp->fd,&sbuf) != 0)
       return False;
   }
 
@@ -524,7 +508,7 @@ BOOL set_nt_acl(files_struct *fsp, uint32 security_info_sent, SEC_DESC *psd)
       if(fsp->fd == -1)
         ret = vfs_stat(fsp->conn, fsp->fsp_name, &sbuf);
       else
-        ret = conn->vfs_ops.fstat(fsp->fd,&sbuf);
+        ret = conn->vfs_ops.fstat(fsp,fsp->fd,&sbuf);
   
       if(ret != 0)
         return False;
@@ -570,7 +554,7 @@ BOOL set_nt_acl(files_struct *fsp, uint32 security_info_sent, SEC_DESC *psd)
       DEBUG(3,("call_nt_transact_set_security_desc: chmod %s. perms = 0%o.\n",
             fsp->fsp_name, (unsigned int)perms ));
 
-      if(conn->vfs_ops.chmod(dos_to_unix(fsp->fsp_name, False), perms) == -1) {
+      if(conn->vfs_ops.chmod(conn,dos_to_unix(fsp->fsp_name, False), perms) == -1) {
         DEBUG(3,("call_nt_transact_set_security_desc: chmod %s, 0%o failed. Error = %s.\n",
               fsp->fsp_name, (unsigned int)perms, strerror(errno) ));
         return False;