static int sys_acl_set_file_tdb(vfs_handle_struct *handle, const char *path, SMB_ACL_TYPE_T type, SMB_ACL_T theacl) { SMB_STRUCT_STAT sbuf; struct db_context *db = acl_db; int ret = -1; ret = vfs_stat_smb_basename(handle->conn, path, &sbuf); if (ret == -1) { return -1; } ret = SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, path, type, theacl); if (ret == -1) { return -1; } acl_tdb_delete(handle, db, &sbuf); return 0; }
static int sys_acl_set_file_tdb(vfs_handle_struct *handle, const char *path, SMB_ACL_TYPE_T type, SMB_ACL_T theacl) { SMB_STRUCT_STAT sbuf; struct db_context *db; int ret = -1; SMB_VFS_HANDLE_GET_DATA(handle, db, struct db_context, return -1); if (lp_posix_pathnames()) { ret = vfs_lstat_smb_fname(handle->conn, path, &sbuf); } else { ret = vfs_stat_smb_fname(handle->conn, path, &sbuf); } if (ret == -1) { return -1; } ret = SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, path, type, theacl); if (ret == -1) { return -1; } acl_tdb_delete(handle, db, &sbuf); return 0; }
static int vxfs_sys_acl_set_file(vfs_handle_struct *handle, const char *name, SMB_ACL_TYPE_T acltype, SMB_ACL_T theacl) { if (vxfs_compare(handle->conn, (char *)name, theacl, acltype)) { return 0; } return SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, name, acltype, theacl); }
static int sys_acl_set_file_xattr(vfs_handle_struct *handle, const char *name, SMB_ACL_TYPE_T type, SMB_ACL_T theacl) { int ret = SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, name, type, theacl); if (ret == -1) { return -1; } become_root(); SMB_VFS_REMOVEXATTR(handle->conn, name, XATTR_NTACL_NAME); unbecome_root(); return ret; }
static int sys_acl_set_file_tdb(vfs_handle_struct *handle, const char *path, SMB_ACL_TYPE_T type, SMB_ACL_T theacl) { struct db_context *db = acl_db; int ret = -1; struct smb_filename smb_fname = { .base_name = discard_const_p(char, path) }; ret = SMB_VFS_STAT(handle->conn, &smb_fname); if (ret == -1) { return -1; } ret = SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, path, type, theacl); if (ret == -1) { return -1; } acl_tdb_delete(handle, db, &smb_fname.st); return 0; } /********************************************************************* Remove a Windows ACL - we're setting the underlying POSIX ACL. *********************************************************************/ static int sys_acl_set_fd_tdb(vfs_handle_struct *handle, files_struct *fsp, SMB_ACL_T theacl) { struct db_context *db = acl_db; NTSTATUS status; int ret; status = vfs_stat_fsp(fsp); if (!NT_STATUS_IS_OK(status)) { return -1; } ret = SMB_VFS_NEXT_SYS_ACL_SET_FD(handle, fsp, theacl); if (ret == -1) { return -1; } acl_tdb_delete(handle, db, &fsp->fsp_name->st); return 0; } static struct vfs_fn_pointers vfs_acl_tdb_fns = { .connect_fn = connect_acl_tdb, .disconnect_fn = disconnect_acl_tdb, .rmdir_fn = rmdir_acl_tdb, .unlink_fn = unlink_acl_tdb, .chmod_fn = chmod_acl_module_common, .fchmod_fn = fchmod_acl_module_common, .fget_nt_acl_fn = fget_nt_acl_common, .get_nt_acl_fn = get_nt_acl_common, .fset_nt_acl_fn = fset_nt_acl_common, .chmod_acl_fn = chmod_acl_acl_module_common, .fchmod_acl_fn = fchmod_acl_acl_module_common, .sys_acl_set_file_fn = sys_acl_set_file_tdb, .sys_acl_set_fd_fn = sys_acl_set_fd_tdb }; static_decl_vfs; NTSTATUS vfs_acl_tdb_init(void) { return smb_register_vfs(SMB_VFS_INTERFACE_VERSION, "acl_tdb", &vfs_acl_tdb_fns); }
static int skel_sys_acl_set_file(vfs_handle_struct *handle, const char *name, SMB_ACL_TYPE_T acltype, SMB_ACL_T theacl) { return SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, name, acltype, theacl); }
static int cap_sys_acl_set_file(vfs_handle_struct *handle, connection_struct *conn, const char *name, SMB_ACL_TYPE_T acltype, SMB_ACL_T theacl) { pstring capname; capencode(capname, name); return SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, conn, capname, acltype, theacl); }