s3-vfs: Use the system. namespace for fake ACLs
[kai/samba.git] / source3 / modules / vfs_hpuxacl.c
index 0f5af9d318d23400269158f2b7bbf551790bb758..f8661b1134ca00c441752a46371e0d224f78d320 100644 (file)
@@ -191,14 +191,6 @@ SMB_ACL_T hpuxacl_sys_acl_get_fd(vfs_handle_struct *handle,
         /* 
         * HPUX doesn't have the facl call. Fake it using the path.... JRA. 
         */
-       /* For all I see, the info should already be in the fsp
-        * parameter, but get it again to be safe --- necessary? */
-        files_struct *file_struct_p = file_find_fd(fsp->conn->sconn,
-                                                  fsp->fh->fd);
-        if (file_struct_p == NULL) {
-                errno = EBADF;
-                return NULL;
-        }
         /*
          * We know we're in the same conn context. So we
          * can use the relative path.
@@ -207,7 +199,7 @@ SMB_ACL_T hpuxacl_sys_acl_get_fd(vfs_handle_struct *handle,
                "hpuxacl_sys_acl_get_file (no facl syscall on HPUX).\n"));
 
         return hpuxacl_sys_acl_get_file(handle,
-                                       file_struct_p->fsp_name->base_name,
+                                       fsp->fsp_name->base_name,
                                        SMB_ACL_TYPE_ACCESS);
 }
 
@@ -331,14 +323,6 @@ int hpuxacl_sys_acl_set_fd(vfs_handle_struct *handle,
         /*
          * HPUX doesn't have the facl call. Fake it using the path.... JRA.
          */
-       /* For all I see, the info should already be in the fsp
-        * parameter, but get it again to be safe --- necessary? */
-        files_struct *file_struct_p = file_find_fd(fsp->conn->sconn,
-                                                  fsp->fh->fd);
-        if (file_struct_p == NULL) {
-                errno = EBADF;
-                return -1;
-        }
         /*
          * We know we're in the same conn context. So we
          * can use the relative path.
@@ -347,7 +331,7 @@ int hpuxacl_sys_acl_set_fd(vfs_handle_struct *handle,
                "hpuxacl_sys_acl_set_file (no facl syscall on HPUX)\n"));
 
         return hpuxacl_sys_acl_set_file(handle,
-                                       file_struct_p->fsp_name->base_name,
+                                       fsp->fsp_name->base_name,
                                        SMB_ACL_TYPE_ACCESS, theacl);
 }
 
@@ -402,7 +386,7 @@ int hpuxacl_sys_acl_delete_def_file(vfs_handle_struct *handle,
  done:
        DEBUG(10, ("hpuxacl_sys_acl_delete_def_file %s.\n",
                   ((ret != 0) ? "failed" : "succeeded" )));
-       SAFE_FREE(smb_acl);
+       TALLOC_FREE(smb_acl);
        return ret;
 }
 
@@ -522,11 +506,8 @@ static SMB_ACL_T hpux_acl_to_smb_acl(HPUX_ACL_T hpux_acl, int count,
                if (!_IS_OF_TYPE(hpux_acl[i], type)) {
                        continue;
                }
-               result = SMB_REALLOC(result, 
-                                    sizeof(struct smb_acl_t) +
-                                    (sizeof(struct smb_acl_entry) *
-                                     (result->count + 1)));
-               if (result == NULL) {
+               result->acl = talloc_realloc(result, result->acl, struct smb_acl_entry, result->count + 1);
+               if (result->acl == NULL) {
                        DEBUG(10, ("error reallocating memory for SMB_ACL\n"));
                        goto fail;
                }
@@ -550,7 +531,7 @@ static SMB_ACL_T hpux_acl_to_smb_acl(HPUX_ACL_T hpux_acl, int count,
        }
        goto done;
  fail:
-       SAFE_FREE(result);
+       TALLOC_FREE(result);
  done:
        DEBUG(10, ("hpux_acl_to_smb_acl %s\n",
                   ((result == NULL) ? "failed" : "succeeded")));
@@ -1170,11 +1151,11 @@ static bool hpux_acl_check(HPUX_ACL_T hpux_acl, int count)
 /* VFS operations structure */
 
 static struct vfs_fn_pointers hpuxacl_fns = {
-       .sys_acl_get_file = hpuxacl_sys_acl_get_file,
-       .sys_acl_get_fd = hpuxacl_sys_acl_get_fd,
-       .sys_acl_set_file = hpuxacl_sys_acl_set_file,
-       .sys_acl_set_fd = hpuxacl_sys_acl_set_fd,
-       .sys_acl_delete_def_file = hpuxacl_sys_acl_delete_def_file,
+       .sys_acl_get_file_fn = hpuxacl_sys_acl_get_file,
+       .sys_acl_get_fd_fn = hpuxacl_sys_acl_get_fd,
+       .sys_acl_set_file_fn = hpuxacl_sys_acl_set_file,
+       .sys_acl_set_fd_fn = hpuxacl_sys_acl_set_fd,
+       .sys_acl_delete_def_file_fn = hpuxacl_sys_acl_delete_def_file,
 };
 
 NTSTATUS vfs_hpuxacl_init(void)