smb_common_open.c revision 3b13a1ef7511135ec0c75b5f94de8075454efd79
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * CDDL HEADER START
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * The contents of this file are subject to the terms of the
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * Common Development and Distribution License (the "License").
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * You may not use this file except in compliance with the License.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * See the License for the specific language governing permissions
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * and limitations under the License.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * When distributing Covered Code, include this CDDL HEADER in each
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * If applicable, add the following below this CDDL HEADER, with the
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * fields enclosed by brackets "[]" replaced with your own identifying
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * information: Portions Copyright [yyyy] [name of copyright owner]
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * CDDL HEADER END
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * Copyright 2013 Nexenta Systems, Inc. All rights reserved.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * This module provides the common open functionality to the various
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * open and create SMB interface functions.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsyncstatic int smb_set_open_attributes(smb_request_t *, smb_ofile_t *);
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsyncstatic void smb_open_oplock_break(smb_request_t *, smb_node_t *);
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsyncstatic boolean_t smb_open_attr_only(smb_arg_open_t *);
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsyncstatic boolean_t smb_open_overwrite(smb_arg_open_t *);
case SMB_DA_ACCESS_READ:
return (FILE_GENERIC_READ);
case SMB_DA_ACCESS_WRITE:
return (FILE_GENERIC_WRITE);
case SMB_DA_ACCESS_READ_WRITE:
case SMB_DA_ACCESS_EXECUTE:
return (FILE_GENERIC_EXECUTE);
return (FILE_GENERIC_ALL);
return (FILE_SHARE_ALL);
case SMB_DA_SHARE_EXCLUSIVE:
return (FILE_SHARE_NONE);
case SMB_DA_SHARE_DENY_WRITE:
return (FILE_SHARE_READ);
case SMB_DA_SHARE_DENY_READ:
return (FILE_SHARE_WRITE);
case SMB_DA_SHARE_DENY_NONE:
int count;
if (count != 0)
return (status);
static uint32_t
int rc;
int max_requested = 0;
int is_dir;
if (is_dir) {
return (NT_STATUS_INVALID_PARAMETER);
return (NT_STATUS_TOO_MANY_OPENED_FILES);
case STYPE_DISKTREE:
case STYPE_PRINTQ:
case STYPE_IPC:
return (status);
return (status);
return (NT_STATUS_BAD_DEVICE_TYPE);
return (NT_STATUS_NAME_TOO_LONG);
if (is_dir) {
return (NT_STATUS_OBJECT_NAME_NOT_FOUND);
return (NT_STATUS_ACCESS_DENIED);
if (rc == 0) {
if (rc != 0) {
rc = 0;
if (last_comp_found) {
return (NT_STATUS_ACCESS_DENIED);
return (NT_STATUS_FILE_IS_A_DIRECTORY);
return (NT_STATUS_NOT_A_DIRECTORY);
return (NT_STATUS_DELETE_PENDING);
return (NT_STATUS_OBJECT_NAME_COLLISION);
FILE_APPEND_DATA)) {
return (NT_STATUS_ACCESS_DENIED);
return (NT_STATUS_ACCESS_DENIED);
return (status);
return (status);
return (NT_STATUS_ACCESS_DENIED);
case FILE_SUPERSEDE:
case FILE_OVERWRITE_IF:
case FILE_OVERWRITE:
return (NT_STATUS_ACCESS_DENIED);
if (rc != 0) {
node);
if (rc != 0) {
uniq_fid);
if (is_dir == 0)
return (NT_STATUS_OBJECT_NAME_NOT_FOUND);
return (NT_STATUS_OBJECT_NAME_INVALID);
if (is_dir == 0) {
if (rc != 0) {
return (status);
if (rc != 0) {
if (max_requested) {
&err);
if (rc != 0) {
if (created)
if (created)
return (status);
if (created)
return (NT_STATUS_SUCCESS);
static boolean_t
return (B_TRUE);
return (B_FALSE);
static boolean_t
return (B_TRUE);
return (B_FALSE);
int rc = 0;
return (rc);