exportfs: remove old methods
[wrt350n-kernel.git] / fs / cifs / netmisc.c
blobf06359cb22ee96645e7dfd7b0aa62cc0de216b2b
1 /*
2 * fs/cifs/netmisc.c
4 * Copyright (c) International Business Machines Corp., 2002
5 * Author(s): Steve French (sfrench@us.ibm.com)
7 * Error mapping routines from Samba libsmb/errormap.c
8 * Copyright (C) Andrew Tridgell 2001
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
18 * the GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 #include <linux/net.h>
26 #include <linux/string.h>
27 #include <linux/in.h>
28 #include <linux/ctype.h>
29 #include <linux/fs.h>
30 #include <asm/div64.h>
31 #include <asm/byteorder.h>
32 #include <linux/inet.h>
33 #include "cifsfs.h"
34 #include "cifspdu.h"
35 #include "cifsglob.h"
36 #include "cifsproto.h"
37 #include "smberr.h"
38 #include "cifs_debug.h"
39 #include "nterr.h"
41 struct smb_to_posix_error {
42 __u16 smb_err;
43 int posix_code;
46 static const struct smb_to_posix_error mapping_table_ERRDOS[] = {
47 {ERRbadfunc, -EINVAL},
48 {ERRbadfile, -ENOENT},
49 {ERRbadpath, -ENOTDIR},
50 {ERRnofids, -EMFILE},
51 {ERRnoaccess, -EACCES},
52 {ERRbadfid, -EBADF},
53 {ERRbadmcb, -EIO},
54 {ERRnomem, -ENOMEM},
55 {ERRbadmem, -EFAULT},
56 {ERRbadenv, -EFAULT},
57 {ERRbadformat, -EINVAL},
58 {ERRbadaccess, -EACCES},
59 {ERRbaddata, -EIO},
60 {ERRbaddrive, -ENXIO},
61 {ERRremcd, -EACCES},
62 {ERRdiffdevice, -EXDEV},
63 {ERRnofiles, -ENOENT},
64 {ERRbadshare, -ETXTBSY},
65 {ERRlock, -EACCES},
66 {ERRunsup, -EINVAL},
67 {ERRnosuchshare, -ENXIO},
68 {ERRfilexists, -EEXIST},
69 {ERRinvparm, -EINVAL},
70 {ERRdiskfull, -ENOSPC},
71 {ERRinvname, -ENOENT},
72 {ERRinvlevel, -EOPNOTSUPP},
73 {ERRdirnotempty, -ENOTEMPTY},
74 {ERRnotlocked, -ENOLCK},
75 {ERRcancelviolation, -ENOLCK},
76 {ERRalreadyexists, -EEXIST},
77 {ERRmoredata, -EOVERFLOW},
78 {ERReasnotsupported, -EOPNOTSUPP},
79 {ErrQuota, -EDQUOT},
80 {ErrNotALink, -ENOLINK},
81 {ERRnetlogonNotStarted, -ENOPROTOOPT},
82 {ErrTooManyLinks, -EMLINK},
83 {0, 0}
86 static const struct smb_to_posix_error mapping_table_ERRSRV[] = {
87 {ERRerror, -EIO},
88 {ERRbadpw, -EACCES}, /* was EPERM */
89 {ERRbadtype, -EREMOTE},
90 {ERRaccess, -EACCES},
91 {ERRinvtid, -ENXIO},
92 {ERRinvnetname, -ENXIO},
93 {ERRinvdevice, -ENXIO},
94 {ERRqfull, -ENOSPC},
95 {ERRqtoobig, -ENOSPC},
96 {ERRqeof, -EIO},
97 {ERRinvpfid, -EBADF},
98 {ERRsmbcmd, -EBADRQC},
99 {ERRsrverror, -EIO},
100 {ERRbadBID, -EIO},
101 {ERRfilespecs, -EINVAL},
102 {ERRbadLink, -EIO},
103 {ERRbadpermits, -EINVAL},
104 {ERRbadPID, -ESRCH},
105 {ERRsetattrmode, -EINVAL},
106 {ERRpaused, -EHOSTDOWN},
107 {ERRmsgoff, -EHOSTDOWN},
108 {ERRnoroom, -ENOSPC},
109 {ERRrmuns, -EUSERS},
110 {ERRtimeout, -ETIME},
111 {ERRnoresource, -ENOBUFS},
112 {ERRtoomanyuids, -EUSERS},
113 {ERRbaduid, -EACCES},
114 {ERRusempx, -EIO},
115 {ERRusestd, -EIO},
116 {ERR_NOTIFY_ENUM_DIR, -ENOBUFS},
117 {ERRnoSuchUser, -EACCES},
118 /* {ERRaccountexpired, -EACCES},
119 {ERRbadclient, -EACCES},
120 {ERRbadLogonTime, -EACCES},
121 {ERRpasswordExpired, -EACCES},*/
122 {ERRaccountexpired, -EKEYEXPIRED},
123 {ERRbadclient, -EACCES},
124 {ERRbadLogonTime, -EACCES},
125 {ERRpasswordExpired, -EKEYEXPIRED},
127 {ERRnosupport, -EINVAL},
128 {0, 0}
131 static const struct smb_to_posix_error mapping_table_ERRHRD[] = {
132 {0, 0}
135 /* Convert string containing dotted ip address to binary form */
136 /* returns 0 if invalid address */
139 cifs_inet_pton(int address_family, char *cp, void *dst)
141 int ret = 0;
143 /* calculate length by finding first slash or NULL */
144 /* BB Should we convert '/' slash to '\' here since it seems already
145 * done before this */
146 if ( address_family == AF_INET ) {
147 ret = in4_pton(cp, -1 /* len */, dst , '\\', NULL);
148 } else if ( address_family == AF_INET6 ) {
149 ret = in6_pton(cp, -1 /* len */, dst , '\\', NULL);
151 #ifdef CONFIG_CIFS_DEBUG2
152 cFYI(1, ("address conversion returned %d for %s", ret, cp));
153 #endif
154 if (ret > 0)
155 ret = 1;
156 return ret;
159 /*****************************************************************************
160 convert a NT status code to a dos class/code
161 *****************************************************************************/
162 /* NT status -> dos error map */
163 static const struct {
164 __u8 dos_class;
165 __u16 dos_code;
166 __u32 ntstatus;
167 } ntstatus_to_dos_map[] = {
169 ERRDOS, ERRgeneral, NT_STATUS_UNSUCCESSFUL}, {
170 ERRDOS, ERRbadfunc, NT_STATUS_NOT_IMPLEMENTED}, {
171 ERRDOS, ERRinvlevel, NT_STATUS_INVALID_INFO_CLASS}, {
172 ERRDOS, 24, NT_STATUS_INFO_LENGTH_MISMATCH}, {
173 ERRHRD, ERRgeneral, NT_STATUS_ACCESS_VIOLATION}, {
174 ERRHRD, ERRgeneral, NT_STATUS_IN_PAGE_ERROR}, {
175 ERRHRD, ERRgeneral, NT_STATUS_PAGEFILE_QUOTA}, {
176 ERRDOS, ERRbadfid, NT_STATUS_INVALID_HANDLE}, {
177 ERRHRD, ERRgeneral, NT_STATUS_BAD_INITIAL_STACK}, {
178 ERRDOS, 193, NT_STATUS_BAD_INITIAL_PC}, {
179 ERRDOS, 87, NT_STATUS_INVALID_CID}, {
180 ERRHRD, ERRgeneral, NT_STATUS_TIMER_NOT_CANCELED}, {
181 ERRDOS, 87, NT_STATUS_INVALID_PARAMETER}, {
182 ERRDOS, ERRbadfile, NT_STATUS_NO_SUCH_DEVICE}, {
183 ERRDOS, ERRbadfile, NT_STATUS_NO_SUCH_FILE}, {
184 ERRDOS, ERRbadfunc, NT_STATUS_INVALID_DEVICE_REQUEST}, {
185 ERRDOS, 38, NT_STATUS_END_OF_FILE}, {
186 ERRDOS, 34, NT_STATUS_WRONG_VOLUME}, {
187 ERRDOS, 21, NT_STATUS_NO_MEDIA_IN_DEVICE}, {
188 ERRHRD, ERRgeneral, NT_STATUS_UNRECOGNIZED_MEDIA}, {
189 ERRDOS, 27, NT_STATUS_NONEXISTENT_SECTOR},
190 /* { This NT error code was 'sqashed'
191 from NT_STATUS_MORE_PROCESSING_REQUIRED to NT_STATUS_OK
192 during the session setup } */
194 ERRDOS, ERRnomem, NT_STATUS_NO_MEMORY}, {
195 ERRDOS, 487, NT_STATUS_CONFLICTING_ADDRESSES}, {
196 ERRDOS, 487, NT_STATUS_NOT_MAPPED_VIEW}, {
197 ERRDOS, 87, NT_STATUS_UNABLE_TO_FREE_VM}, {
198 ERRDOS, 87, NT_STATUS_UNABLE_TO_DELETE_SECTION}, {
199 ERRDOS, 2142, NT_STATUS_INVALID_SYSTEM_SERVICE}, {
200 ERRHRD, ERRgeneral, NT_STATUS_ILLEGAL_INSTRUCTION}, {
201 ERRDOS, ERRnoaccess, NT_STATUS_INVALID_LOCK_SEQUENCE}, {
202 ERRDOS, ERRnoaccess, NT_STATUS_INVALID_VIEW_SIZE}, {
203 ERRDOS, 193, NT_STATUS_INVALID_FILE_FOR_SECTION}, {
204 ERRDOS, ERRnoaccess, NT_STATUS_ALREADY_COMMITTED},
205 /* { This NT error code was 'sqashed'
206 from NT_STATUS_ACCESS_DENIED to NT_STATUS_TRUSTED_RELATIONSHIP_FAILURE
207 during the session setup } */
209 ERRDOS, ERRnoaccess, NT_STATUS_ACCESS_DENIED}, {
210 ERRDOS, 111, NT_STATUS_BUFFER_TOO_SMALL}, {
211 ERRDOS, ERRbadfid, NT_STATUS_OBJECT_TYPE_MISMATCH}, {
212 ERRHRD, ERRgeneral, NT_STATUS_NONCONTINUABLE_EXCEPTION}, {
213 ERRHRD, ERRgeneral, NT_STATUS_INVALID_DISPOSITION}, {
214 ERRHRD, ERRgeneral, NT_STATUS_UNWIND}, {
215 ERRHRD, ERRgeneral, NT_STATUS_BAD_STACK}, {
216 ERRHRD, ERRgeneral, NT_STATUS_INVALID_UNWIND_TARGET}, {
217 ERRDOS, 158, NT_STATUS_NOT_LOCKED}, {
218 ERRHRD, ERRgeneral, NT_STATUS_PARITY_ERROR}, {
219 ERRDOS, 487, NT_STATUS_UNABLE_TO_DECOMMIT_VM}, {
220 ERRDOS, 487, NT_STATUS_NOT_COMMITTED}, {
221 ERRHRD, ERRgeneral, NT_STATUS_INVALID_PORT_ATTRIBUTES}, {
222 ERRHRD, ERRgeneral, NT_STATUS_PORT_MESSAGE_TOO_LONG}, {
223 ERRDOS, 87, NT_STATUS_INVALID_PARAMETER_MIX}, {
224 ERRHRD, ERRgeneral, NT_STATUS_INVALID_QUOTA_LOWER}, {
225 ERRHRD, ERRgeneral, NT_STATUS_DISK_CORRUPT_ERROR}, {
226 ERRDOS, ERRbadfile, NT_STATUS_OBJECT_NAME_INVALID}, { /* mapping changed since shell does lookup on * and expects file not found */
227 ERRDOS, ERRbadfile, NT_STATUS_OBJECT_NAME_NOT_FOUND}, {
228 ERRDOS, ERRalreadyexists, NT_STATUS_OBJECT_NAME_COLLISION}, {
229 ERRHRD, ERRgeneral, NT_STATUS_HANDLE_NOT_WAITABLE}, {
230 ERRDOS, ERRbadfid, NT_STATUS_PORT_DISCONNECTED}, {
231 ERRHRD, ERRgeneral, NT_STATUS_DEVICE_ALREADY_ATTACHED}, {
232 ERRDOS, 161, NT_STATUS_OBJECT_PATH_INVALID}, {
233 ERRDOS, ERRbadpath, NT_STATUS_OBJECT_PATH_NOT_FOUND}, {
234 ERRDOS, 161, NT_STATUS_OBJECT_PATH_SYNTAX_BAD}, {
235 ERRHRD, ERRgeneral, NT_STATUS_DATA_OVERRUN}, {
236 ERRHRD, ERRgeneral, NT_STATUS_DATA_LATE_ERROR}, {
237 ERRDOS, 23, NT_STATUS_DATA_ERROR}, {
238 ERRDOS, 23, NT_STATUS_CRC_ERROR}, {
239 ERRDOS, ERRnomem, NT_STATUS_SECTION_TOO_BIG}, {
240 ERRDOS, ERRnoaccess, NT_STATUS_PORT_CONNECTION_REFUSED}, {
241 ERRDOS, ERRbadfid, NT_STATUS_INVALID_PORT_HANDLE}, {
242 ERRDOS, ERRbadshare, NT_STATUS_SHARING_VIOLATION}, {
243 ERRHRD, ERRgeneral, NT_STATUS_QUOTA_EXCEEDED}, {
244 ERRDOS, 87, NT_STATUS_INVALID_PAGE_PROTECTION}, {
245 ERRDOS, 288, NT_STATUS_MUTANT_NOT_OWNED}, {
246 ERRDOS, 298, NT_STATUS_SEMAPHORE_LIMIT_EXCEEDED}, {
247 ERRDOS, 87, NT_STATUS_PORT_ALREADY_SET}, {
248 ERRDOS, 87, NT_STATUS_SECTION_NOT_IMAGE}, {
249 ERRDOS, 156, NT_STATUS_SUSPEND_COUNT_EXCEEDED}, {
250 ERRDOS, ERRnoaccess, NT_STATUS_THREAD_IS_TERMINATING}, {
251 ERRDOS, 87, NT_STATUS_BAD_WORKING_SET_LIMIT}, {
252 ERRDOS, 87, NT_STATUS_INCOMPATIBLE_FILE_MAP}, {
253 ERRDOS, 87, NT_STATUS_SECTION_PROTECTION}, {
254 ERRDOS, ERReasnotsupported, NT_STATUS_EAS_NOT_SUPPORTED}, {
255 ERRDOS, 255, NT_STATUS_EA_TOO_LARGE}, {
256 ERRHRD, ERRgeneral, NT_STATUS_NONEXISTENT_EA_ENTRY}, {
257 ERRHRD, ERRgeneral, NT_STATUS_NO_EAS_ON_FILE}, {
258 ERRHRD, ERRgeneral, NT_STATUS_EA_CORRUPT_ERROR}, {
259 ERRDOS, ERRlock, NT_STATUS_FILE_LOCK_CONFLICT}, {
260 ERRDOS, ERRlock, NT_STATUS_LOCK_NOT_GRANTED}, {
261 ERRDOS, ERRbadfile, NT_STATUS_DELETE_PENDING}, {
262 ERRDOS, ERRunsup, NT_STATUS_CTL_FILE_NOT_SUPPORTED}, {
263 ERRHRD, ERRgeneral, NT_STATUS_UNKNOWN_REVISION}, {
264 ERRHRD, ERRgeneral, NT_STATUS_REVISION_MISMATCH}, {
265 ERRHRD, ERRgeneral, NT_STATUS_INVALID_OWNER}, {
266 ERRHRD, ERRgeneral, NT_STATUS_INVALID_PRIMARY_GROUP}, {
267 ERRHRD, ERRgeneral, NT_STATUS_NO_IMPERSONATION_TOKEN}, {
268 ERRHRD, ERRgeneral, NT_STATUS_CANT_DISABLE_MANDATORY}, {
269 ERRDOS, 2215, NT_STATUS_NO_LOGON_SERVERS}, {
270 ERRHRD, ERRgeneral, NT_STATUS_NO_SUCH_LOGON_SESSION}, {
271 ERRHRD, ERRgeneral, NT_STATUS_NO_SUCH_PRIVILEGE}, {
272 ERRDOS, ERRnoaccess, NT_STATUS_PRIVILEGE_NOT_HELD}, {
273 ERRHRD, ERRgeneral, NT_STATUS_INVALID_ACCOUNT_NAME}, {
274 ERRHRD, ERRgeneral, NT_STATUS_USER_EXISTS},
275 /* { This NT error code was 'sqashed'
276 from NT_STATUS_NO_SUCH_USER to NT_STATUS_LOGON_FAILURE
277 during the session setup } */
279 ERRDOS, ERRnoaccess, NT_STATUS_NO_SUCH_USER}, { /* could map to 2238 */
280 ERRHRD, ERRgeneral, NT_STATUS_GROUP_EXISTS}, {
281 ERRHRD, ERRgeneral, NT_STATUS_NO_SUCH_GROUP}, {
282 ERRHRD, ERRgeneral, NT_STATUS_MEMBER_IN_GROUP}, {
283 ERRHRD, ERRgeneral, NT_STATUS_MEMBER_NOT_IN_GROUP}, {
284 ERRHRD, ERRgeneral, NT_STATUS_LAST_ADMIN},
285 /* { This NT error code was 'sqashed'
286 from NT_STATUS_WRONG_PASSWORD to NT_STATUS_LOGON_FAILURE
287 during the session setup } */
289 ERRSRV, ERRbadpw, NT_STATUS_WRONG_PASSWORD}, {
290 ERRHRD, ERRgeneral, NT_STATUS_ILL_FORMED_PASSWORD}, {
291 ERRHRD, ERRgeneral, NT_STATUS_PASSWORD_RESTRICTION}, {
292 ERRDOS, ERRnoaccess, NT_STATUS_LOGON_FAILURE}, {
293 ERRHRD, ERRgeneral, NT_STATUS_ACCOUNT_RESTRICTION}, {
294 ERRSRV, ERRbadLogonTime, NT_STATUS_INVALID_LOGON_HOURS}, {
295 ERRSRV, ERRbadclient, NT_STATUS_INVALID_WORKSTATION}, {
296 ERRSRV, ERRpasswordExpired, NT_STATUS_PASSWORD_EXPIRED}, {
297 ERRSRV, ERRaccountexpired, NT_STATUS_ACCOUNT_DISABLED}, {
298 ERRHRD, ERRgeneral, NT_STATUS_NONE_MAPPED}, {
299 ERRHRD, ERRgeneral, NT_STATUS_TOO_MANY_LUIDS_REQUESTED}, {
300 ERRHRD, ERRgeneral, NT_STATUS_LUIDS_EXHAUSTED}, {
301 ERRHRD, ERRgeneral, NT_STATUS_INVALID_SUB_AUTHORITY}, {
302 ERRHRD, ERRgeneral, NT_STATUS_INVALID_ACL}, {
303 ERRHRD, ERRgeneral, NT_STATUS_INVALID_SID}, {
304 ERRHRD, ERRgeneral, NT_STATUS_INVALID_SECURITY_DESCR}, {
305 ERRDOS, 127, NT_STATUS_PROCEDURE_NOT_FOUND}, {
306 ERRDOS, 193, NT_STATUS_INVALID_IMAGE_FORMAT}, {
307 ERRHRD, ERRgeneral, NT_STATUS_NO_TOKEN}, {
308 ERRHRD, ERRgeneral, NT_STATUS_BAD_INHERITANCE_ACL}, {
309 ERRDOS, 158, NT_STATUS_RANGE_NOT_LOCKED}, {
310 ERRDOS, 112, NT_STATUS_DISK_FULL}, {
311 ERRHRD, ERRgeneral, NT_STATUS_SERVER_DISABLED}, {
312 ERRHRD, ERRgeneral, NT_STATUS_SERVER_NOT_DISABLED}, {
313 ERRDOS, 68, NT_STATUS_TOO_MANY_GUIDS_REQUESTED}, {
314 ERRDOS, 259, NT_STATUS_GUIDS_EXHAUSTED}, {
315 ERRHRD, ERRgeneral, NT_STATUS_INVALID_ID_AUTHORITY}, {
316 ERRDOS, 259, NT_STATUS_AGENTS_EXHAUSTED}, {
317 ERRDOS, 154, NT_STATUS_INVALID_VOLUME_LABEL}, {
318 ERRDOS, 14, NT_STATUS_SECTION_NOT_EXTENDED}, {
319 ERRDOS, 487, NT_STATUS_NOT_MAPPED_DATA}, {
320 ERRHRD, ERRgeneral, NT_STATUS_RESOURCE_DATA_NOT_FOUND}, {
321 ERRHRD, ERRgeneral, NT_STATUS_RESOURCE_TYPE_NOT_FOUND}, {
322 ERRHRD, ERRgeneral, NT_STATUS_RESOURCE_NAME_NOT_FOUND}, {
323 ERRHRD, ERRgeneral, NT_STATUS_ARRAY_BOUNDS_EXCEEDED}, {
324 ERRHRD, ERRgeneral, NT_STATUS_FLOAT_DENORMAL_OPERAND}, {
325 ERRHRD, ERRgeneral, NT_STATUS_FLOAT_DIVIDE_BY_ZERO}, {
326 ERRHRD, ERRgeneral, NT_STATUS_FLOAT_INEXACT_RESULT}, {
327 ERRHRD, ERRgeneral, NT_STATUS_FLOAT_INVALID_OPERATION}, {
328 ERRHRD, ERRgeneral, NT_STATUS_FLOAT_OVERFLOW}, {
329 ERRHRD, ERRgeneral, NT_STATUS_FLOAT_STACK_CHECK}, {
330 ERRHRD, ERRgeneral, NT_STATUS_FLOAT_UNDERFLOW}, {
331 ERRHRD, ERRgeneral, NT_STATUS_INTEGER_DIVIDE_BY_ZERO}, {
332 ERRDOS, 534, NT_STATUS_INTEGER_OVERFLOW}, {
333 ERRHRD, ERRgeneral, NT_STATUS_PRIVILEGED_INSTRUCTION}, {
334 ERRDOS, ERRnomem, NT_STATUS_TOO_MANY_PAGING_FILES}, {
335 ERRHRD, ERRgeneral, NT_STATUS_FILE_INVALID}, {
336 ERRHRD, ERRgeneral, NT_STATUS_ALLOTTED_SPACE_EXCEEDED},
337 /* { This NT error code was 'sqashed'
338 from NT_STATUS_INSUFFICIENT_RESOURCES to
339 NT_STATUS_INSUFF_SERVER_RESOURCES during the session setup } */
341 ERRDOS, ERRnomem, NT_STATUS_INSUFFICIENT_RESOURCES}, {
342 ERRDOS, ERRbadpath, NT_STATUS_DFS_EXIT_PATH_FOUND}, {
343 ERRDOS, 23, NT_STATUS_DEVICE_DATA_ERROR}, {
344 ERRHRD, ERRgeneral, NT_STATUS_DEVICE_NOT_CONNECTED}, {
345 ERRDOS, 21, NT_STATUS_DEVICE_POWER_FAILURE}, {
346 ERRDOS, 487, NT_STATUS_FREE_VM_NOT_AT_BASE}, {
347 ERRDOS, 487, NT_STATUS_MEMORY_NOT_ALLOCATED}, {
348 ERRHRD, ERRgeneral, NT_STATUS_WORKING_SET_QUOTA}, {
349 ERRDOS, 19, NT_STATUS_MEDIA_WRITE_PROTECTED}, {
350 ERRDOS, 21, NT_STATUS_DEVICE_NOT_READY}, {
351 ERRHRD, ERRgeneral, NT_STATUS_INVALID_GROUP_ATTRIBUTES}, {
352 ERRHRD, ERRgeneral, NT_STATUS_BAD_IMPERSONATION_LEVEL}, {
353 ERRHRD, ERRgeneral, NT_STATUS_CANT_OPEN_ANONYMOUS}, {
354 ERRHRD, ERRgeneral, NT_STATUS_BAD_VALIDATION_CLASS}, {
355 ERRHRD, ERRgeneral, NT_STATUS_BAD_TOKEN_TYPE}, {
356 ERRDOS, 87, NT_STATUS_BAD_MASTER_BOOT_RECORD}, {
357 ERRHRD, ERRgeneral, NT_STATUS_INSTRUCTION_MISALIGNMENT}, {
358 ERRDOS, ERRpipebusy, NT_STATUS_INSTANCE_NOT_AVAILABLE}, {
359 ERRDOS, ERRpipebusy, NT_STATUS_PIPE_NOT_AVAILABLE}, {
360 ERRDOS, ERRbadpipe, NT_STATUS_INVALID_PIPE_STATE}, {
361 ERRDOS, ERRpipebusy, NT_STATUS_PIPE_BUSY}, {
362 ERRDOS, ERRbadfunc, NT_STATUS_ILLEGAL_FUNCTION}, {
363 ERRDOS, ERRnotconnected, NT_STATUS_PIPE_DISCONNECTED}, {
364 ERRDOS, ERRpipeclosing, NT_STATUS_PIPE_CLOSING}, {
365 ERRHRD, ERRgeneral, NT_STATUS_PIPE_CONNECTED}, {
366 ERRHRD, ERRgeneral, NT_STATUS_PIPE_LISTENING}, {
367 ERRDOS, ERRbadpipe, NT_STATUS_INVALID_READ_MODE}, {
368 ERRDOS, 121, NT_STATUS_IO_TIMEOUT}, {
369 ERRDOS, 38, NT_STATUS_FILE_FORCED_CLOSED}, {
370 ERRHRD, ERRgeneral, NT_STATUS_PROFILING_NOT_STARTED}, {
371 ERRHRD, ERRgeneral, NT_STATUS_PROFILING_NOT_STOPPED}, {
372 ERRHRD, ERRgeneral, NT_STATUS_COULD_NOT_INTERPRET}, {
373 ERRDOS, ERRnoaccess, NT_STATUS_FILE_IS_A_DIRECTORY}, {
374 ERRDOS, ERRunsup, NT_STATUS_NOT_SUPPORTED}, {
375 ERRDOS, 51, NT_STATUS_REMOTE_NOT_LISTENING}, {
376 ERRDOS, 52, NT_STATUS_DUPLICATE_NAME}, {
377 ERRDOS, 53, NT_STATUS_BAD_NETWORK_PATH}, {
378 ERRDOS, 54, NT_STATUS_NETWORK_BUSY}, {
379 ERRDOS, 55, NT_STATUS_DEVICE_DOES_NOT_EXIST}, {
380 ERRDOS, 56, NT_STATUS_TOO_MANY_COMMANDS}, {
381 ERRDOS, 57, NT_STATUS_ADAPTER_HARDWARE_ERROR}, {
382 ERRDOS, 58, NT_STATUS_INVALID_NETWORK_RESPONSE}, {
383 ERRDOS, 59, NT_STATUS_UNEXPECTED_NETWORK_ERROR}, {
384 ERRDOS, 60, NT_STATUS_BAD_REMOTE_ADAPTER}, {
385 ERRDOS, 61, NT_STATUS_PRINT_QUEUE_FULL}, {
386 ERRDOS, 62, NT_STATUS_NO_SPOOL_SPACE}, {
387 ERRDOS, 63, NT_STATUS_PRINT_CANCELLED}, {
388 ERRDOS, 64, NT_STATUS_NETWORK_NAME_DELETED}, {
389 ERRDOS, 65, NT_STATUS_NETWORK_ACCESS_DENIED}, {
390 ERRDOS, 66, NT_STATUS_BAD_DEVICE_TYPE}, {
391 ERRDOS, ERRnosuchshare, NT_STATUS_BAD_NETWORK_NAME}, {
392 ERRDOS, 68, NT_STATUS_TOO_MANY_NAMES}, {
393 ERRDOS, 69, NT_STATUS_TOO_MANY_SESSIONS}, {
394 ERRDOS, 70, NT_STATUS_SHARING_PAUSED}, {
395 ERRDOS, 71, NT_STATUS_REQUEST_NOT_ACCEPTED}, {
396 ERRDOS, 72, NT_STATUS_REDIRECTOR_PAUSED}, {
397 ERRDOS, 88, NT_STATUS_NET_WRITE_FAULT}, {
398 ERRHRD, ERRgeneral, NT_STATUS_PROFILING_AT_LIMIT}, {
399 ERRDOS, ERRdiffdevice, NT_STATUS_NOT_SAME_DEVICE}, {
400 ERRDOS, ERRnoaccess, NT_STATUS_FILE_RENAMED}, {
401 ERRDOS, 240, NT_STATUS_VIRTUAL_CIRCUIT_CLOSED}, {
402 ERRHRD, ERRgeneral, NT_STATUS_NO_SECURITY_ON_OBJECT}, {
403 ERRHRD, ERRgeneral, NT_STATUS_CANT_WAIT}, {
404 ERRDOS, ERRpipeclosing, NT_STATUS_PIPE_EMPTY}, {
405 ERRHRD, ERRgeneral, NT_STATUS_CANT_ACCESS_DOMAIN_INFO}, {
406 ERRHRD, ERRgeneral, NT_STATUS_CANT_TERMINATE_SELF}, {
407 ERRHRD, ERRgeneral, NT_STATUS_INVALID_SERVER_STATE}, {
408 ERRHRD, ERRgeneral, NT_STATUS_INVALID_DOMAIN_STATE}, {
409 ERRHRD, ERRgeneral, NT_STATUS_INVALID_DOMAIN_ROLE}, {
410 ERRHRD, ERRgeneral, NT_STATUS_NO_SUCH_DOMAIN}, {
411 ERRHRD, ERRgeneral, NT_STATUS_DOMAIN_EXISTS}, {
412 ERRHRD, ERRgeneral, NT_STATUS_DOMAIN_LIMIT_EXCEEDED}, {
413 ERRDOS, 300, NT_STATUS_OPLOCK_NOT_GRANTED}, {
414 ERRDOS, 301, NT_STATUS_INVALID_OPLOCK_PROTOCOL}, {
415 ERRHRD, ERRgeneral, NT_STATUS_INTERNAL_DB_CORRUPTION}, {
416 ERRHRD, ERRgeneral, NT_STATUS_INTERNAL_ERROR}, {
417 ERRHRD, ERRgeneral, NT_STATUS_GENERIC_NOT_MAPPED}, {
418 ERRHRD, ERRgeneral, NT_STATUS_BAD_DESCRIPTOR_FORMAT}, {
419 ERRHRD, ERRgeneral, NT_STATUS_INVALID_USER_BUFFER}, {
420 ERRHRD, ERRgeneral, NT_STATUS_UNEXPECTED_IO_ERROR}, {
421 ERRHRD, ERRgeneral, NT_STATUS_UNEXPECTED_MM_CREATE_ERR}, {
422 ERRHRD, ERRgeneral, NT_STATUS_UNEXPECTED_MM_MAP_ERROR}, {
423 ERRHRD, ERRgeneral, NT_STATUS_UNEXPECTED_MM_EXTEND_ERR}, {
424 ERRHRD, ERRgeneral, NT_STATUS_NOT_LOGON_PROCESS}, {
425 ERRHRD, ERRgeneral, NT_STATUS_LOGON_SESSION_EXISTS}, {
426 ERRDOS, 87, NT_STATUS_INVALID_PARAMETER_1}, {
427 ERRDOS, 87, NT_STATUS_INVALID_PARAMETER_2}, {
428 ERRDOS, 87, NT_STATUS_INVALID_PARAMETER_3}, {
429 ERRDOS, 87, NT_STATUS_INVALID_PARAMETER_4}, {
430 ERRDOS, 87, NT_STATUS_INVALID_PARAMETER_5}, {
431 ERRDOS, 87, NT_STATUS_INVALID_PARAMETER_6}, {
432 ERRDOS, 87, NT_STATUS_INVALID_PARAMETER_7}, {
433 ERRDOS, 87, NT_STATUS_INVALID_PARAMETER_8}, {
434 ERRDOS, 87, NT_STATUS_INVALID_PARAMETER_9}, {
435 ERRDOS, 87, NT_STATUS_INVALID_PARAMETER_10}, {
436 ERRDOS, 87, NT_STATUS_INVALID_PARAMETER_11}, {
437 ERRDOS, 87, NT_STATUS_INVALID_PARAMETER_12}, {
438 ERRDOS, ERRbadpath, NT_STATUS_REDIRECTOR_NOT_STARTED}, {
439 ERRHRD, ERRgeneral, NT_STATUS_REDIRECTOR_STARTED}, {
440 ERRHRD, ERRgeneral, NT_STATUS_STACK_OVERFLOW}, {
441 ERRHRD, ERRgeneral, NT_STATUS_NO_SUCH_PACKAGE}, {
442 ERRHRD, ERRgeneral, NT_STATUS_BAD_FUNCTION_TABLE}, {
443 ERRDOS, 203, 0xc0000100}, {
444 ERRDOS, 145, NT_STATUS_DIRECTORY_NOT_EMPTY}, {
445 ERRHRD, ERRgeneral, NT_STATUS_FILE_CORRUPT_ERROR}, {
446 ERRDOS, 267, NT_STATUS_NOT_A_DIRECTORY}, {
447 ERRHRD, ERRgeneral, NT_STATUS_BAD_LOGON_SESSION_STATE}, {
448 ERRHRD, ERRgeneral, NT_STATUS_LOGON_SESSION_COLLISION}, {
449 ERRDOS, 206, NT_STATUS_NAME_TOO_LONG}, {
450 ERRDOS, 2401, NT_STATUS_FILES_OPEN}, {
451 ERRDOS, 2404, NT_STATUS_CONNECTION_IN_USE}, {
452 ERRHRD, ERRgeneral, NT_STATUS_MESSAGE_NOT_FOUND}, {
453 ERRDOS, ERRnoaccess, NT_STATUS_PROCESS_IS_TERMINATING}, {
454 ERRHRD, ERRgeneral, NT_STATUS_INVALID_LOGON_TYPE}, {
455 ERRHRD, ERRgeneral, NT_STATUS_NO_GUID_TRANSLATION}, {
456 ERRHRD, ERRgeneral, NT_STATUS_CANNOT_IMPERSONATE}, {
457 ERRHRD, ERRgeneral, NT_STATUS_IMAGE_ALREADY_LOADED}, {
458 ERRHRD, ERRgeneral, NT_STATUS_ABIOS_NOT_PRESENT}, {
459 ERRHRD, ERRgeneral, NT_STATUS_ABIOS_LID_NOT_EXIST}, {
460 ERRHRD, ERRgeneral, NT_STATUS_ABIOS_LID_ALREADY_OWNED}, {
461 ERRHRD, ERRgeneral, NT_STATUS_ABIOS_NOT_LID_OWNER}, {
462 ERRHRD, ERRgeneral, NT_STATUS_ABIOS_INVALID_COMMAND}, {
463 ERRHRD, ERRgeneral, NT_STATUS_ABIOS_INVALID_LID}, {
464 ERRHRD, ERRgeneral, NT_STATUS_ABIOS_SELECTOR_NOT_AVAILABLE}, {
465 ERRHRD, ERRgeneral, NT_STATUS_ABIOS_INVALID_SELECTOR}, {
466 ERRHRD, ERRgeneral, NT_STATUS_NO_LDT}, {
467 ERRHRD, ERRgeneral, NT_STATUS_INVALID_LDT_SIZE}, {
468 ERRHRD, ERRgeneral, NT_STATUS_INVALID_LDT_OFFSET}, {
469 ERRHRD, ERRgeneral, NT_STATUS_INVALID_LDT_DESCRIPTOR}, {
470 ERRDOS, 193, NT_STATUS_INVALID_IMAGE_NE_FORMAT}, {
471 ERRHRD, ERRgeneral, NT_STATUS_RXACT_INVALID_STATE}, {
472 ERRHRD, ERRgeneral, NT_STATUS_RXACT_COMMIT_FAILURE}, {
473 ERRHRD, ERRgeneral, NT_STATUS_MAPPED_FILE_SIZE_ZERO}, {
474 ERRDOS, ERRnofids, NT_STATUS_TOO_MANY_OPENED_FILES}, {
475 ERRHRD, ERRgeneral, NT_STATUS_CANCELLED}, {
476 ERRDOS, ERRnoaccess, NT_STATUS_CANNOT_DELETE}, {
477 ERRHRD, ERRgeneral, NT_STATUS_INVALID_COMPUTER_NAME}, {
478 ERRDOS, ERRnoaccess, NT_STATUS_FILE_DELETED}, {
479 ERRHRD, ERRgeneral, NT_STATUS_SPECIAL_ACCOUNT}, {
480 ERRHRD, ERRgeneral, NT_STATUS_SPECIAL_GROUP}, {
481 ERRHRD, ERRgeneral, NT_STATUS_SPECIAL_USER}, {
482 ERRHRD, ERRgeneral, NT_STATUS_MEMBERS_PRIMARY_GROUP}, {
483 ERRDOS, ERRbadfid, NT_STATUS_FILE_CLOSED}, {
484 ERRHRD, ERRgeneral, NT_STATUS_TOO_MANY_THREADS}, {
485 ERRHRD, ERRgeneral, NT_STATUS_THREAD_NOT_IN_PROCESS}, {
486 ERRHRD, ERRgeneral, NT_STATUS_TOKEN_ALREADY_IN_USE}, {
487 ERRHRD, ERRgeneral, NT_STATUS_PAGEFILE_QUOTA_EXCEEDED}, {
488 ERRHRD, ERRgeneral, NT_STATUS_COMMITMENT_LIMIT}, {
489 ERRDOS, 193, NT_STATUS_INVALID_IMAGE_LE_FORMAT}, {
490 ERRDOS, 193, NT_STATUS_INVALID_IMAGE_NOT_MZ}, {
491 ERRDOS, 193, NT_STATUS_INVALID_IMAGE_PROTECT}, {
492 ERRDOS, 193, NT_STATUS_INVALID_IMAGE_WIN_16}, {
493 ERRHRD, ERRgeneral, NT_STATUS_LOGON_SERVER_CONFLICT}, {
494 ERRHRD, ERRgeneral, NT_STATUS_TIME_DIFFERENCE_AT_DC}, {
495 ERRHRD, ERRgeneral, NT_STATUS_SYNCHRONIZATION_REQUIRED}, {
496 ERRDOS, 126, NT_STATUS_DLL_NOT_FOUND}, {
497 ERRHRD, ERRgeneral, NT_STATUS_OPEN_FAILED}, {
498 ERRHRD, ERRgeneral, NT_STATUS_IO_PRIVILEGE_FAILED}, {
499 ERRDOS, 182, NT_STATUS_ORDINAL_NOT_FOUND}, {
500 ERRDOS, 127, NT_STATUS_ENTRYPOINT_NOT_FOUND}, {
501 ERRHRD, ERRgeneral, NT_STATUS_CONTROL_C_EXIT}, {
502 ERRDOS, 64, NT_STATUS_LOCAL_DISCONNECT}, {
503 ERRDOS, 64, NT_STATUS_REMOTE_DISCONNECT}, {
504 ERRDOS, 51, NT_STATUS_REMOTE_RESOURCES}, {
505 ERRDOS, 59, NT_STATUS_LINK_FAILED}, {
506 ERRDOS, 59, NT_STATUS_LINK_TIMEOUT}, {
507 ERRDOS, 59, NT_STATUS_INVALID_CONNECTION}, {
508 ERRDOS, 59, NT_STATUS_INVALID_ADDRESS}, {
509 ERRHRD, ERRgeneral, NT_STATUS_DLL_INIT_FAILED}, {
510 ERRHRD, ERRgeneral, NT_STATUS_MISSING_SYSTEMFILE}, {
511 ERRHRD, ERRgeneral, NT_STATUS_UNHANDLED_EXCEPTION}, {
512 ERRHRD, ERRgeneral, NT_STATUS_APP_INIT_FAILURE}, {
513 ERRHRD, ERRgeneral, NT_STATUS_PAGEFILE_CREATE_FAILED}, {
514 ERRHRD, ERRgeneral, NT_STATUS_NO_PAGEFILE}, {
515 ERRDOS, 124, NT_STATUS_INVALID_LEVEL}, {
516 ERRDOS, 86, NT_STATUS_WRONG_PASSWORD_CORE}, {
517 ERRHRD, ERRgeneral, NT_STATUS_ILLEGAL_FLOAT_CONTEXT}, {
518 ERRDOS, 109, NT_STATUS_PIPE_BROKEN}, {
519 ERRHRD, ERRgeneral, NT_STATUS_REGISTRY_CORRUPT}, {
520 ERRHRD, ERRgeneral, NT_STATUS_REGISTRY_IO_FAILED}, {
521 ERRHRD, ERRgeneral, NT_STATUS_NO_EVENT_PAIR}, {
522 ERRHRD, ERRgeneral, NT_STATUS_UNRECOGNIZED_VOLUME}, {
523 ERRHRD, ERRgeneral, NT_STATUS_SERIAL_NO_DEVICE_INITED}, {
524 ERRHRD, ERRgeneral, NT_STATUS_NO_SUCH_ALIAS}, {
525 ERRHRD, ERRgeneral, NT_STATUS_MEMBER_NOT_IN_ALIAS}, {
526 ERRHRD, ERRgeneral, NT_STATUS_MEMBER_IN_ALIAS}, {
527 ERRHRD, ERRgeneral, NT_STATUS_ALIAS_EXISTS}, {
528 ERRHRD, ERRgeneral, NT_STATUS_LOGON_NOT_GRANTED}, {
529 ERRHRD, ERRgeneral, NT_STATUS_TOO_MANY_SECRETS}, {
530 ERRHRD, ERRgeneral, NT_STATUS_SECRET_TOO_LONG}, {
531 ERRHRD, ERRgeneral, NT_STATUS_INTERNAL_DB_ERROR}, {
532 ERRHRD, ERRgeneral, NT_STATUS_FULLSCREEN_MODE}, {
533 ERRHRD, ERRgeneral, NT_STATUS_TOO_MANY_CONTEXT_IDS}, {
534 ERRDOS, ERRnoaccess, NT_STATUS_LOGON_TYPE_NOT_GRANTED}, {
535 ERRHRD, ERRgeneral, NT_STATUS_NOT_REGISTRY_FILE}, {
536 ERRHRD, ERRgeneral, NT_STATUS_NT_CROSS_ENCRYPTION_REQUIRED}, {
537 ERRHRD, ERRgeneral, NT_STATUS_DOMAIN_CTRLR_CONFIG_ERROR}, {
538 ERRHRD, ERRgeneral, NT_STATUS_FT_MISSING_MEMBER}, {
539 ERRHRD, ERRgeneral, NT_STATUS_ILL_FORMED_SERVICE_ENTRY}, {
540 ERRHRD, ERRgeneral, NT_STATUS_ILLEGAL_CHARACTER}, {
541 ERRHRD, ERRgeneral, NT_STATUS_UNMAPPABLE_CHARACTER}, {
542 ERRHRD, ERRgeneral, NT_STATUS_UNDEFINED_CHARACTER}, {
543 ERRHRD, ERRgeneral, NT_STATUS_FLOPPY_VOLUME}, {
544 ERRHRD, ERRgeneral, NT_STATUS_FLOPPY_ID_MARK_NOT_FOUND}, {
545 ERRHRD, ERRgeneral, NT_STATUS_FLOPPY_WRONG_CYLINDER}, {
546 ERRHRD, ERRgeneral, NT_STATUS_FLOPPY_UNKNOWN_ERROR}, {
547 ERRHRD, ERRgeneral, NT_STATUS_FLOPPY_BAD_REGISTERS}, {
548 ERRHRD, ERRgeneral, NT_STATUS_DISK_RECALIBRATE_FAILED}, {
549 ERRHRD, ERRgeneral, NT_STATUS_DISK_OPERATION_FAILED}, {
550 ERRHRD, ERRgeneral, NT_STATUS_DISK_RESET_FAILED}, {
551 ERRHRD, ERRgeneral, NT_STATUS_SHARED_IRQ_BUSY}, {
552 ERRHRD, ERRgeneral, NT_STATUS_FT_ORPHANING}, {
553 ERRHRD, ERRgeneral, 0xc000016e}, {
554 ERRHRD, ERRgeneral, 0xc000016f}, {
555 ERRHRD, ERRgeneral, 0xc0000170}, {
556 ERRHRD, ERRgeneral, 0xc0000171}, {
557 ERRHRD, ERRgeneral, NT_STATUS_PARTITION_FAILURE}, {
558 ERRHRD, ERRgeneral, NT_STATUS_INVALID_BLOCK_LENGTH}, {
559 ERRHRD, ERRgeneral, NT_STATUS_DEVICE_NOT_PARTITIONED}, {
560 ERRHRD, ERRgeneral, NT_STATUS_UNABLE_TO_LOCK_MEDIA}, {
561 ERRHRD, ERRgeneral, NT_STATUS_UNABLE_TO_UNLOAD_MEDIA}, {
562 ERRHRD, ERRgeneral, NT_STATUS_EOM_OVERFLOW}, {
563 ERRHRD, ERRgeneral, NT_STATUS_NO_MEDIA}, {
564 ERRHRD, ERRgeneral, 0xc0000179}, {
565 ERRHRD, ERRgeneral, NT_STATUS_NO_SUCH_MEMBER}, {
566 ERRHRD, ERRgeneral, NT_STATUS_INVALID_MEMBER}, {
567 ERRHRD, ERRgeneral, NT_STATUS_KEY_DELETED}, {
568 ERRHRD, ERRgeneral, NT_STATUS_NO_LOG_SPACE}, {
569 ERRHRD, ERRgeneral, NT_STATUS_TOO_MANY_SIDS}, {
570 ERRHRD, ERRgeneral, NT_STATUS_LM_CROSS_ENCRYPTION_REQUIRED}, {
571 ERRHRD, ERRgeneral, NT_STATUS_KEY_HAS_CHILDREN}, {
572 ERRHRD, ERRgeneral, NT_STATUS_CHILD_MUST_BE_VOLATILE}, {
573 ERRDOS, 87, NT_STATUS_DEVICE_CONFIGURATION_ERROR}, {
574 ERRHRD, ERRgeneral, NT_STATUS_DRIVER_INTERNAL_ERROR}, {
575 ERRDOS, 22, NT_STATUS_INVALID_DEVICE_STATE}, {
576 ERRHRD, ERRgeneral, NT_STATUS_IO_DEVICE_ERROR}, {
577 ERRHRD, ERRgeneral, NT_STATUS_DEVICE_PROTOCOL_ERROR}, {
578 ERRHRD, ERRgeneral, NT_STATUS_BACKUP_CONTROLLER}, {
579 ERRHRD, ERRgeneral, NT_STATUS_LOG_FILE_FULL}, {
580 ERRDOS, 19, NT_STATUS_TOO_LATE}, {
581 ERRDOS, ERRnoaccess, NT_STATUS_NO_TRUST_LSA_SECRET},
582 /* { This NT error code was 'sqashed'
583 from NT_STATUS_NO_TRUST_SAM_ACCOUNT to
584 NT_STATUS_TRUSTED_RELATIONSHIP_FAILURE during the session setup } */
586 ERRDOS, ERRnoaccess, NT_STATUS_NO_TRUST_SAM_ACCOUNT}, {
587 ERRDOS, ERRnoaccess, NT_STATUS_TRUSTED_DOMAIN_FAILURE}, {
588 ERRDOS, ERRnoaccess, NT_STATUS_TRUSTED_RELATIONSHIP_FAILURE}, {
589 ERRHRD, ERRgeneral, NT_STATUS_EVENTLOG_FILE_CORRUPT}, {
590 ERRHRD, ERRgeneral, NT_STATUS_EVENTLOG_CANT_START}, {
591 ERRDOS, ERRnoaccess, NT_STATUS_TRUST_FAILURE}, {
592 ERRHRD, ERRgeneral, NT_STATUS_MUTANT_LIMIT_EXCEEDED}, {
593 ERRDOS, ERRnetlogonNotStarted, NT_STATUS_NETLOGON_NOT_STARTED}, {
594 ERRSRV, ERRaccountexpired, NT_STATUS_ACCOUNT_EXPIRED}, {
595 ERRHRD, ERRgeneral, NT_STATUS_POSSIBLE_DEADLOCK}, {
596 ERRHRD, ERRgeneral, NT_STATUS_NETWORK_CREDENTIAL_CONFLICT}, {
597 ERRHRD, ERRgeneral, NT_STATUS_REMOTE_SESSION_LIMIT}, {
598 ERRHRD, ERRgeneral, NT_STATUS_EVENTLOG_FILE_CHANGED}, {
599 ERRDOS, ERRnoaccess, NT_STATUS_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT}, {
600 ERRDOS, ERRnoaccess, NT_STATUS_NOLOGON_WORKSTATION_TRUST_ACCOUNT}, {
601 ERRDOS, ERRnoaccess, NT_STATUS_NOLOGON_SERVER_TRUST_ACCOUNT},
602 /* { This NT error code was 'sqashed'
603 from NT_STATUS_DOMAIN_TRUST_INCONSISTENT to NT_STATUS_LOGON_FAILURE
604 during the session setup } */
606 ERRDOS, ERRnoaccess, NT_STATUS_DOMAIN_TRUST_INCONSISTENT}, {
607 ERRHRD, ERRgeneral, NT_STATUS_FS_DRIVER_REQUIRED}, {
608 ERRHRD, ERRgeneral, NT_STATUS_NO_USER_SESSION_KEY}, {
609 ERRDOS, 59, NT_STATUS_USER_SESSION_DELETED}, {
610 ERRHRD, ERRgeneral, NT_STATUS_RESOURCE_LANG_NOT_FOUND}, {
611 ERRDOS, ERRnomem, NT_STATUS_INSUFF_SERVER_RESOURCES}, {
612 ERRHRD, ERRgeneral, NT_STATUS_INVALID_BUFFER_SIZE}, {
613 ERRHRD, ERRgeneral, NT_STATUS_INVALID_ADDRESS_COMPONENT}, {
614 ERRHRD, ERRgeneral, NT_STATUS_INVALID_ADDRESS_WILDCARD}, {
615 ERRDOS, 68, NT_STATUS_TOO_MANY_ADDRESSES}, {
616 ERRDOS, 52, NT_STATUS_ADDRESS_ALREADY_EXISTS}, {
617 ERRDOS, 64, NT_STATUS_ADDRESS_CLOSED}, {
618 ERRDOS, 64, NT_STATUS_CONNECTION_DISCONNECTED}, {
619 ERRDOS, 64, NT_STATUS_CONNECTION_RESET}, {
620 ERRDOS, 68, NT_STATUS_TOO_MANY_NODES}, {
621 ERRDOS, 59, NT_STATUS_TRANSACTION_ABORTED}, {
622 ERRDOS, 59, NT_STATUS_TRANSACTION_TIMED_OUT}, {
623 ERRDOS, 59, NT_STATUS_TRANSACTION_NO_RELEASE}, {
624 ERRDOS, 59, NT_STATUS_TRANSACTION_NO_MATCH}, {
625 ERRDOS, 59, NT_STATUS_TRANSACTION_RESPONDED}, {
626 ERRDOS, 59, NT_STATUS_TRANSACTION_INVALID_ID}, {
627 ERRDOS, 59, NT_STATUS_TRANSACTION_INVALID_TYPE}, {
628 ERRDOS, ERRunsup, NT_STATUS_NOT_SERVER_SESSION}, {
629 ERRDOS, ERRunsup, NT_STATUS_NOT_CLIENT_SESSION}, {
630 ERRHRD, ERRgeneral, NT_STATUS_CANNOT_LOAD_REGISTRY_FILE}, {
631 ERRHRD, ERRgeneral, NT_STATUS_DEBUG_ATTACH_FAILED}, {
632 ERRHRD, ERRgeneral, NT_STATUS_SYSTEM_PROCESS_TERMINATED}, {
633 ERRHRD, ERRgeneral, NT_STATUS_DATA_NOT_ACCEPTED}, {
634 ERRHRD, ERRgeneral, NT_STATUS_NO_BROWSER_SERVERS_FOUND}, {
635 ERRHRD, ERRgeneral, NT_STATUS_VDM_HARD_ERROR}, {
636 ERRHRD, ERRgeneral, NT_STATUS_DRIVER_CANCEL_TIMEOUT}, {
637 ERRHRD, ERRgeneral, NT_STATUS_REPLY_MESSAGE_MISMATCH}, {
638 ERRHRD, ERRgeneral, NT_STATUS_MAPPED_ALIGNMENT}, {
639 ERRDOS, 193, NT_STATUS_IMAGE_CHECKSUM_MISMATCH}, {
640 ERRHRD, ERRgeneral, NT_STATUS_LOST_WRITEBEHIND_DATA}, {
641 ERRHRD, ERRgeneral, NT_STATUS_CLIENT_SERVER_PARAMETERS_INVALID}, {
642 ERRSRV, ERRpasswordExpired, NT_STATUS_PASSWORD_MUST_CHANGE}, {
643 ERRHRD, ERRgeneral, NT_STATUS_NOT_FOUND}, {
644 ERRHRD, ERRgeneral, NT_STATUS_NOT_TINY_STREAM}, {
645 ERRHRD, ERRgeneral, NT_STATUS_RECOVERY_FAILURE}, {
646 ERRHRD, ERRgeneral, NT_STATUS_STACK_OVERFLOW_READ}, {
647 ERRHRD, ERRgeneral, NT_STATUS_FAIL_CHECK}, {
648 ERRHRD, ERRgeneral, NT_STATUS_DUPLICATE_OBJECTID}, {
649 ERRHRD, ERRgeneral, NT_STATUS_OBJECTID_EXISTS}, {
650 ERRHRD, ERRgeneral, NT_STATUS_CONVERT_TO_LARGE}, {
651 ERRHRD, ERRgeneral, NT_STATUS_RETRY}, {
652 ERRHRD, ERRgeneral, NT_STATUS_FOUND_OUT_OF_SCOPE}, {
653 ERRHRD, ERRgeneral, NT_STATUS_ALLOCATE_BUCKET}, {
654 ERRHRD, ERRgeneral, NT_STATUS_PROPSET_NOT_FOUND}, {
655 ERRHRD, ERRgeneral, NT_STATUS_MARSHALL_OVERFLOW}, {
656 ERRHRD, ERRgeneral, NT_STATUS_INVALID_VARIANT}, {
657 ERRHRD, ERRgeneral, NT_STATUS_DOMAIN_CONTROLLER_NOT_FOUND}, {
658 ERRDOS, ERRnoaccess, NT_STATUS_ACCOUNT_LOCKED_OUT}, {
659 ERRDOS, ERRbadfid, NT_STATUS_HANDLE_NOT_CLOSABLE}, {
660 ERRHRD, ERRgeneral, NT_STATUS_CONNECTION_REFUSED}, {
661 ERRHRD, ERRgeneral, NT_STATUS_GRACEFUL_DISCONNECT}, {
662 ERRHRD, ERRgeneral, NT_STATUS_ADDRESS_ALREADY_ASSOCIATED}, {
663 ERRHRD, ERRgeneral, NT_STATUS_ADDRESS_NOT_ASSOCIATED}, {
664 ERRHRD, ERRgeneral, NT_STATUS_CONNECTION_INVALID}, {
665 ERRHRD, ERRgeneral, NT_STATUS_CONNECTION_ACTIVE}, {
666 ERRHRD, ERRgeneral, NT_STATUS_NETWORK_UNREACHABLE}, {
667 ERRHRD, ERRgeneral, NT_STATUS_HOST_UNREACHABLE}, {
668 ERRHRD, ERRgeneral, NT_STATUS_PROTOCOL_UNREACHABLE}, {
669 ERRHRD, ERRgeneral, NT_STATUS_PORT_UNREACHABLE}, {
670 ERRHRD, ERRgeneral, NT_STATUS_REQUEST_ABORTED}, {
671 ERRHRD, ERRgeneral, NT_STATUS_CONNECTION_ABORTED}, {
672 ERRHRD, ERRgeneral, NT_STATUS_BAD_COMPRESSION_BUFFER}, {
673 ERRHRD, ERRgeneral, NT_STATUS_USER_MAPPED_FILE}, {
674 ERRHRD, ERRgeneral, NT_STATUS_AUDIT_FAILED}, {
675 ERRHRD, ERRgeneral, NT_STATUS_TIMER_RESOLUTION_NOT_SET}, {
676 ERRHRD, ERRgeneral, NT_STATUS_CONNECTION_COUNT_LIMIT}, {
677 ERRHRD, ERRgeneral, NT_STATUS_LOGIN_TIME_RESTRICTION}, {
678 ERRHRD, ERRgeneral, NT_STATUS_LOGIN_WKSTA_RESTRICTION}, {
679 ERRDOS, 193, NT_STATUS_IMAGE_MP_UP_MISMATCH}, {
680 ERRHRD, ERRgeneral, 0xc000024a}, {
681 ERRHRD, ERRgeneral, 0xc000024b}, {
682 ERRHRD, ERRgeneral, 0xc000024c}, {
683 ERRHRD, ERRgeneral, 0xc000024d}, {
684 ERRHRD, ERRgeneral, 0xc000024e}, {
685 ERRHRD, ERRgeneral, 0xc000024f}, {
686 ERRHRD, ERRgeneral, NT_STATUS_INSUFFICIENT_LOGON_INFO}, {
687 ERRHRD, ERRgeneral, NT_STATUS_BAD_DLL_ENTRYPOINT}, {
688 ERRHRD, ERRgeneral, NT_STATUS_BAD_SERVICE_ENTRYPOINT}, {
689 ERRHRD, ERRgeneral, NT_STATUS_LPC_REPLY_LOST}, {
690 ERRHRD, ERRgeneral, NT_STATUS_IP_ADDRESS_CONFLICT1}, {
691 ERRHRD, ERRgeneral, NT_STATUS_IP_ADDRESS_CONFLICT2}, {
692 ERRHRD, ERRgeneral, NT_STATUS_REGISTRY_QUOTA_LIMIT}, {
693 ERRSRV, 3, NT_STATUS_PATH_NOT_COVERED}, {
694 ERRHRD, ERRgeneral, NT_STATUS_NO_CALLBACK_ACTIVE}, {
695 ERRHRD, ERRgeneral, NT_STATUS_LICENSE_QUOTA_EXCEEDED}, {
696 ERRHRD, ERRgeneral, NT_STATUS_PWD_TOO_SHORT}, {
697 ERRHRD, ERRgeneral, NT_STATUS_PWD_TOO_RECENT}, {
698 ERRHRD, ERRgeneral, NT_STATUS_PWD_HISTORY_CONFLICT}, {
699 ERRHRD, ERRgeneral, 0xc000025d}, {
700 ERRHRD, ERRgeneral, NT_STATUS_PLUGPLAY_NO_DEVICE}, {
701 ERRHRD, ERRgeneral, NT_STATUS_UNSUPPORTED_COMPRESSION}, {
702 ERRHRD, ERRgeneral, NT_STATUS_INVALID_HW_PROFILE}, {
703 ERRHRD, ERRgeneral, NT_STATUS_INVALID_PLUGPLAY_DEVICE_PATH}, {
704 ERRDOS, 182, NT_STATUS_DRIVER_ORDINAL_NOT_FOUND}, {
705 ERRDOS, 127, NT_STATUS_DRIVER_ENTRYPOINT_NOT_FOUND}, {
706 ERRDOS, 288, NT_STATUS_RESOURCE_NOT_OWNED}, {
707 ERRDOS, ErrTooManyLinks, NT_STATUS_TOO_MANY_LINKS}, {
708 ERRHRD, ERRgeneral, NT_STATUS_QUOTA_LIST_INCONSISTENT}, {
709 ERRHRD, ERRgeneral, NT_STATUS_FILE_IS_OFFLINE}, {
710 ERRDOS, 21, 0xc000026e}, {
711 ERRDOS, 161, 0xc0000281}, {
712 ERRDOS, ERRnoaccess, 0xc000028a}, {
713 ERRDOS, ERRnoaccess, 0xc000028b}, {
714 ERRHRD, ERRgeneral, 0xc000028c}, {
715 ERRDOS, ERRnoaccess, 0xc000028d}, {
716 ERRDOS, ERRnoaccess, 0xc000028e}, {
717 ERRDOS, ERRnoaccess, 0xc000028f}, {
718 ERRDOS, ERRnoaccess, 0xc0000290}, {
719 ERRDOS, ERRbadfunc, 0xc000029c}, {
720 ERRDOS, ERRinvlevel, 0x007c0001}, };
722 /*****************************************************************************
723 Print an error message from the status code
724 *****************************************************************************/
725 static void
726 cifs_print_status(__u32 status_code)
728 int idx = 0;
730 while (nt_errs[idx].nt_errstr != NULL) {
731 if (((nt_errs[idx].nt_errcode) & 0xFFFFFF) ==
732 (status_code & 0xFFFFFF)) {
733 printk(KERN_NOTICE "Status code returned 0x%08x %s\n",
734 status_code, nt_errs[idx].nt_errstr);
736 idx++;
738 return;
742 static void
743 ntstatus_to_dos(__u32 ntstatus, __u8 * eclass, __u16 * ecode)
745 int i;
746 if (ntstatus == 0) {
747 *eclass = 0;
748 *ecode = 0;
749 return;
751 for (i = 0; ntstatus_to_dos_map[i].ntstatus; i++) {
752 if (ntstatus == ntstatus_to_dos_map[i].ntstatus) {
753 *eclass = ntstatus_to_dos_map[i].dos_class;
754 *ecode = ntstatus_to_dos_map[i].dos_code;
755 return;
758 *eclass = ERRHRD;
759 *ecode = ERRgeneral;
763 map_smb_to_linux_error(struct smb_hdr *smb, int logErr)
765 unsigned int i;
766 int rc = -EIO; /* if transport error smb error may not be set */
767 __u8 smberrclass;
768 __u16 smberrcode;
770 /* BB if NT Status codes - map NT BB */
772 /* old style smb error codes */
773 if (smb->Status.CifsError == 0)
774 return 0;
776 if (smb->Flags2 & SMBFLG2_ERR_STATUS) {
777 /* translate the newer STATUS codes to old style SMB errors
778 * and then to POSIX errors */
779 __u32 err = le32_to_cpu(smb->Status.CifsError);
780 if (logErr && (err != (NT_STATUS_MORE_PROCESSING_REQUIRED)))
781 cifs_print_status(err);
782 else if (cifsFYI & CIFS_RC)
783 cifs_print_status(err);
784 ntstatus_to_dos(err, &smberrclass, &smberrcode);
785 } else {
786 smberrclass = smb->Status.DosError.ErrorClass;
787 smberrcode = le16_to_cpu(smb->Status.DosError.Error);
790 /* old style errors */
792 /* DOS class smb error codes - map DOS */
793 if (smberrclass == ERRDOS) { /* 1 byte field no need to byte reverse */
794 for (i = 0;
796 sizeof (mapping_table_ERRDOS) /
797 sizeof (struct smb_to_posix_error); i++) {
798 if (mapping_table_ERRDOS[i].smb_err == 0)
799 break;
800 else if (mapping_table_ERRDOS[i].smb_err ==
801 smberrcode) {
802 rc = mapping_table_ERRDOS[i].posix_code;
803 break;
805 /* else try next error mapping one to see if match */
807 } else if (smberrclass == ERRSRV) { /* server class of error codes */
808 for (i = 0;
810 sizeof (mapping_table_ERRSRV) /
811 sizeof (struct smb_to_posix_error); i++) {
812 if (mapping_table_ERRSRV[i].smb_err == 0)
813 break;
814 else if (mapping_table_ERRSRV[i].smb_err ==
815 smberrcode) {
816 rc = mapping_table_ERRSRV[i].posix_code;
817 break;
819 /* else try next error mapping to see if match */
822 /* else ERRHRD class errors or junk - return EIO */
824 cFYI(1, ("Mapping smb error code %d to POSIX err %d",
825 smberrcode, rc));
827 /* generic corrective action e.g. reconnect SMB session on
828 * ERRbaduid could be added */
830 return rc;
834 * calculate the size of the SMB message based on the fixed header
835 * portion, the number of word parameters and the data portion of the message
837 unsigned int
838 smbCalcSize(struct smb_hdr *ptr)
840 return (sizeof (struct smb_hdr) + (2 * ptr->WordCount) +
841 2 /* size of the bcc field */ + BCC(ptr));
844 unsigned int
845 smbCalcSize_LE(struct smb_hdr *ptr)
847 return (sizeof (struct smb_hdr) + (2 * ptr->WordCount) +
848 2 /* size of the bcc field */ + le16_to_cpu(BCC_LE(ptr)));
851 /* The following are taken from fs/ntfs/util.c */
853 #define NTFS_TIME_OFFSET ((u64)(369*365 + 89) * 24 * 3600 * 10000000)
856 * Convert the NT UTC (based 1601-01-01, in hundred nanosecond units)
857 * into Unix UTC (based 1970-01-01, in seconds).
859 struct timespec
860 cifs_NTtimeToUnix(u64 ntutc)
862 struct timespec ts;
863 /* BB what about the timezone? BB */
865 /* Subtract the NTFS time offset, then convert to 1s intervals. */
866 u64 t;
868 t = ntutc - NTFS_TIME_OFFSET;
869 ts.tv_nsec = do_div(t, 10000000) * 100;
870 ts.tv_sec = t;
871 return ts;
874 /* Convert the Unix UTC into NT UTC. */
876 cifs_UnixTimeToNT(struct timespec t)
878 /* Convert to 100ns intervals and then add the NTFS time offset. */
879 return (u64) t.tv_sec * 10000000 + t.tv_nsec/100 + NTFS_TIME_OFFSET;
882 static int total_days_of_prev_months[] =
883 {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334};
886 __le64 cnvrtDosCifsTm(__u16 date, __u16 time)
888 return cpu_to_le64(cifs_UnixTimeToNT(cnvrtDosUnixTm(date, time)));
891 struct timespec cnvrtDosUnixTm(__u16 date, __u16 time)
893 struct timespec ts;
894 int sec, min, days, month, year;
895 SMB_TIME * st = (SMB_TIME *)&time;
896 SMB_DATE * sd = (SMB_DATE *)&date;
898 cFYI(1, ("date %d time %d", date, time));
900 sec = 2 * st->TwoSeconds;
901 min = st->Minutes;
902 if ((sec > 59) || (min > 59))
903 cERROR(1, ("illegal time min %d sec %d", min, sec));
904 sec += (min * 60);
905 sec += 60 * 60 * st->Hours;
906 if (st->Hours > 24)
907 cERROR(1, ("illegal hours %d", st->Hours));
908 days = sd->Day;
909 month = sd->Month;
910 if ((days > 31) || (month > 12)) {
911 cERROR(1, ("illegal date, month %d day: %d", month, days));
912 if (month > 12)
913 month = 12;
915 month -= 1;
916 days += total_days_of_prev_months[month];
917 days += 3652; /* account for difference in days between 1980 and 1970 */
918 year = sd->Year;
919 days += year * 365;
920 days += (year/4); /* leap year */
921 /* generalized leap year calculation is more complex, ie no leap year
922 for years/100 except for years/400, but since the maximum number for DOS
923 year is 2**7, the last year is 1980+127, which means we need only
924 consider 2 special case years, ie the years 2000 and 2100, and only
925 adjust for the lack of leap year for the year 2100, as 2000 was a
926 leap year (divisable by 400) */
927 if (year >= 120) /* the year 2100 */
928 days = days - 1; /* do not count leap year for the year 2100 */
930 /* adjust for leap year where we are still before leap day */
931 if (year != 120)
932 days -= ((year & 0x03) == 0) && (month < 2 ? 1 : 0);
933 sec += 24 * 60 * 60 * days;
935 ts.tv_sec = sec;
937 /* cFYI(1,("sec after cnvrt dos to unix time %d",sec)); */
939 ts.tv_nsec = 0;
940 return ts;