#define AIXACL2_MODULE_NAME "aixacl2"
-extern struct current_user current_user;
extern int try_chown(connection_struct *conn, const char *fname, uid_t uid, gid_t gid);
-extern BOOL unpack_nt_owners(int snum, uid_t *puser, gid_t *pgrp,
- uint32 security_info_sent, SEC_DESC *psd);
extern SMB_ACL_T aixacl_to_smbacl( struct acl *file_acl);
extern struct acl *aixacl_smb_to_aixacl(SMB_ACL_TYPE_T acltype, SMB_ACL_T theacl);
uint64_t ctl_flag=0;
TALLOC_CTX *mem_ctx;
- mem_ctx = main_loop_talloc_get();
+ mem_ctx = talloc_tos();
acl = (AIXJFS2_ACL_T *)TALLOC_SIZE(mem_ctx, len);
if (acl == NULL) {
errno = ENOMEM;
return acl;
}
-static BOOL aixjfs2_get_nfs4_acl(files_struct *fsp,
- SMB4ACL_T **ppacl, BOOL *pretryPosix)
+static bool aixjfs2_get_nfs4_acl(const char *name,
+ SMB4ACL_T **ppacl, bool *pretryPosix)
{
int32_t i;
nfs4_ace_int_t *jfs2_ace = NULL;
acl_type_t type;
- DEBUG(10,("jfs2 get_nt_acl invoked for %s\n", fsp->fsp_name));
+ DEBUG(10,("jfs2 get_nt_acl invoked for %s\n", name));
memset(&type, 0, sizeof(acl_type_t));
type.u64 = ACL_NFS4;
- pacl = aixjfs2_getacl_alloc(fsp->fsp_name, &type);
+ pacl = aixjfs2_getacl_alloc(name, &type);
if (pacl == NULL) {
DEBUG(9, ("aixjfs2_getacl_alloc failed for %s with %s\n",
- fsp->fsp_name, strerror(errno)));
+ name, strerror(errno)));
if (errno==ENOSYS)
*pretryPosix = True;
return False;
return True;
}
-static size_t aixjfs2_get_nt_acl_common(files_struct *fsp,
- uint32 security_info, SEC_DESC **ppdesc)
+static NTSTATUS aixjfs2_fget_nt_acl(vfs_handle_struct *handle,
+ files_struct *fsp, uint32 security_info,
+ SEC_DESC **ppdesc)
{
SMB4ACL_T *pacl = NULL;
- BOOL result;
- BOOL retryPosix = False;
+ bool result;
+ bool retryPosix = False;
*ppdesc = NULL;
- result = aixjfs2_get_nfs4_acl(fsp, &pacl, &retryPosix);
+ result = aixjfs2_get_nfs4_acl(fsp->fsp_name, &pacl, &retryPosix);
if (retryPosix)
{
DEBUG(10, ("retrying with posix acl...\n"));
- return get_nt_acl(fsp, security_info, ppdesc);
+ return posix_fget_nt_acl(fsp, security_info, ppdesc);
}
if (result==False)
- return 0;
-
- return smb_get_nt_acl_nfs4(fsp, security_info, ppdesc, pacl);
-}
+ return NT_STATUS_ACCESS_DENIED;
-size_t aixjfs2_fget_nt_acl(vfs_handle_struct *handle,
- files_struct *fsp, int fd, uint32 security_info,
- SEC_DESC **ppdesc)
-{
- return aixjfs2_get_nt_acl_common(fsp, security_info, ppdesc);
+ return smb_fget_nt_acl_nfs4(fsp, security_info, ppdesc, pacl);
}
-size_t aixjfs2_get_nt_acl(vfs_handle_struct *handle,
- files_struct *fsp, const char *name,
+static NTSTATUS aixjfs2_get_nt_acl(vfs_handle_struct *handle,
+ const char *name,
uint32 security_info, SEC_DESC **ppdesc)
{
- return aixjfs2_get_nt_acl_common(fsp, security_info, ppdesc);
+ SMB4ACL_T *pacl = NULL;
+ bool result;
+ bool retryPosix = False;
+
+ *ppdesc = NULL;
+ result = aixjfs2_get_nfs4_acl(name, &pacl, &retryPosix);
+ if (retryPosix)
+ {
+ DEBUG(10, ("retrying with posix acl...\n"));
+ return posix_get_nt_acl(handle->conn, name, security_info,
+ ppdesc);
+ }
+ if (result==False)
+ return NT_STATUS_ACCESS_DENIED;
+
+ return smb_get_nt_acl_nfs4(handle->conn, name, security_info, ppdesc,
+ pacl);
}
static SMB_ACL_T aixjfs2_get_posix_acl(const char *path, acl_type_t type)
}
SMB_ACL_T aixjfs2_sys_acl_get_fd(vfs_handle_struct *handle,
- files_struct *fsp,
- int fd)
+ files_struct *fsp)
{
acl_type_t aixjfs2_type;
aixjfs2_type.u64 = ACL_AIXC;
return 1; /* haven't found that ACL type. */
}
-static BOOL aixjfs2_process_smbacl(files_struct *fsp, SMB4ACL_T *smbacl)
+static bool aixjfs2_process_smbacl(files_struct *fsp, SMB4ACL_T *smbacl)
{
SMB4ACE_T *smbace;
TALLOC_CTX *mem_ctx;
DEBUG(10, ("jfs2_process_smbacl invoked on %s\n", fsp->fsp_name));
/* no need to be freed which is alloced with mem_ctx */
- mem_ctx = main_loop_talloc_get();
+ mem_ctx = talloc_tos();
entryLen = sizeof(nfs4_ace_int_t);
if (entryLen & 0x03)
return True;
}
-static NTSTATUS aixjfs2_set_nt_acl_common(files_struct *fsp, uint32 security_info_sent, SEC_DESC *psd)
+static NTSTATUS aixjfs2_set_nt_acl_common(files_struct *fsp, uint32 security_info_sent, const SEC_DESC *psd)
{
acl_type_t acl_type_info;
NTSTATUS result = NT_STATUS_ACCESS_DENIED;
return result;
}
-NTSTATUS aixjfs2_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp, int fd, uint32 security_info_sent, SEC_DESC *psd)
-{
- return aixjfs2_set_nt_acl_common(fsp, security_info_sent, psd);
-}
-
-NTSTATUS aixjfs2_set_nt_acl(vfs_handle_struct *handle, files_struct *fsp, const char *name, uint32 security_info_sent, SEC_DESC *psd)
+NTSTATUS aixjfs2_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp, uint32 security_info_sent, const SEC_DESC *psd)
{
return aixjfs2_set_nt_acl_common(fsp, security_info_sent, psd);
}
int aixjfs2_sys_acl_set_fd(vfs_handle_struct *handle,
files_struct *fsp,
- int fd, SMB_ACL_T theacl)
+ SMB_ACL_T theacl)
{
struct acl *acl_aixc;
acl_type_t acl_type_info;
return -1;
rc = aclx_fput(
- fd,
+ fsp->fh->fd,
SET_ACL, /* set only the ACL, not mode bits */
acl_type_info,
acl_aixc,
SMB_VFS_OP_FSET_NT_ACL,
SMB_VFS_LAYER_TRANSPARENT},
- {SMB_VFS_OP(aixjfs2_set_nt_acl),
- SMB_VFS_OP_SET_NT_ACL,
- SMB_VFS_LAYER_TRANSPARENT},
-
{SMB_VFS_OP(aixjfs2_sys_acl_get_file),
SMB_VFS_OP_SYS_ACL_GET_FILE,
SMB_VFS_LAYER_TRANSPARENT},