Print this page
NEX-15069 smtorture smb2.create.blob is failed
Reviewed by: Matt Barden <matt.barden@nexenta.com>
Reviewed by: Evan Layton <evan.layton@nexenta.com>
NEX-15069 smtorture smb2.create.blob is failed
Reviewed by: Matt Barden <matt.barden@nexenta.com>
Reviewed by: Evan Layton <evan.layton@nexenta.com>
NEX-2666 Nested directory create request inconsistent with Windows behaviour
SMB-115 Support SMB path names with length > 1024
SMB-100 Internal error if filename is too long
Approved by: Gordon Ross <gwr@nexenta.com>
SMB-11 SMB2 message parse & dispatch
SMB-12 SMB2 Negotiate Protocol
SMB-13 SMB2 Session Setup
SMB-14 SMB2 Logoff
SMB-15 SMB2 Tree Connect
SMB-16 SMB2 Tree Disconnect
SMB-17 SMB2 Create
SMB-18 SMB2 Close
SMB-19 SMB2 Flush
SMB-20 SMB2 Read
SMB-21 SMB2 Write
SMB-22 SMB2 Lock/Unlock
SMB-23 SMB2 Ioctl
SMB-24 SMB2 Cancel
SMB-25 SMB2 Echo
SMB-26 SMB2 Query Dir
SMB-27 SMB2 Change Notify
SMB-28 SMB2 Query Info
SMB-29 SMB2 Set Info
SMB-30 SMB2 Oplocks
SMB-53 SMB2 Create Context options
(SMB2 code review cleanup 1, 2, 3)
| Split |
Close |
| Expand all |
| Collapse all |
--- old/usr/src/uts/common/fs/smbsrv/smb_errno.c
+++ new/usr/src/uts/common/fs/smbsrv/smb_errno.c
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
|
↓ open down ↓ |
13 lines elided |
↑ open up ↑ |
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21
22 22 /*
23 23 * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
24 - * Copyright 2014 Nexenta Systems, Inc. All rights reserved.
24 + * Copyright 2017 Nexenta Systems, Inc. All rights reserved.
25 25 */
26 26
27 27 /*
28 28 * Translate Unix errno values to NT status, and NT status to
29 29 * DOS-style error class+code (for SMB1)
30 30 */
31 31
32 32 #include <smbsrv/smb_kproto.h>
33 33 #include <smbsrv/smb_kstat.h>
34 34
35 35 #include "smbclnt/smb_status2winerr.h"
36 36
37 37
38 38 /*
39 39 * Map Unix errno values to NT status values.
|
↓ open down ↓ |
5 lines elided |
↑ open up ↑ |
40 40 */
41 41
42 42 struct errno2status {
43 43 int errnum;
44 44 uint_t status;
45 45 };
46 46
47 47 static const struct errno2status
48 48 smb_errno2status_map[] = {
49 49 { EPERM, NT_STATUS_ACCESS_DENIED },
50 - { ENOENT, NT_STATUS_NO_SUCH_FILE },
51 - /* NB: ESRCH is used to represent stream lookup failures. */
52 - { ESRCH, NT_STATUS_OBJECT_NAME_NOT_FOUND },
50 + { ENOENT, NT_STATUS_OBJECT_NAME_NOT_FOUND },
51 + /* NB: ESRCH is used in rename and stream ops. */
52 + { ESRCH, NT_STATUS_NO_SUCH_FILE },
53 53 { EINTR, NT_STATUS_CANCELLED },
54 54 { EIO, NT_STATUS_IO_DEVICE_ERROR },
55 55 { ENXIO, NT_STATUS_BAD_DEVICE_TYPE },
56 56 /* E2BIG, ENOEXEC */
57 57 { EBADF, NT_STATUS_INVALID_HANDLE },
58 58 /* ECHILD, EAGAIN */
59 59 { ENOMEM, NT_STATUS_NO_MEMORY },
60 60 { EACCES, NT_STATUS_ACCESS_DENIED },
61 61 /* EFAULT, ENOTBLK, EBUSY */
62 62 { EEXIST, NT_STATUS_OBJECT_NAME_COLLISION },
63 63 { EXDEV, NT_STATUS_NOT_SAME_DEVICE },
64 64 { ENODEV, NT_STATUS_NO_SUCH_DEVICE },
65 - /* ENOTDIR should be: NT_STATUS_NOT_A_DIRECTORY, but not yet */
66 65 { ENOTDIR, NT_STATUS_OBJECT_PATH_NOT_FOUND },
67 66 { EISDIR, NT_STATUS_FILE_IS_A_DIRECTORY },
68 67 { EINVAL, NT_STATUS_INVALID_PARAMETER },
69 68 { ENFILE, NT_STATUS_TOO_MANY_OPENED_FILES },
70 69 { EMFILE, NT_STATUS_TOO_MANY_OPENED_FILES },
71 70 { ENOTTY, NT_STATUS_INVALID_DEVICE_REQUEST },
72 71 /* ENOTTY, ETXTBSY, EFBIG */
73 72 { ENOSPC, NT_STATUS_DISK_FULL },
74 73 /* ESPIPE */
75 74 { EROFS, NT_STATUS_ACCESS_DENIED },
76 75 { EMLINK, NT_STATUS_TOO_MANY_LINKS },
77 76 { EPIPE, NT_STATUS_PIPE_BROKEN },
78 77 /* EDOM */
79 78 /* NB: ERANGE is used to represent lock range I/O conflicts. */
80 79 { ERANGE, NT_STATUS_FILE_LOCK_CONFLICT },
81 80 /* ENOMSG, EIDRM, ... */
82 81 { ENOTSUP, NT_STATUS_NOT_SUPPORTED },
83 82 { EDQUOT, NT_STATUS_DISK_FULL },
84 83 { EREMOTE, NT_STATUS_PATH_NOT_COVERED},
85 84 { ENAMETOOLONG, NT_STATUS_OBJECT_NAME_INVALID },
86 85 { EILSEQ, NT_STATUS_OBJECT_NAME_INVALID },
87 86 { ENOTEMPTY, NT_STATUS_DIRECTORY_NOT_EMPTY },
88 87 { ENOTSOCK, NT_STATUS_INVALID_HANDLE },
89 88 { ESTALE, NT_STATUS_INVALID_HANDLE },
90 89 { 0, 0 }
91 90 };
92 91
93 92 uint_t
94 93 smb_errno2status(int errnum)
95 94 {
96 95 const struct errno2status *es;
97 96
98 97 if (errnum == 0)
99 98 return (0);
100 99
101 100 for (es = smb_errno2status_map; es->errnum != 0; es++)
102 101 if (es->errnum == errnum)
103 102 return (es->status);
104 103
105 104 return (NT_STATUS_INTERNAL_ERROR);
106 105 }
107 106
108 107 /*
109 108 * Map NT Status codes to Win32 API error numbers.
110 109 * But note: we only want the ones below 0xFFFF,
111 110 * which can be returned in SMB with class=DOSERR.
112 111 */
113 112 uint16_t
114 113 smb_status2doserr(uint_t status)
115 114 {
116 115 const struct status2winerr *sw;
117 116
118 117 if (status == 0)
119 118 return (0);
120 119
121 120 for (sw = smb_status2winerr_map; sw->status != 0; sw++)
122 121 if (sw->status == status && (sw->winerr < 0xFFFF))
123 122 return ((uint16_t)sw->winerr);
124 123
125 124 return (ERROR_GEN_FAILURE);
126 125 }
|
↓ open down ↓ |
51 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX