Esempio n. 1
0
static int cap_removexattr(vfs_handle_struct *handle, struct connection_struct *conn,const char *path, const char *name)
{
        pstring cappath, capname;
	capencode(cappath, path);
	capencode(capname, name);
        return SMB_VFS_NEXT_REMOVEXATTR(handle, conn, cappath, capname);
}
Esempio n. 2
0
static int fake_acls_sys_acl_delete_def_file(vfs_handle_struct *handle, const char *path)
{
	int ret;
	const char *name = FAKE_ACL_DEFAULT_XATTR;
	TALLOC_CTX *frame = talloc_stackframe();
	struct smb_filename *smb_fname;

	smb_fname = synthetic_smb_fname(frame, path, NULL, NULL);
	if (smb_fname == NULL) {
		TALLOC_FREE(frame);
		errno = ENOMEM;
		return -1;
	}

	ret = SMB_VFS_NEXT_STAT(handle, smb_fname);
	if (ret == -1) {
		TALLOC_FREE(frame);
		return -1;
	}

	if (!S_ISDIR(smb_fname->st.st_ex_mode)) {
		errno = EINVAL;
		TALLOC_FREE(frame);
		return -1;
	}

	ret = SMB_VFS_NEXT_REMOVEXATTR(handle, path, name);
	if (ret == -1 && errno == ENOATTR) {
		ret = 0;
		errno = 0;
	}

	TALLOC_FREE(frame);
	return ret;
}
Esempio n. 3
0
static int vxfs_remove_xattr(struct vfs_handle_struct *handle,
			     const char *path, const char *name){

	DEBUG(10, ("In vxfs_remove_xattr\n"));

	if (strcmp(name, XATTR_NTACL_NAME) == 0) {
		return SMB_VFS_NEXT_REMOVEXATTR(handle, path, XATTR_USER_NTACL);
	}

	/* Clients can't see XATTR_USER_NTACL directly. */
	if (strcasecmp(name, XATTR_USER_NTACL) == 0) {
		errno = ENOATTR;
		return -1;
	}

	return SMB_VFS_NEXT_REMOVEXATTR(handle, path, name);
}
Esempio n. 4
0
/*
 * Check if someone changed the POSIX mode, for files we expect 0666, for
 * directories 0777. Discard the ACL blob if the mode is different.
 */
static bool nfs4acl_validate_blob(vfs_handle_struct *handle,
				  const struct smb_filename *smb_fname)
{
	struct nfs4acl_config *config = NULL;
	mode_t expected_mode;
	int saved_errno = 0;
	int ret;

	SMB_VFS_HANDLE_GET_DATA(handle, config,
				struct nfs4acl_config,
				return false);

	if (!VALID_STAT(smb_fname->st)) {
		/* might be a create */
		return true;
	}

	if (S_ISDIR(smb_fname->st.st_ex_mode)) {
		expected_mode = 0777;
	} else {
		expected_mode = 0666;
	}
	if ((smb_fname->st.st_ex_mode & expected_mode) == expected_mode) {
		return true;
	}

	become_root();
	ret = SMB_VFS_NEXT_REMOVEXATTR(handle,
				       smb_fname,
				       config->xattr_name);
	if (ret != 0) {
		saved_errno = errno;
	}
	unbecome_root();
	if (saved_errno != 0) {
		errno = saved_errno;
	}
	if (ret != 0 && errno != ENOATTR) {
		DBG_ERR("Removing NFS4 xattr failed: %s\n", strerror(errno));
		return false;
	}

	return true;
}
Esempio n. 5
0
static int skel_removexattr(vfs_handle_struct *handle, const char *path, const char *name)
{
        return SMB_VFS_NEXT_REMOVEXATTR(handle, path, name);
}