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