Thomas Gleixner | 1a59d1b8 | 2019-05-27 08:55:05 +0200 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0-or-later |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3 | * |
Steve French | ad7a292 | 2008-02-07 23:25:02 +0000 | [diff] [blame] | 4 | * Copyright (c) International Business Machines Corp., 2002,2008 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5 | * Author(s): Steve French (sfrench@us.ibm.com) |
Steve French | 3870253 | 2007-07-08 15:40:40 +0000 | [diff] [blame] | 6 | * |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7 | * Error mapping routines from Samba libsmb/errormap.c |
| 8 | * Copyright (C) Andrew Tridgell 2001 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 9 | */ |
| 10 | |
| 11 | #include <linux/net.h> |
| 12 | #include <linux/string.h> |
| 13 | #include <linux/in.h> |
| 14 | #include <linux/ctype.h> |
| 15 | #include <linux/fs.h> |
| 16 | #include <asm/div64.h> |
| 17 | #include <asm/byteorder.h> |
Steve French | 5858ae4 | 2007-04-25 11:59:10 +0000 | [diff] [blame] | 18 | #include <linux/inet.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19 | #include "cifsfs.h" |
| 20 | #include "cifspdu.h" |
| 21 | #include "cifsglob.h" |
| 22 | #include "cifsproto.h" |
| 23 | #include "smberr.h" |
| 24 | #include "cifs_debug.h" |
| 25 | #include "nterr.h" |
| 26 | |
| 27 | struct smb_to_posix_error { |
| 28 | __u16 smb_err; |
| 29 | int posix_code; |
| 30 | }; |
| 31 | |
| 32 | static const struct smb_to_posix_error mapping_table_ERRDOS[] = { |
| 33 | {ERRbadfunc, -EINVAL}, |
| 34 | {ERRbadfile, -ENOENT}, |
| 35 | {ERRbadpath, -ENOTDIR}, |
| 36 | {ERRnofids, -EMFILE}, |
| 37 | {ERRnoaccess, -EACCES}, |
| 38 | {ERRbadfid, -EBADF}, |
| 39 | {ERRbadmcb, -EIO}, |
Jeff Layton | cce0244 | 2013-11-07 15:02:35 -0500 | [diff] [blame] | 40 | {ERRnomem, -EREMOTEIO}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 41 | {ERRbadmem, -EFAULT}, |
| 42 | {ERRbadenv, -EFAULT}, |
| 43 | {ERRbadformat, -EINVAL}, |
| 44 | {ERRbadaccess, -EACCES}, |
| 45 | {ERRbaddata, -EIO}, |
| 46 | {ERRbaddrive, -ENXIO}, |
| 47 | {ERRremcd, -EACCES}, |
| 48 | {ERRdiffdevice, -EXDEV}, |
| 49 | {ERRnofiles, -ENOENT}, |
Jeff Layton | 3572d28 | 2010-07-26 10:29:57 -0400 | [diff] [blame] | 50 | {ERRwriteprot, -EROFS}, |
Sachin Prabhu | 47c78f4 | 2013-03-11 13:08:49 +0000 | [diff] [blame] | 51 | {ERRbadshare, -EBUSY}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 52 | {ERRlock, -EACCES}, |
| 53 | {ERRunsup, -EINVAL}, |
Steve French | 3870253 | 2007-07-08 15:40:40 +0000 | [diff] [blame] | 54 | {ERRnosuchshare, -ENXIO}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 55 | {ERRfilexists, -EEXIST}, |
| 56 | {ERRinvparm, -EINVAL}, |
| 57 | {ERRdiskfull, -ENOSPC}, |
| 58 | {ERRinvname, -ENOENT}, |
Steve French | 3870253 | 2007-07-08 15:40:40 +0000 | [diff] [blame] | 59 | {ERRinvlevel, -EOPNOTSUPP}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 60 | {ERRdirnotempty, -ENOTEMPTY}, |
| 61 | {ERRnotlocked, -ENOLCK}, |
Jeremy Allison | 7ee1af7 | 2006-08-02 21:56:33 +0000 | [diff] [blame] | 62 | {ERRcancelviolation, -ENOLCK}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 63 | {ERRalreadyexists, -EEXIST}, |
| 64 | {ERRmoredata, -EOVERFLOW}, |
Steve French | 3870253 | 2007-07-08 15:40:40 +0000 | [diff] [blame] | 65 | {ERReasnotsupported, -EOPNOTSUPP}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 66 | {ErrQuota, -EDQUOT}, |
| 67 | {ErrNotALink, -ENOLINK}, |
Steve French | 3870253 | 2007-07-08 15:40:40 +0000 | [diff] [blame] | 68 | {ERRnetlogonNotStarted, -ENOPROTOOPT}, |
Steve French | 9e39b0a | 2009-04-30 21:31:15 +0000 | [diff] [blame] | 69 | {ERRsymlink, -EOPNOTSUPP}, |
Steve French | 3870253 | 2007-07-08 15:40:40 +0000 | [diff] [blame] | 70 | {ErrTooManyLinks, -EMLINK}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 71 | {0, 0} |
| 72 | }; |
| 73 | |
| 74 | static const struct smb_to_posix_error mapping_table_ERRSRV[] = { |
| 75 | {ERRerror, -EIO}, |
Steve French | 7c7b25b | 2006-06-01 19:20:10 +0000 | [diff] [blame] | 76 | {ERRbadpw, -EACCES}, /* was EPERM */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 77 | {ERRbadtype, -EREMOTE}, |
| 78 | {ERRaccess, -EACCES}, |
| 79 | {ERRinvtid, -ENXIO}, |
Steve French | 43411d6 | 2006-06-02 18:17:11 +0000 | [diff] [blame] | 80 | {ERRinvnetname, -ENXIO}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 81 | {ERRinvdevice, -ENXIO}, |
| 82 | {ERRqfull, -ENOSPC}, |
| 83 | {ERRqtoobig, -ENOSPC}, |
| 84 | {ERRqeof, -EIO}, |
| 85 | {ERRinvpfid, -EBADF}, |
| 86 | {ERRsmbcmd, -EBADRQC}, |
| 87 | {ERRsrverror, -EIO}, |
| 88 | {ERRbadBID, -EIO}, |
| 89 | {ERRfilespecs, -EINVAL}, |
| 90 | {ERRbadLink, -EIO}, |
| 91 | {ERRbadpermits, -EINVAL}, |
| 92 | {ERRbadPID, -ESRCH}, |
| 93 | {ERRsetattrmode, -EINVAL}, |
| 94 | {ERRpaused, -EHOSTDOWN}, |
| 95 | {ERRmsgoff, -EHOSTDOWN}, |
| 96 | {ERRnoroom, -ENOSPC}, |
| 97 | {ERRrmuns, -EUSERS}, |
| 98 | {ERRtimeout, -ETIME}, |
Jeff Layton | 4f2b86a | 2012-09-24 09:33:40 -0400 | [diff] [blame] | 99 | {ERRnoresource, -EREMOTEIO}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 100 | {ERRtoomanyuids, -EUSERS}, |
| 101 | {ERRbaduid, -EACCES}, |
| 102 | {ERRusempx, -EIO}, |
| 103 | {ERRusestd, -EIO}, |
| 104 | {ERR_NOTIFY_ENUM_DIR, -ENOBUFS}, |
Steve French | a761ac5 | 2007-10-18 21:45:27 +0000 | [diff] [blame] | 105 | {ERRnoSuchUser, -EACCES}, |
| 106 | /* {ERRaccountexpired, -EACCES}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 107 | {ERRbadclient, -EACCES}, |
| 108 | {ERRbadLogonTime, -EACCES}, |
Steve French | a761ac5 | 2007-10-18 21:45:27 +0000 | [diff] [blame] | 109 | {ERRpasswordExpired, -EACCES},*/ |
| 110 | {ERRaccountexpired, -EKEYEXPIRED}, |
| 111 | {ERRbadclient, -EACCES}, |
| 112 | {ERRbadLogonTime, -EACCES}, |
| 113 | {ERRpasswordExpired, -EKEYEXPIRED}, |
| 114 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 115 | {ERRnosupport, -EINVAL}, |
| 116 | {0, 0} |
| 117 | }; |
| 118 | |
Jeff Layton | 1e68b2b | 2009-06-11 10:27:30 -0400 | [diff] [blame] | 119 | /* |
| 120 | * Convert a string containing text IPv4 or IPv6 address to binary form. |
| 121 | * |
| 122 | * Returns 0 on failure. |
| 123 | */ |
| 124 | static int |
David Howells | 67b7626 | 2010-07-22 18:33:01 +0100 | [diff] [blame] | 125 | cifs_inet_pton(const int address_family, const char *cp, int len, void *dst) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 126 | { |
Steve French | 5858ae4 | 2007-04-25 11:59:10 +0000 | [diff] [blame] | 127 | int ret = 0; |
| 128 | |
| 129 | /* calculate length by finding first slash or NULL */ |
Steve French | 582d21e | 2008-05-13 04:54:12 +0000 | [diff] [blame] | 130 | if (address_family == AF_INET) |
David Howells | 67b7626 | 2010-07-22 18:33:01 +0100 | [diff] [blame] | 131 | ret = in4_pton(cp, len, dst, '\\', NULL); |
Steve French | 582d21e | 2008-05-13 04:54:12 +0000 | [diff] [blame] | 132 | else if (address_family == AF_INET6) |
David Howells | 67b7626 | 2010-07-22 18:33:01 +0100 | [diff] [blame] | 133 | ret = in6_pton(cp, len, dst , '\\', NULL); |
Steve French | 582d21e | 2008-05-13 04:54:12 +0000 | [diff] [blame] | 134 | |
Joe Perches | f96637b | 2013-05-04 22:12:25 -0500 | [diff] [blame] | 135 | cifs_dbg(NOISY, "address conversion returned %d for %*.*s\n", |
| 136 | ret, len, len, cp); |
Steve French | 5858ae4 | 2007-04-25 11:59:10 +0000 | [diff] [blame] | 137 | if (ret > 0) |
| 138 | ret = 1; |
| 139 | return ret; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 140 | } |
| 141 | |
Jeff Layton | 1e68b2b | 2009-06-11 10:27:30 -0400 | [diff] [blame] | 142 | /* |
| 143 | * Try to convert a string to an IPv4 address and then attempt to convert |
| 144 | * it to an IPv6 address if that fails. Set the family field if either |
Jeff Layton | 681bf72 | 2009-06-11 10:27:31 -0400 | [diff] [blame] | 145 | * succeeds. If it's an IPv6 address and it has a '%' sign in it, try to |
| 146 | * treat the part following it as a numeric sin6_scope_id. |
Jeff Layton | 1e68b2b | 2009-06-11 10:27:30 -0400 | [diff] [blame] | 147 | * |
| 148 | * Returns 0 on failure. |
| 149 | */ |
| 150 | int |
David Howells | 67b7626 | 2010-07-22 18:33:01 +0100 | [diff] [blame] | 151 | cifs_convert_address(struct sockaddr *dst, const char *src, int len) |
Jeff Layton | 1e68b2b | 2009-06-11 10:27:30 -0400 | [diff] [blame] | 152 | { |
David Howells | 67b7626 | 2010-07-22 18:33:01 +0100 | [diff] [blame] | 153 | int rc, alen, slen; |
| 154 | const char *pct; |
Jeff Layton | 9616125 | 2011-02-16 09:34:16 -0500 | [diff] [blame] | 155 | char scope_id[13]; |
Jeff Layton | 1e68b2b | 2009-06-11 10:27:30 -0400 | [diff] [blame] | 156 | struct sockaddr_in *s4 = (struct sockaddr_in *) dst; |
Steve French | 361ea1a | 2009-06-15 13:46:12 +0000 | [diff] [blame] | 157 | struct sockaddr_in6 *s6 = (struct sockaddr_in6 *) dst; |
Jeff Layton | 1e68b2b | 2009-06-11 10:27:30 -0400 | [diff] [blame] | 158 | |
Jeff Layton | 681bf72 | 2009-06-11 10:27:31 -0400 | [diff] [blame] | 159 | /* IPv4 address */ |
David Howells | 67b7626 | 2010-07-22 18:33:01 +0100 | [diff] [blame] | 160 | if (cifs_inet_pton(AF_INET, src, len, &s4->sin_addr.s_addr)) { |
Jeff Layton | 1e68b2b | 2009-06-11 10:27:30 -0400 | [diff] [blame] | 161 | s4->sin_family = AF_INET; |
| 162 | return 1; |
Jeff Layton | 1e68b2b | 2009-06-11 10:27:30 -0400 | [diff] [blame] | 163 | } |
| 164 | |
David Howells | 67b7626 | 2010-07-22 18:33:01 +0100 | [diff] [blame] | 165 | /* attempt to exclude the scope ID from the address part */ |
| 166 | pct = memchr(src, '%', len); |
| 167 | alen = pct ? pct - src : len; |
Jeff Layton | 681bf72 | 2009-06-11 10:27:31 -0400 | [diff] [blame] | 168 | |
David Howells | 67b7626 | 2010-07-22 18:33:01 +0100 | [diff] [blame] | 169 | rc = cifs_inet_pton(AF_INET6, src, alen, &s6->sin6_addr.s6_addr); |
Jeff Layton | 681bf72 | 2009-06-11 10:27:31 -0400 | [diff] [blame] | 170 | if (!rc) |
| 171 | return rc; |
| 172 | |
| 173 | s6->sin6_family = AF_INET6; |
| 174 | if (pct) { |
David Howells | 67b7626 | 2010-07-22 18:33:01 +0100 | [diff] [blame] | 175 | /* grab the scope ID */ |
| 176 | slen = len - (alen + 1); |
| 177 | if (slen <= 0 || slen > 12) |
| 178 | return 0; |
| 179 | memcpy(scope_id, pct + 1, slen); |
| 180 | scope_id[slen] = '\0'; |
| 181 | |
Dan Carpenter | 2545e07 | 2012-03-01 10:06:52 +0300 | [diff] [blame] | 182 | rc = kstrtouint(scope_id, 0, &s6->sin6_scope_id); |
Jeff Layton | 9616125 | 2011-02-16 09:34:16 -0500 | [diff] [blame] | 183 | rc = (rc == 0) ? 1 : 0; |
Jeff Layton | 681bf72 | 2009-06-11 10:27:31 -0400 | [diff] [blame] | 184 | } |
| 185 | |
| 186 | return rc; |
Jeff Layton | 1e68b2b | 2009-06-11 10:27:30 -0400 | [diff] [blame] | 187 | } |
| 188 | |
Jeff Layton | b979aaa | 2012-11-26 11:09:55 -0500 | [diff] [blame] | 189 | void |
Jeff Layton | 3267039 | 2010-09-03 12:00:50 -0400 | [diff] [blame] | 190 | cifs_set_port(struct sockaddr *addr, const unsigned short int port) |
| 191 | { |
| 192 | switch (addr->sa_family) { |
| 193 | case AF_INET: |
| 194 | ((struct sockaddr_in *)addr)->sin_port = htons(port); |
| 195 | break; |
| 196 | case AF_INET6: |
| 197 | ((struct sockaddr_in6 *)addr)->sin6_port = htons(port); |
| 198 | break; |
Jeff Layton | 3267039 | 2010-09-03 12:00:50 -0400 | [diff] [blame] | 199 | } |
Jeff Layton | 50d9716 | 2010-07-06 20:43:01 -0400 | [diff] [blame] | 200 | } |
| 201 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 202 | /***************************************************************************** |
| 203 | convert a NT status code to a dos class/code |
| 204 | *****************************************************************************/ |
| 205 | /* NT status -> dos error map */ |
| 206 | static const struct { |
| 207 | __u8 dos_class; |
| 208 | __u16 dos_code; |
| 209 | __u32 ntstatus; |
| 210 | } ntstatus_to_dos_map[] = { |
| 211 | { |
| 212 | ERRDOS, ERRgeneral, NT_STATUS_UNSUCCESSFUL}, { |
| 213 | ERRDOS, ERRbadfunc, NT_STATUS_NOT_IMPLEMENTED}, { |
Steve French | 75cf6bd | 2005-04-28 22:41:04 -0700 | [diff] [blame] | 214 | ERRDOS, ERRinvlevel, NT_STATUS_INVALID_INFO_CLASS}, { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 215 | ERRDOS, 24, NT_STATUS_INFO_LENGTH_MISMATCH}, { |
| 216 | ERRHRD, ERRgeneral, NT_STATUS_ACCESS_VIOLATION}, { |
| 217 | ERRHRD, ERRgeneral, NT_STATUS_IN_PAGE_ERROR}, { |
| 218 | ERRHRD, ERRgeneral, NT_STATUS_PAGEFILE_QUOTA}, { |
| 219 | ERRDOS, ERRbadfid, NT_STATUS_INVALID_HANDLE}, { |
| 220 | ERRHRD, ERRgeneral, NT_STATUS_BAD_INITIAL_STACK}, { |
| 221 | ERRDOS, 193, NT_STATUS_BAD_INITIAL_PC}, { |
| 222 | ERRDOS, 87, NT_STATUS_INVALID_CID}, { |
| 223 | ERRHRD, ERRgeneral, NT_STATUS_TIMER_NOT_CANCELED}, { |
| 224 | ERRDOS, 87, NT_STATUS_INVALID_PARAMETER}, { |
| 225 | ERRDOS, ERRbadfile, NT_STATUS_NO_SUCH_DEVICE}, { |
| 226 | ERRDOS, ERRbadfile, NT_STATUS_NO_SUCH_FILE}, { |
| 227 | ERRDOS, ERRbadfunc, NT_STATUS_INVALID_DEVICE_REQUEST}, { |
| 228 | ERRDOS, 38, NT_STATUS_END_OF_FILE}, { |
| 229 | ERRDOS, 34, NT_STATUS_WRONG_VOLUME}, { |
| 230 | ERRDOS, 21, NT_STATUS_NO_MEDIA_IN_DEVICE}, { |
| 231 | ERRHRD, ERRgeneral, NT_STATUS_UNRECOGNIZED_MEDIA}, { |
| 232 | ERRDOS, 27, NT_STATUS_NONEXISTENT_SECTOR}, |
| 233 | /* { This NT error code was 'sqashed' |
Steve French | 3870253 | 2007-07-08 15:40:40 +0000 | [diff] [blame] | 234 | from NT_STATUS_MORE_PROCESSING_REQUIRED to NT_STATUS_OK |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 235 | during the session setup } */ |
| 236 | { |
| 237 | ERRDOS, ERRnomem, NT_STATUS_NO_MEMORY}, { |
| 238 | ERRDOS, 487, NT_STATUS_CONFLICTING_ADDRESSES}, { |
| 239 | ERRDOS, 487, NT_STATUS_NOT_MAPPED_VIEW}, { |
| 240 | ERRDOS, 87, NT_STATUS_UNABLE_TO_FREE_VM}, { |
| 241 | ERRDOS, 87, NT_STATUS_UNABLE_TO_DELETE_SECTION}, { |
| 242 | ERRDOS, 2142, NT_STATUS_INVALID_SYSTEM_SERVICE}, { |
| 243 | ERRHRD, ERRgeneral, NT_STATUS_ILLEGAL_INSTRUCTION}, { |
| 244 | ERRDOS, ERRnoaccess, NT_STATUS_INVALID_LOCK_SEQUENCE}, { |
| 245 | ERRDOS, ERRnoaccess, NT_STATUS_INVALID_VIEW_SIZE}, { |
| 246 | ERRDOS, 193, NT_STATUS_INVALID_FILE_FOR_SECTION}, { |
| 247 | ERRDOS, ERRnoaccess, NT_STATUS_ALREADY_COMMITTED}, |
| 248 | /* { This NT error code was 'sqashed' |
Steve French | 3870253 | 2007-07-08 15:40:40 +0000 | [diff] [blame] | 249 | from NT_STATUS_ACCESS_DENIED to NT_STATUS_TRUSTED_RELATIONSHIP_FAILURE |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 250 | during the session setup } */ |
| 251 | { |
| 252 | ERRDOS, ERRnoaccess, NT_STATUS_ACCESS_DENIED}, { |
| 253 | ERRDOS, 111, NT_STATUS_BUFFER_TOO_SMALL}, { |
| 254 | ERRDOS, ERRbadfid, NT_STATUS_OBJECT_TYPE_MISMATCH}, { |
| 255 | ERRHRD, ERRgeneral, NT_STATUS_NONCONTINUABLE_EXCEPTION}, { |
| 256 | ERRHRD, ERRgeneral, NT_STATUS_INVALID_DISPOSITION}, { |
| 257 | ERRHRD, ERRgeneral, NT_STATUS_UNWIND}, { |
| 258 | ERRHRD, ERRgeneral, NT_STATUS_BAD_STACK}, { |
| 259 | ERRHRD, ERRgeneral, NT_STATUS_INVALID_UNWIND_TARGET}, { |
| 260 | ERRDOS, 158, NT_STATUS_NOT_LOCKED}, { |
| 261 | ERRHRD, ERRgeneral, NT_STATUS_PARITY_ERROR}, { |
| 262 | ERRDOS, 487, NT_STATUS_UNABLE_TO_DECOMMIT_VM}, { |
| 263 | ERRDOS, 487, NT_STATUS_NOT_COMMITTED}, { |
| 264 | ERRHRD, ERRgeneral, NT_STATUS_INVALID_PORT_ATTRIBUTES}, { |
| 265 | ERRHRD, ERRgeneral, NT_STATUS_PORT_MESSAGE_TOO_LONG}, { |
| 266 | ERRDOS, 87, NT_STATUS_INVALID_PARAMETER_MIX}, { |
| 267 | ERRHRD, ERRgeneral, NT_STATUS_INVALID_QUOTA_LOWER}, { |
| 268 | ERRHRD, ERRgeneral, NT_STATUS_DISK_CORRUPT_ERROR}, { |
Steve French | ad7a292 | 2008-02-07 23:25:02 +0000 | [diff] [blame] | 269 | /* mapping changed since shell does lookup on * expects FileNotFound */ |
| 270 | ERRDOS, ERRbadfile, NT_STATUS_OBJECT_NAME_INVALID}, { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 271 | ERRDOS, ERRbadfile, NT_STATUS_OBJECT_NAME_NOT_FOUND}, { |
| 272 | ERRDOS, ERRalreadyexists, NT_STATUS_OBJECT_NAME_COLLISION}, { |
| 273 | ERRHRD, ERRgeneral, NT_STATUS_HANDLE_NOT_WAITABLE}, { |
| 274 | ERRDOS, ERRbadfid, NT_STATUS_PORT_DISCONNECTED}, { |
| 275 | ERRHRD, ERRgeneral, NT_STATUS_DEVICE_ALREADY_ATTACHED}, { |
| 276 | ERRDOS, 161, NT_STATUS_OBJECT_PATH_INVALID}, { |
| 277 | ERRDOS, ERRbadpath, NT_STATUS_OBJECT_PATH_NOT_FOUND}, { |
| 278 | ERRDOS, 161, NT_STATUS_OBJECT_PATH_SYNTAX_BAD}, { |
| 279 | ERRHRD, ERRgeneral, NT_STATUS_DATA_OVERRUN}, { |
| 280 | ERRHRD, ERRgeneral, NT_STATUS_DATA_LATE_ERROR}, { |
| 281 | ERRDOS, 23, NT_STATUS_DATA_ERROR}, { |
| 282 | ERRDOS, 23, NT_STATUS_CRC_ERROR}, { |
| 283 | ERRDOS, ERRnomem, NT_STATUS_SECTION_TOO_BIG}, { |
| 284 | ERRDOS, ERRnoaccess, NT_STATUS_PORT_CONNECTION_REFUSED}, { |
| 285 | ERRDOS, ERRbadfid, NT_STATUS_INVALID_PORT_HANDLE}, { |
| 286 | ERRDOS, ERRbadshare, NT_STATUS_SHARING_VIOLATION}, { |
| 287 | ERRHRD, ERRgeneral, NT_STATUS_QUOTA_EXCEEDED}, { |
| 288 | ERRDOS, 87, NT_STATUS_INVALID_PAGE_PROTECTION}, { |
| 289 | ERRDOS, 288, NT_STATUS_MUTANT_NOT_OWNED}, { |
| 290 | ERRDOS, 298, NT_STATUS_SEMAPHORE_LIMIT_EXCEEDED}, { |
| 291 | ERRDOS, 87, NT_STATUS_PORT_ALREADY_SET}, { |
| 292 | ERRDOS, 87, NT_STATUS_SECTION_NOT_IMAGE}, { |
| 293 | ERRDOS, 156, NT_STATUS_SUSPEND_COUNT_EXCEEDED}, { |
| 294 | ERRDOS, ERRnoaccess, NT_STATUS_THREAD_IS_TERMINATING}, { |
| 295 | ERRDOS, 87, NT_STATUS_BAD_WORKING_SET_LIMIT}, { |
| 296 | ERRDOS, 87, NT_STATUS_INCOMPATIBLE_FILE_MAP}, { |
| 297 | ERRDOS, 87, NT_STATUS_SECTION_PROTECTION}, { |
| 298 | ERRDOS, ERReasnotsupported, NT_STATUS_EAS_NOT_SUPPORTED}, { |
| 299 | ERRDOS, 255, NT_STATUS_EA_TOO_LARGE}, { |
| 300 | ERRHRD, ERRgeneral, NT_STATUS_NONEXISTENT_EA_ENTRY}, { |
| 301 | ERRHRD, ERRgeneral, NT_STATUS_NO_EAS_ON_FILE}, { |
| 302 | ERRHRD, ERRgeneral, NT_STATUS_EA_CORRUPT_ERROR}, { |
| 303 | ERRDOS, ERRlock, NT_STATUS_FILE_LOCK_CONFLICT}, { |
| 304 | ERRDOS, ERRlock, NT_STATUS_LOCK_NOT_GRANTED}, { |
| 305 | ERRDOS, ERRbadfile, NT_STATUS_DELETE_PENDING}, { |
| 306 | ERRDOS, ERRunsup, NT_STATUS_CTL_FILE_NOT_SUPPORTED}, { |
| 307 | ERRHRD, ERRgeneral, NT_STATUS_UNKNOWN_REVISION}, { |
| 308 | ERRHRD, ERRgeneral, NT_STATUS_REVISION_MISMATCH}, { |
| 309 | ERRHRD, ERRgeneral, NT_STATUS_INVALID_OWNER}, { |
| 310 | ERRHRD, ERRgeneral, NT_STATUS_INVALID_PRIMARY_GROUP}, { |
| 311 | ERRHRD, ERRgeneral, NT_STATUS_NO_IMPERSONATION_TOKEN}, { |
| 312 | ERRHRD, ERRgeneral, NT_STATUS_CANT_DISABLE_MANDATORY}, { |
| 313 | ERRDOS, 2215, NT_STATUS_NO_LOGON_SERVERS}, { |
| 314 | ERRHRD, ERRgeneral, NT_STATUS_NO_SUCH_LOGON_SESSION}, { |
| 315 | ERRHRD, ERRgeneral, NT_STATUS_NO_SUCH_PRIVILEGE}, { |
| 316 | ERRDOS, ERRnoaccess, NT_STATUS_PRIVILEGE_NOT_HELD}, { |
| 317 | ERRHRD, ERRgeneral, NT_STATUS_INVALID_ACCOUNT_NAME}, { |
| 318 | ERRHRD, ERRgeneral, NT_STATUS_USER_EXISTS}, |
| 319 | /* { This NT error code was 'sqashed' |
Steve French | 3870253 | 2007-07-08 15:40:40 +0000 | [diff] [blame] | 320 | from NT_STATUS_NO_SUCH_USER to NT_STATUS_LOGON_FAILURE |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 321 | during the session setup } */ |
| 322 | { |
Steve French | a761ac5 | 2007-10-18 21:45:27 +0000 | [diff] [blame] | 323 | ERRDOS, ERRnoaccess, NT_STATUS_NO_SUCH_USER}, { /* could map to 2238 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 324 | ERRHRD, ERRgeneral, NT_STATUS_GROUP_EXISTS}, { |
| 325 | ERRHRD, ERRgeneral, NT_STATUS_NO_SUCH_GROUP}, { |
| 326 | ERRHRD, ERRgeneral, NT_STATUS_MEMBER_IN_GROUP}, { |
| 327 | ERRHRD, ERRgeneral, NT_STATUS_MEMBER_NOT_IN_GROUP}, { |
| 328 | ERRHRD, ERRgeneral, NT_STATUS_LAST_ADMIN}, |
| 329 | /* { This NT error code was 'sqashed' |
Steve French | 3870253 | 2007-07-08 15:40:40 +0000 | [diff] [blame] | 330 | from NT_STATUS_WRONG_PASSWORD to NT_STATUS_LOGON_FAILURE |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 331 | during the session setup } */ |
| 332 | { |
| 333 | ERRSRV, ERRbadpw, NT_STATUS_WRONG_PASSWORD}, { |
| 334 | ERRHRD, ERRgeneral, NT_STATUS_ILL_FORMED_PASSWORD}, { |
| 335 | ERRHRD, ERRgeneral, NT_STATUS_PASSWORD_RESTRICTION}, { |
| 336 | ERRDOS, ERRnoaccess, NT_STATUS_LOGON_FAILURE}, { |
| 337 | ERRHRD, ERRgeneral, NT_STATUS_ACCOUNT_RESTRICTION}, { |
Steve French | a761ac5 | 2007-10-18 21:45:27 +0000 | [diff] [blame] | 338 | ERRSRV, ERRbadLogonTime, NT_STATUS_INVALID_LOGON_HOURS}, { |
| 339 | ERRSRV, ERRbadclient, NT_STATUS_INVALID_WORKSTATION}, { |
Steve French | 6ab16d2 | 2005-11-29 20:55:11 -0800 | [diff] [blame] | 340 | ERRSRV, ERRpasswordExpired, NT_STATUS_PASSWORD_EXPIRED}, { |
Steve French | a761ac5 | 2007-10-18 21:45:27 +0000 | [diff] [blame] | 341 | ERRSRV, ERRaccountexpired, NT_STATUS_ACCOUNT_DISABLED}, { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 342 | ERRHRD, ERRgeneral, NT_STATUS_NONE_MAPPED}, { |
| 343 | ERRHRD, ERRgeneral, NT_STATUS_TOO_MANY_LUIDS_REQUESTED}, { |
| 344 | ERRHRD, ERRgeneral, NT_STATUS_LUIDS_EXHAUSTED}, { |
| 345 | ERRHRD, ERRgeneral, NT_STATUS_INVALID_SUB_AUTHORITY}, { |
| 346 | ERRHRD, ERRgeneral, NT_STATUS_INVALID_ACL}, { |
| 347 | ERRHRD, ERRgeneral, NT_STATUS_INVALID_SID}, { |
| 348 | ERRHRD, ERRgeneral, NT_STATUS_INVALID_SECURITY_DESCR}, { |
| 349 | ERRDOS, 127, NT_STATUS_PROCEDURE_NOT_FOUND}, { |
| 350 | ERRDOS, 193, NT_STATUS_INVALID_IMAGE_FORMAT}, { |
| 351 | ERRHRD, ERRgeneral, NT_STATUS_NO_TOKEN}, { |
| 352 | ERRHRD, ERRgeneral, NT_STATUS_BAD_INHERITANCE_ACL}, { |
| 353 | ERRDOS, 158, NT_STATUS_RANGE_NOT_LOCKED}, { |
| 354 | ERRDOS, 112, NT_STATUS_DISK_FULL}, { |
| 355 | ERRHRD, ERRgeneral, NT_STATUS_SERVER_DISABLED}, { |
| 356 | ERRHRD, ERRgeneral, NT_STATUS_SERVER_NOT_DISABLED}, { |
| 357 | ERRDOS, 68, NT_STATUS_TOO_MANY_GUIDS_REQUESTED}, { |
| 358 | ERRDOS, 259, NT_STATUS_GUIDS_EXHAUSTED}, { |
| 359 | ERRHRD, ERRgeneral, NT_STATUS_INVALID_ID_AUTHORITY}, { |
| 360 | ERRDOS, 259, NT_STATUS_AGENTS_EXHAUSTED}, { |
| 361 | ERRDOS, 154, NT_STATUS_INVALID_VOLUME_LABEL}, { |
| 362 | ERRDOS, 14, NT_STATUS_SECTION_NOT_EXTENDED}, { |
| 363 | ERRDOS, 487, NT_STATUS_NOT_MAPPED_DATA}, { |
| 364 | ERRHRD, ERRgeneral, NT_STATUS_RESOURCE_DATA_NOT_FOUND}, { |
| 365 | ERRHRD, ERRgeneral, NT_STATUS_RESOURCE_TYPE_NOT_FOUND}, { |
| 366 | ERRHRD, ERRgeneral, NT_STATUS_RESOURCE_NAME_NOT_FOUND}, { |
| 367 | ERRHRD, ERRgeneral, NT_STATUS_ARRAY_BOUNDS_EXCEEDED}, { |
| 368 | ERRHRD, ERRgeneral, NT_STATUS_FLOAT_DENORMAL_OPERAND}, { |
| 369 | ERRHRD, ERRgeneral, NT_STATUS_FLOAT_DIVIDE_BY_ZERO}, { |
| 370 | ERRHRD, ERRgeneral, NT_STATUS_FLOAT_INEXACT_RESULT}, { |
| 371 | ERRHRD, ERRgeneral, NT_STATUS_FLOAT_INVALID_OPERATION}, { |
| 372 | ERRHRD, ERRgeneral, NT_STATUS_FLOAT_OVERFLOW}, { |
| 373 | ERRHRD, ERRgeneral, NT_STATUS_FLOAT_STACK_CHECK}, { |
| 374 | ERRHRD, ERRgeneral, NT_STATUS_FLOAT_UNDERFLOW}, { |
| 375 | ERRHRD, ERRgeneral, NT_STATUS_INTEGER_DIVIDE_BY_ZERO}, { |
| 376 | ERRDOS, 534, NT_STATUS_INTEGER_OVERFLOW}, { |
| 377 | ERRHRD, ERRgeneral, NT_STATUS_PRIVILEGED_INSTRUCTION}, { |
| 378 | ERRDOS, ERRnomem, NT_STATUS_TOO_MANY_PAGING_FILES}, { |
| 379 | ERRHRD, ERRgeneral, NT_STATUS_FILE_INVALID}, { |
| 380 | ERRHRD, ERRgeneral, NT_STATUS_ALLOTTED_SPACE_EXCEEDED}, |
| 381 | /* { This NT error code was 'sqashed' |
Steve French | 3870253 | 2007-07-08 15:40:40 +0000 | [diff] [blame] | 382 | from NT_STATUS_INSUFFICIENT_RESOURCES to |
| 383 | NT_STATUS_INSUFF_SERVER_RESOURCES during the session setup } */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 384 | { |
Jeff Layton | 4f2b86a | 2012-09-24 09:33:40 -0400 | [diff] [blame] | 385 | ERRDOS, ERRnoresource, NT_STATUS_INSUFFICIENT_RESOURCES}, { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 386 | ERRDOS, ERRbadpath, NT_STATUS_DFS_EXIT_PATH_FOUND}, { |
| 387 | ERRDOS, 23, NT_STATUS_DEVICE_DATA_ERROR}, { |
| 388 | ERRHRD, ERRgeneral, NT_STATUS_DEVICE_NOT_CONNECTED}, { |
| 389 | ERRDOS, 21, NT_STATUS_DEVICE_POWER_FAILURE}, { |
| 390 | ERRDOS, 487, NT_STATUS_FREE_VM_NOT_AT_BASE}, { |
| 391 | ERRDOS, 487, NT_STATUS_MEMORY_NOT_ALLOCATED}, { |
| 392 | ERRHRD, ERRgeneral, NT_STATUS_WORKING_SET_QUOTA}, { |
| 393 | ERRDOS, 19, NT_STATUS_MEDIA_WRITE_PROTECTED}, { |
| 394 | ERRDOS, 21, NT_STATUS_DEVICE_NOT_READY}, { |
| 395 | ERRHRD, ERRgeneral, NT_STATUS_INVALID_GROUP_ATTRIBUTES}, { |
| 396 | ERRHRD, ERRgeneral, NT_STATUS_BAD_IMPERSONATION_LEVEL}, { |
| 397 | ERRHRD, ERRgeneral, NT_STATUS_CANT_OPEN_ANONYMOUS}, { |
| 398 | ERRHRD, ERRgeneral, NT_STATUS_BAD_VALIDATION_CLASS}, { |
| 399 | ERRHRD, ERRgeneral, NT_STATUS_BAD_TOKEN_TYPE}, { |
| 400 | ERRDOS, 87, NT_STATUS_BAD_MASTER_BOOT_RECORD}, { |
| 401 | ERRHRD, ERRgeneral, NT_STATUS_INSTRUCTION_MISALIGNMENT}, { |
| 402 | ERRDOS, ERRpipebusy, NT_STATUS_INSTANCE_NOT_AVAILABLE}, { |
| 403 | ERRDOS, ERRpipebusy, NT_STATUS_PIPE_NOT_AVAILABLE}, { |
| 404 | ERRDOS, ERRbadpipe, NT_STATUS_INVALID_PIPE_STATE}, { |
| 405 | ERRDOS, ERRpipebusy, NT_STATUS_PIPE_BUSY}, { |
| 406 | ERRDOS, ERRbadfunc, NT_STATUS_ILLEGAL_FUNCTION}, { |
| 407 | ERRDOS, ERRnotconnected, NT_STATUS_PIPE_DISCONNECTED}, { |
| 408 | ERRDOS, ERRpipeclosing, NT_STATUS_PIPE_CLOSING}, { |
| 409 | ERRHRD, ERRgeneral, NT_STATUS_PIPE_CONNECTED}, { |
| 410 | ERRHRD, ERRgeneral, NT_STATUS_PIPE_LISTENING}, { |
| 411 | ERRDOS, ERRbadpipe, NT_STATUS_INVALID_READ_MODE}, { |
| 412 | ERRDOS, 121, NT_STATUS_IO_TIMEOUT}, { |
| 413 | ERRDOS, 38, NT_STATUS_FILE_FORCED_CLOSED}, { |
| 414 | ERRHRD, ERRgeneral, NT_STATUS_PROFILING_NOT_STARTED}, { |
| 415 | ERRHRD, ERRgeneral, NT_STATUS_PROFILING_NOT_STOPPED}, { |
| 416 | ERRHRD, ERRgeneral, NT_STATUS_COULD_NOT_INTERPRET}, { |
| 417 | ERRDOS, ERRnoaccess, NT_STATUS_FILE_IS_A_DIRECTORY}, { |
| 418 | ERRDOS, ERRunsup, NT_STATUS_NOT_SUPPORTED}, { |
| 419 | ERRDOS, 51, NT_STATUS_REMOTE_NOT_LISTENING}, { |
| 420 | ERRDOS, 52, NT_STATUS_DUPLICATE_NAME}, { |
| 421 | ERRDOS, 53, NT_STATUS_BAD_NETWORK_PATH}, { |
| 422 | ERRDOS, 54, NT_STATUS_NETWORK_BUSY}, { |
| 423 | ERRDOS, 55, NT_STATUS_DEVICE_DOES_NOT_EXIST}, { |
| 424 | ERRDOS, 56, NT_STATUS_TOO_MANY_COMMANDS}, { |
| 425 | ERRDOS, 57, NT_STATUS_ADAPTER_HARDWARE_ERROR}, { |
| 426 | ERRDOS, 58, NT_STATUS_INVALID_NETWORK_RESPONSE}, { |
| 427 | ERRDOS, 59, NT_STATUS_UNEXPECTED_NETWORK_ERROR}, { |
| 428 | ERRDOS, 60, NT_STATUS_BAD_REMOTE_ADAPTER}, { |
| 429 | ERRDOS, 61, NT_STATUS_PRINT_QUEUE_FULL}, { |
| 430 | ERRDOS, 62, NT_STATUS_NO_SPOOL_SPACE}, { |
| 431 | ERRDOS, 63, NT_STATUS_PRINT_CANCELLED}, { |
| 432 | ERRDOS, 64, NT_STATUS_NETWORK_NAME_DELETED}, { |
| 433 | ERRDOS, 65, NT_STATUS_NETWORK_ACCESS_DENIED}, { |
| 434 | ERRDOS, 66, NT_STATUS_BAD_DEVICE_TYPE}, { |
| 435 | ERRDOS, ERRnosuchshare, NT_STATUS_BAD_NETWORK_NAME}, { |
| 436 | ERRDOS, 68, NT_STATUS_TOO_MANY_NAMES}, { |
| 437 | ERRDOS, 69, NT_STATUS_TOO_MANY_SESSIONS}, { |
| 438 | ERRDOS, 70, NT_STATUS_SHARING_PAUSED}, { |
| 439 | ERRDOS, 71, NT_STATUS_REQUEST_NOT_ACCEPTED}, { |
| 440 | ERRDOS, 72, NT_STATUS_REDIRECTOR_PAUSED}, { |
| 441 | ERRDOS, 88, NT_STATUS_NET_WRITE_FAULT}, { |
| 442 | ERRHRD, ERRgeneral, NT_STATUS_PROFILING_AT_LIMIT}, { |
| 443 | ERRDOS, ERRdiffdevice, NT_STATUS_NOT_SAME_DEVICE}, { |
| 444 | ERRDOS, ERRnoaccess, NT_STATUS_FILE_RENAMED}, { |
| 445 | ERRDOS, 240, NT_STATUS_VIRTUAL_CIRCUIT_CLOSED}, { |
| 446 | ERRHRD, ERRgeneral, NT_STATUS_NO_SECURITY_ON_OBJECT}, { |
| 447 | ERRHRD, ERRgeneral, NT_STATUS_CANT_WAIT}, { |
| 448 | ERRDOS, ERRpipeclosing, NT_STATUS_PIPE_EMPTY}, { |
| 449 | ERRHRD, ERRgeneral, NT_STATUS_CANT_ACCESS_DOMAIN_INFO}, { |
| 450 | ERRHRD, ERRgeneral, NT_STATUS_CANT_TERMINATE_SELF}, { |
| 451 | ERRHRD, ERRgeneral, NT_STATUS_INVALID_SERVER_STATE}, { |
| 452 | ERRHRD, ERRgeneral, NT_STATUS_INVALID_DOMAIN_STATE}, { |
| 453 | ERRHRD, ERRgeneral, NT_STATUS_INVALID_DOMAIN_ROLE}, { |
| 454 | ERRHRD, ERRgeneral, NT_STATUS_NO_SUCH_DOMAIN}, { |
| 455 | ERRHRD, ERRgeneral, NT_STATUS_DOMAIN_EXISTS}, { |
| 456 | ERRHRD, ERRgeneral, NT_STATUS_DOMAIN_LIMIT_EXCEEDED}, { |
| 457 | ERRDOS, 300, NT_STATUS_OPLOCK_NOT_GRANTED}, { |
| 458 | ERRDOS, 301, NT_STATUS_INVALID_OPLOCK_PROTOCOL}, { |
| 459 | ERRHRD, ERRgeneral, NT_STATUS_INTERNAL_DB_CORRUPTION}, { |
| 460 | ERRHRD, ERRgeneral, NT_STATUS_INTERNAL_ERROR}, { |
| 461 | ERRHRD, ERRgeneral, NT_STATUS_GENERIC_NOT_MAPPED}, { |
| 462 | ERRHRD, ERRgeneral, NT_STATUS_BAD_DESCRIPTOR_FORMAT}, { |
| 463 | ERRHRD, ERRgeneral, NT_STATUS_INVALID_USER_BUFFER}, { |
| 464 | ERRHRD, ERRgeneral, NT_STATUS_UNEXPECTED_IO_ERROR}, { |
| 465 | ERRHRD, ERRgeneral, NT_STATUS_UNEXPECTED_MM_CREATE_ERR}, { |
| 466 | ERRHRD, ERRgeneral, NT_STATUS_UNEXPECTED_MM_MAP_ERROR}, { |
| 467 | ERRHRD, ERRgeneral, NT_STATUS_UNEXPECTED_MM_EXTEND_ERR}, { |
| 468 | ERRHRD, ERRgeneral, NT_STATUS_NOT_LOGON_PROCESS}, { |
| 469 | ERRHRD, ERRgeneral, NT_STATUS_LOGON_SESSION_EXISTS}, { |
| 470 | ERRDOS, 87, NT_STATUS_INVALID_PARAMETER_1}, { |
| 471 | ERRDOS, 87, NT_STATUS_INVALID_PARAMETER_2}, { |
| 472 | ERRDOS, 87, NT_STATUS_INVALID_PARAMETER_3}, { |
| 473 | ERRDOS, 87, NT_STATUS_INVALID_PARAMETER_4}, { |
| 474 | ERRDOS, 87, NT_STATUS_INVALID_PARAMETER_5}, { |
| 475 | ERRDOS, 87, NT_STATUS_INVALID_PARAMETER_6}, { |
| 476 | ERRDOS, 87, NT_STATUS_INVALID_PARAMETER_7}, { |
| 477 | ERRDOS, 87, NT_STATUS_INVALID_PARAMETER_8}, { |
| 478 | ERRDOS, 87, NT_STATUS_INVALID_PARAMETER_9}, { |
| 479 | ERRDOS, 87, NT_STATUS_INVALID_PARAMETER_10}, { |
| 480 | ERRDOS, 87, NT_STATUS_INVALID_PARAMETER_11}, { |
| 481 | ERRDOS, 87, NT_STATUS_INVALID_PARAMETER_12}, { |
| 482 | ERRDOS, ERRbadpath, NT_STATUS_REDIRECTOR_NOT_STARTED}, { |
| 483 | ERRHRD, ERRgeneral, NT_STATUS_REDIRECTOR_STARTED}, { |
| 484 | ERRHRD, ERRgeneral, NT_STATUS_STACK_OVERFLOW}, { |
| 485 | ERRHRD, ERRgeneral, NT_STATUS_NO_SUCH_PACKAGE}, { |
| 486 | ERRHRD, ERRgeneral, NT_STATUS_BAD_FUNCTION_TABLE}, { |
| 487 | ERRDOS, 203, 0xc0000100}, { |
| 488 | ERRDOS, 145, NT_STATUS_DIRECTORY_NOT_EMPTY}, { |
| 489 | ERRHRD, ERRgeneral, NT_STATUS_FILE_CORRUPT_ERROR}, { |
| 490 | ERRDOS, 267, NT_STATUS_NOT_A_DIRECTORY}, { |
| 491 | ERRHRD, ERRgeneral, NT_STATUS_BAD_LOGON_SESSION_STATE}, { |
| 492 | ERRHRD, ERRgeneral, NT_STATUS_LOGON_SESSION_COLLISION}, { |
| 493 | ERRDOS, 206, NT_STATUS_NAME_TOO_LONG}, { |
| 494 | ERRDOS, 2401, NT_STATUS_FILES_OPEN}, { |
| 495 | ERRDOS, 2404, NT_STATUS_CONNECTION_IN_USE}, { |
| 496 | ERRHRD, ERRgeneral, NT_STATUS_MESSAGE_NOT_FOUND}, { |
| 497 | ERRDOS, ERRnoaccess, NT_STATUS_PROCESS_IS_TERMINATING}, { |
| 498 | ERRHRD, ERRgeneral, NT_STATUS_INVALID_LOGON_TYPE}, { |
| 499 | ERRHRD, ERRgeneral, NT_STATUS_NO_GUID_TRANSLATION}, { |
| 500 | ERRHRD, ERRgeneral, NT_STATUS_CANNOT_IMPERSONATE}, { |
| 501 | ERRHRD, ERRgeneral, NT_STATUS_IMAGE_ALREADY_LOADED}, { |
| 502 | ERRHRD, ERRgeneral, NT_STATUS_ABIOS_NOT_PRESENT}, { |
| 503 | ERRHRD, ERRgeneral, NT_STATUS_ABIOS_LID_NOT_EXIST}, { |
| 504 | ERRHRD, ERRgeneral, NT_STATUS_ABIOS_LID_ALREADY_OWNED}, { |
| 505 | ERRHRD, ERRgeneral, NT_STATUS_ABIOS_NOT_LID_OWNER}, { |
| 506 | ERRHRD, ERRgeneral, NT_STATUS_ABIOS_INVALID_COMMAND}, { |
| 507 | ERRHRD, ERRgeneral, NT_STATUS_ABIOS_INVALID_LID}, { |
| 508 | ERRHRD, ERRgeneral, NT_STATUS_ABIOS_SELECTOR_NOT_AVAILABLE}, { |
| 509 | ERRHRD, ERRgeneral, NT_STATUS_ABIOS_INVALID_SELECTOR}, { |
| 510 | ERRHRD, ERRgeneral, NT_STATUS_NO_LDT}, { |
| 511 | ERRHRD, ERRgeneral, NT_STATUS_INVALID_LDT_SIZE}, { |
| 512 | ERRHRD, ERRgeneral, NT_STATUS_INVALID_LDT_OFFSET}, { |
| 513 | ERRHRD, ERRgeneral, NT_STATUS_INVALID_LDT_DESCRIPTOR}, { |
| 514 | ERRDOS, 193, NT_STATUS_INVALID_IMAGE_NE_FORMAT}, { |
| 515 | ERRHRD, ERRgeneral, NT_STATUS_RXACT_INVALID_STATE}, { |
| 516 | ERRHRD, ERRgeneral, NT_STATUS_RXACT_COMMIT_FAILURE}, { |
| 517 | ERRHRD, ERRgeneral, NT_STATUS_MAPPED_FILE_SIZE_ZERO}, { |
| 518 | ERRDOS, ERRnofids, NT_STATUS_TOO_MANY_OPENED_FILES}, { |
| 519 | ERRHRD, ERRgeneral, NT_STATUS_CANCELLED}, { |
| 520 | ERRDOS, ERRnoaccess, NT_STATUS_CANNOT_DELETE}, { |
| 521 | ERRHRD, ERRgeneral, NT_STATUS_INVALID_COMPUTER_NAME}, { |
| 522 | ERRDOS, ERRnoaccess, NT_STATUS_FILE_DELETED}, { |
| 523 | ERRHRD, ERRgeneral, NT_STATUS_SPECIAL_ACCOUNT}, { |
| 524 | ERRHRD, ERRgeneral, NT_STATUS_SPECIAL_GROUP}, { |
| 525 | ERRHRD, ERRgeneral, NT_STATUS_SPECIAL_USER}, { |
| 526 | ERRHRD, ERRgeneral, NT_STATUS_MEMBERS_PRIMARY_GROUP}, { |
| 527 | ERRDOS, ERRbadfid, NT_STATUS_FILE_CLOSED}, { |
| 528 | ERRHRD, ERRgeneral, NT_STATUS_TOO_MANY_THREADS}, { |
| 529 | ERRHRD, ERRgeneral, NT_STATUS_THREAD_NOT_IN_PROCESS}, { |
| 530 | ERRHRD, ERRgeneral, NT_STATUS_TOKEN_ALREADY_IN_USE}, { |
| 531 | ERRHRD, ERRgeneral, NT_STATUS_PAGEFILE_QUOTA_EXCEEDED}, { |
| 532 | ERRHRD, ERRgeneral, NT_STATUS_COMMITMENT_LIMIT}, { |
| 533 | ERRDOS, 193, NT_STATUS_INVALID_IMAGE_LE_FORMAT}, { |
| 534 | ERRDOS, 193, NT_STATUS_INVALID_IMAGE_NOT_MZ}, { |
| 535 | ERRDOS, 193, NT_STATUS_INVALID_IMAGE_PROTECT}, { |
| 536 | ERRDOS, 193, NT_STATUS_INVALID_IMAGE_WIN_16}, { |
| 537 | ERRHRD, ERRgeneral, NT_STATUS_LOGON_SERVER_CONFLICT}, { |
| 538 | ERRHRD, ERRgeneral, NT_STATUS_TIME_DIFFERENCE_AT_DC}, { |
| 539 | ERRHRD, ERRgeneral, NT_STATUS_SYNCHRONIZATION_REQUIRED}, { |
| 540 | ERRDOS, 126, NT_STATUS_DLL_NOT_FOUND}, { |
| 541 | ERRHRD, ERRgeneral, NT_STATUS_OPEN_FAILED}, { |
| 542 | ERRHRD, ERRgeneral, NT_STATUS_IO_PRIVILEGE_FAILED}, { |
| 543 | ERRDOS, 182, NT_STATUS_ORDINAL_NOT_FOUND}, { |
| 544 | ERRDOS, 127, NT_STATUS_ENTRYPOINT_NOT_FOUND}, { |
| 545 | ERRHRD, ERRgeneral, NT_STATUS_CONTROL_C_EXIT}, { |
| 546 | ERRDOS, 64, NT_STATUS_LOCAL_DISCONNECT}, { |
| 547 | ERRDOS, 64, NT_STATUS_REMOTE_DISCONNECT}, { |
| 548 | ERRDOS, 51, NT_STATUS_REMOTE_RESOURCES}, { |
| 549 | ERRDOS, 59, NT_STATUS_LINK_FAILED}, { |
| 550 | ERRDOS, 59, NT_STATUS_LINK_TIMEOUT}, { |
| 551 | ERRDOS, 59, NT_STATUS_INVALID_CONNECTION}, { |
| 552 | ERRDOS, 59, NT_STATUS_INVALID_ADDRESS}, { |
| 553 | ERRHRD, ERRgeneral, NT_STATUS_DLL_INIT_FAILED}, { |
| 554 | ERRHRD, ERRgeneral, NT_STATUS_MISSING_SYSTEMFILE}, { |
| 555 | ERRHRD, ERRgeneral, NT_STATUS_UNHANDLED_EXCEPTION}, { |
| 556 | ERRHRD, ERRgeneral, NT_STATUS_APP_INIT_FAILURE}, { |
| 557 | ERRHRD, ERRgeneral, NT_STATUS_PAGEFILE_CREATE_FAILED}, { |
| 558 | ERRHRD, ERRgeneral, NT_STATUS_NO_PAGEFILE}, { |
| 559 | ERRDOS, 124, NT_STATUS_INVALID_LEVEL}, { |
| 560 | ERRDOS, 86, NT_STATUS_WRONG_PASSWORD_CORE}, { |
| 561 | ERRHRD, ERRgeneral, NT_STATUS_ILLEGAL_FLOAT_CONTEXT}, { |
| 562 | ERRDOS, 109, NT_STATUS_PIPE_BROKEN}, { |
| 563 | ERRHRD, ERRgeneral, NT_STATUS_REGISTRY_CORRUPT}, { |
| 564 | ERRHRD, ERRgeneral, NT_STATUS_REGISTRY_IO_FAILED}, { |
| 565 | ERRHRD, ERRgeneral, NT_STATUS_NO_EVENT_PAIR}, { |
| 566 | ERRHRD, ERRgeneral, NT_STATUS_UNRECOGNIZED_VOLUME}, { |
| 567 | ERRHRD, ERRgeneral, NT_STATUS_SERIAL_NO_DEVICE_INITED}, { |
| 568 | ERRHRD, ERRgeneral, NT_STATUS_NO_SUCH_ALIAS}, { |
| 569 | ERRHRD, ERRgeneral, NT_STATUS_MEMBER_NOT_IN_ALIAS}, { |
| 570 | ERRHRD, ERRgeneral, NT_STATUS_MEMBER_IN_ALIAS}, { |
| 571 | ERRHRD, ERRgeneral, NT_STATUS_ALIAS_EXISTS}, { |
| 572 | ERRHRD, ERRgeneral, NT_STATUS_LOGON_NOT_GRANTED}, { |
| 573 | ERRHRD, ERRgeneral, NT_STATUS_TOO_MANY_SECRETS}, { |
| 574 | ERRHRD, ERRgeneral, NT_STATUS_SECRET_TOO_LONG}, { |
| 575 | ERRHRD, ERRgeneral, NT_STATUS_INTERNAL_DB_ERROR}, { |
| 576 | ERRHRD, ERRgeneral, NT_STATUS_FULLSCREEN_MODE}, { |
| 577 | ERRHRD, ERRgeneral, NT_STATUS_TOO_MANY_CONTEXT_IDS}, { |
| 578 | ERRDOS, ERRnoaccess, NT_STATUS_LOGON_TYPE_NOT_GRANTED}, { |
| 579 | ERRHRD, ERRgeneral, NT_STATUS_NOT_REGISTRY_FILE}, { |
| 580 | ERRHRD, ERRgeneral, NT_STATUS_NT_CROSS_ENCRYPTION_REQUIRED}, { |
| 581 | ERRHRD, ERRgeneral, NT_STATUS_DOMAIN_CTRLR_CONFIG_ERROR}, { |
| 582 | ERRHRD, ERRgeneral, NT_STATUS_FT_MISSING_MEMBER}, { |
| 583 | ERRHRD, ERRgeneral, NT_STATUS_ILL_FORMED_SERVICE_ENTRY}, { |
| 584 | ERRHRD, ERRgeneral, NT_STATUS_ILLEGAL_CHARACTER}, { |
| 585 | ERRHRD, ERRgeneral, NT_STATUS_UNMAPPABLE_CHARACTER}, { |
| 586 | ERRHRD, ERRgeneral, NT_STATUS_UNDEFINED_CHARACTER}, { |
| 587 | ERRHRD, ERRgeneral, NT_STATUS_FLOPPY_VOLUME}, { |
| 588 | ERRHRD, ERRgeneral, NT_STATUS_FLOPPY_ID_MARK_NOT_FOUND}, { |
| 589 | ERRHRD, ERRgeneral, NT_STATUS_FLOPPY_WRONG_CYLINDER}, { |
| 590 | ERRHRD, ERRgeneral, NT_STATUS_FLOPPY_UNKNOWN_ERROR}, { |
| 591 | ERRHRD, ERRgeneral, NT_STATUS_FLOPPY_BAD_REGISTERS}, { |
| 592 | ERRHRD, ERRgeneral, NT_STATUS_DISK_RECALIBRATE_FAILED}, { |
| 593 | ERRHRD, ERRgeneral, NT_STATUS_DISK_OPERATION_FAILED}, { |
| 594 | ERRHRD, ERRgeneral, NT_STATUS_DISK_RESET_FAILED}, { |
| 595 | ERRHRD, ERRgeneral, NT_STATUS_SHARED_IRQ_BUSY}, { |
| 596 | ERRHRD, ERRgeneral, NT_STATUS_FT_ORPHANING}, { |
| 597 | ERRHRD, ERRgeneral, 0xc000016e}, { |
| 598 | ERRHRD, ERRgeneral, 0xc000016f}, { |
| 599 | ERRHRD, ERRgeneral, 0xc0000170}, { |
| 600 | ERRHRD, ERRgeneral, 0xc0000171}, { |
| 601 | ERRHRD, ERRgeneral, NT_STATUS_PARTITION_FAILURE}, { |
| 602 | ERRHRD, ERRgeneral, NT_STATUS_INVALID_BLOCK_LENGTH}, { |
| 603 | ERRHRD, ERRgeneral, NT_STATUS_DEVICE_NOT_PARTITIONED}, { |
| 604 | ERRHRD, ERRgeneral, NT_STATUS_UNABLE_TO_LOCK_MEDIA}, { |
| 605 | ERRHRD, ERRgeneral, NT_STATUS_UNABLE_TO_UNLOAD_MEDIA}, { |
| 606 | ERRHRD, ERRgeneral, NT_STATUS_EOM_OVERFLOW}, { |
| 607 | ERRHRD, ERRgeneral, NT_STATUS_NO_MEDIA}, { |
| 608 | ERRHRD, ERRgeneral, 0xc0000179}, { |
| 609 | ERRHRD, ERRgeneral, NT_STATUS_NO_SUCH_MEMBER}, { |
| 610 | ERRHRD, ERRgeneral, NT_STATUS_INVALID_MEMBER}, { |
| 611 | ERRHRD, ERRgeneral, NT_STATUS_KEY_DELETED}, { |
| 612 | ERRHRD, ERRgeneral, NT_STATUS_NO_LOG_SPACE}, { |
| 613 | ERRHRD, ERRgeneral, NT_STATUS_TOO_MANY_SIDS}, { |
| 614 | ERRHRD, ERRgeneral, NT_STATUS_LM_CROSS_ENCRYPTION_REQUIRED}, { |
| 615 | ERRHRD, ERRgeneral, NT_STATUS_KEY_HAS_CHILDREN}, { |
| 616 | ERRHRD, ERRgeneral, NT_STATUS_CHILD_MUST_BE_VOLATILE}, { |
| 617 | ERRDOS, 87, NT_STATUS_DEVICE_CONFIGURATION_ERROR}, { |
| 618 | ERRHRD, ERRgeneral, NT_STATUS_DRIVER_INTERNAL_ERROR}, { |
| 619 | ERRDOS, 22, NT_STATUS_INVALID_DEVICE_STATE}, { |
| 620 | ERRHRD, ERRgeneral, NT_STATUS_IO_DEVICE_ERROR}, { |
| 621 | ERRHRD, ERRgeneral, NT_STATUS_DEVICE_PROTOCOL_ERROR}, { |
| 622 | ERRHRD, ERRgeneral, NT_STATUS_BACKUP_CONTROLLER}, { |
| 623 | ERRHRD, ERRgeneral, NT_STATUS_LOG_FILE_FULL}, { |
| 624 | ERRDOS, 19, NT_STATUS_TOO_LATE}, { |
| 625 | ERRDOS, ERRnoaccess, NT_STATUS_NO_TRUST_LSA_SECRET}, |
| 626 | /* { This NT error code was 'sqashed' |
Steve French | 3870253 | 2007-07-08 15:40:40 +0000 | [diff] [blame] | 627 | from NT_STATUS_NO_TRUST_SAM_ACCOUNT to |
| 628 | NT_STATUS_TRUSTED_RELATIONSHIP_FAILURE during the session setup } */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 629 | { |
| 630 | ERRDOS, ERRnoaccess, NT_STATUS_NO_TRUST_SAM_ACCOUNT}, { |
| 631 | ERRDOS, ERRnoaccess, NT_STATUS_TRUSTED_DOMAIN_FAILURE}, { |
| 632 | ERRDOS, ERRnoaccess, NT_STATUS_TRUSTED_RELATIONSHIP_FAILURE}, { |
| 633 | ERRHRD, ERRgeneral, NT_STATUS_EVENTLOG_FILE_CORRUPT}, { |
| 634 | ERRHRD, ERRgeneral, NT_STATUS_EVENTLOG_CANT_START}, { |
| 635 | ERRDOS, ERRnoaccess, NT_STATUS_TRUST_FAILURE}, { |
| 636 | ERRHRD, ERRgeneral, NT_STATUS_MUTANT_LIMIT_EXCEEDED}, { |
| 637 | ERRDOS, ERRnetlogonNotStarted, NT_STATUS_NETLOGON_NOT_STARTED}, { |
Steve French | a761ac5 | 2007-10-18 21:45:27 +0000 | [diff] [blame] | 638 | ERRSRV, ERRaccountexpired, NT_STATUS_ACCOUNT_EXPIRED}, { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 639 | ERRHRD, ERRgeneral, NT_STATUS_POSSIBLE_DEADLOCK}, { |
| 640 | ERRHRD, ERRgeneral, NT_STATUS_NETWORK_CREDENTIAL_CONFLICT}, { |
| 641 | ERRHRD, ERRgeneral, NT_STATUS_REMOTE_SESSION_LIMIT}, { |
| 642 | ERRHRD, ERRgeneral, NT_STATUS_EVENTLOG_FILE_CHANGED}, { |
| 643 | ERRDOS, ERRnoaccess, NT_STATUS_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT}, { |
| 644 | ERRDOS, ERRnoaccess, NT_STATUS_NOLOGON_WORKSTATION_TRUST_ACCOUNT}, { |
| 645 | ERRDOS, ERRnoaccess, NT_STATUS_NOLOGON_SERVER_TRUST_ACCOUNT}, |
| 646 | /* { This NT error code was 'sqashed' |
Steve French | 3870253 | 2007-07-08 15:40:40 +0000 | [diff] [blame] | 647 | from NT_STATUS_DOMAIN_TRUST_INCONSISTENT to NT_STATUS_LOGON_FAILURE |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 648 | during the session setup } */ |
| 649 | { |
| 650 | ERRDOS, ERRnoaccess, NT_STATUS_DOMAIN_TRUST_INCONSISTENT}, { |
| 651 | ERRHRD, ERRgeneral, NT_STATUS_FS_DRIVER_REQUIRED}, { |
| 652 | ERRHRD, ERRgeneral, NT_STATUS_NO_USER_SESSION_KEY}, { |
| 653 | ERRDOS, 59, NT_STATUS_USER_SESSION_DELETED}, { |
| 654 | ERRHRD, ERRgeneral, NT_STATUS_RESOURCE_LANG_NOT_FOUND}, { |
Jeff Layton | 4f2b86a | 2012-09-24 09:33:40 -0400 | [diff] [blame] | 655 | ERRDOS, ERRnoresource, NT_STATUS_INSUFF_SERVER_RESOURCES}, { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 656 | ERRHRD, ERRgeneral, NT_STATUS_INVALID_BUFFER_SIZE}, { |
| 657 | ERRHRD, ERRgeneral, NT_STATUS_INVALID_ADDRESS_COMPONENT}, { |
| 658 | ERRHRD, ERRgeneral, NT_STATUS_INVALID_ADDRESS_WILDCARD}, { |
| 659 | ERRDOS, 68, NT_STATUS_TOO_MANY_ADDRESSES}, { |
| 660 | ERRDOS, 52, NT_STATUS_ADDRESS_ALREADY_EXISTS}, { |
| 661 | ERRDOS, 64, NT_STATUS_ADDRESS_CLOSED}, { |
| 662 | ERRDOS, 64, NT_STATUS_CONNECTION_DISCONNECTED}, { |
| 663 | ERRDOS, 64, NT_STATUS_CONNECTION_RESET}, { |
| 664 | ERRDOS, 68, NT_STATUS_TOO_MANY_NODES}, { |
| 665 | ERRDOS, 59, NT_STATUS_TRANSACTION_ABORTED}, { |
| 666 | ERRDOS, 59, NT_STATUS_TRANSACTION_TIMED_OUT}, { |
| 667 | ERRDOS, 59, NT_STATUS_TRANSACTION_NO_RELEASE}, { |
| 668 | ERRDOS, 59, NT_STATUS_TRANSACTION_NO_MATCH}, { |
| 669 | ERRDOS, 59, NT_STATUS_TRANSACTION_RESPONDED}, { |
| 670 | ERRDOS, 59, NT_STATUS_TRANSACTION_INVALID_ID}, { |
| 671 | ERRDOS, 59, NT_STATUS_TRANSACTION_INVALID_TYPE}, { |
| 672 | ERRDOS, ERRunsup, NT_STATUS_NOT_SERVER_SESSION}, { |
| 673 | ERRDOS, ERRunsup, NT_STATUS_NOT_CLIENT_SESSION}, { |
| 674 | ERRHRD, ERRgeneral, NT_STATUS_CANNOT_LOAD_REGISTRY_FILE}, { |
| 675 | ERRHRD, ERRgeneral, NT_STATUS_DEBUG_ATTACH_FAILED}, { |
| 676 | ERRHRD, ERRgeneral, NT_STATUS_SYSTEM_PROCESS_TERMINATED}, { |
| 677 | ERRHRD, ERRgeneral, NT_STATUS_DATA_NOT_ACCEPTED}, { |
| 678 | ERRHRD, ERRgeneral, NT_STATUS_NO_BROWSER_SERVERS_FOUND}, { |
| 679 | ERRHRD, ERRgeneral, NT_STATUS_VDM_HARD_ERROR}, { |
| 680 | ERRHRD, ERRgeneral, NT_STATUS_DRIVER_CANCEL_TIMEOUT}, { |
| 681 | ERRHRD, ERRgeneral, NT_STATUS_REPLY_MESSAGE_MISMATCH}, { |
| 682 | ERRHRD, ERRgeneral, NT_STATUS_MAPPED_ALIGNMENT}, { |
| 683 | ERRDOS, 193, NT_STATUS_IMAGE_CHECKSUM_MISMATCH}, { |
| 684 | ERRHRD, ERRgeneral, NT_STATUS_LOST_WRITEBEHIND_DATA}, { |
| 685 | ERRHRD, ERRgeneral, NT_STATUS_CLIENT_SERVER_PARAMETERS_INVALID}, { |
Steve French | 6ab16d2 | 2005-11-29 20:55:11 -0800 | [diff] [blame] | 686 | ERRSRV, ERRpasswordExpired, NT_STATUS_PASSWORD_MUST_CHANGE}, { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 687 | ERRHRD, ERRgeneral, NT_STATUS_NOT_FOUND}, { |
| 688 | ERRHRD, ERRgeneral, NT_STATUS_NOT_TINY_STREAM}, { |
| 689 | ERRHRD, ERRgeneral, NT_STATUS_RECOVERY_FAILURE}, { |
| 690 | ERRHRD, ERRgeneral, NT_STATUS_STACK_OVERFLOW_READ}, { |
| 691 | ERRHRD, ERRgeneral, NT_STATUS_FAIL_CHECK}, { |
| 692 | ERRHRD, ERRgeneral, NT_STATUS_DUPLICATE_OBJECTID}, { |
| 693 | ERRHRD, ERRgeneral, NT_STATUS_OBJECTID_EXISTS}, { |
| 694 | ERRHRD, ERRgeneral, NT_STATUS_CONVERT_TO_LARGE}, { |
| 695 | ERRHRD, ERRgeneral, NT_STATUS_RETRY}, { |
| 696 | ERRHRD, ERRgeneral, NT_STATUS_FOUND_OUT_OF_SCOPE}, { |
| 697 | ERRHRD, ERRgeneral, NT_STATUS_ALLOCATE_BUCKET}, { |
| 698 | ERRHRD, ERRgeneral, NT_STATUS_PROPSET_NOT_FOUND}, { |
| 699 | ERRHRD, ERRgeneral, NT_STATUS_MARSHALL_OVERFLOW}, { |
| 700 | ERRHRD, ERRgeneral, NT_STATUS_INVALID_VARIANT}, { |
| 701 | ERRHRD, ERRgeneral, NT_STATUS_DOMAIN_CONTROLLER_NOT_FOUND}, { |
| 702 | ERRDOS, ERRnoaccess, NT_STATUS_ACCOUNT_LOCKED_OUT}, { |
| 703 | ERRDOS, ERRbadfid, NT_STATUS_HANDLE_NOT_CLOSABLE}, { |
| 704 | ERRHRD, ERRgeneral, NT_STATUS_CONNECTION_REFUSED}, { |
| 705 | ERRHRD, ERRgeneral, NT_STATUS_GRACEFUL_DISCONNECT}, { |
| 706 | ERRHRD, ERRgeneral, NT_STATUS_ADDRESS_ALREADY_ASSOCIATED}, { |
| 707 | ERRHRD, ERRgeneral, NT_STATUS_ADDRESS_NOT_ASSOCIATED}, { |
| 708 | ERRHRD, ERRgeneral, NT_STATUS_CONNECTION_INVALID}, { |
| 709 | ERRHRD, ERRgeneral, NT_STATUS_CONNECTION_ACTIVE}, { |
| 710 | ERRHRD, ERRgeneral, NT_STATUS_NETWORK_UNREACHABLE}, { |
| 711 | ERRHRD, ERRgeneral, NT_STATUS_HOST_UNREACHABLE}, { |
| 712 | ERRHRD, ERRgeneral, NT_STATUS_PROTOCOL_UNREACHABLE}, { |
| 713 | ERRHRD, ERRgeneral, NT_STATUS_PORT_UNREACHABLE}, { |
| 714 | ERRHRD, ERRgeneral, NT_STATUS_REQUEST_ABORTED}, { |
| 715 | ERRHRD, ERRgeneral, NT_STATUS_CONNECTION_ABORTED}, { |
| 716 | ERRHRD, ERRgeneral, NT_STATUS_BAD_COMPRESSION_BUFFER}, { |
| 717 | ERRHRD, ERRgeneral, NT_STATUS_USER_MAPPED_FILE}, { |
| 718 | ERRHRD, ERRgeneral, NT_STATUS_AUDIT_FAILED}, { |
| 719 | ERRHRD, ERRgeneral, NT_STATUS_TIMER_RESOLUTION_NOT_SET}, { |
| 720 | ERRHRD, ERRgeneral, NT_STATUS_CONNECTION_COUNT_LIMIT}, { |
| 721 | ERRHRD, ERRgeneral, NT_STATUS_LOGIN_TIME_RESTRICTION}, { |
| 722 | ERRHRD, ERRgeneral, NT_STATUS_LOGIN_WKSTA_RESTRICTION}, { |
| 723 | ERRDOS, 193, NT_STATUS_IMAGE_MP_UP_MISMATCH}, { |
| 724 | ERRHRD, ERRgeneral, 0xc000024a}, { |
| 725 | ERRHRD, ERRgeneral, 0xc000024b}, { |
| 726 | ERRHRD, ERRgeneral, 0xc000024c}, { |
| 727 | ERRHRD, ERRgeneral, 0xc000024d}, { |
| 728 | ERRHRD, ERRgeneral, 0xc000024e}, { |
| 729 | ERRHRD, ERRgeneral, 0xc000024f}, { |
| 730 | ERRHRD, ERRgeneral, NT_STATUS_INSUFFICIENT_LOGON_INFO}, { |
| 731 | ERRHRD, ERRgeneral, NT_STATUS_BAD_DLL_ENTRYPOINT}, { |
| 732 | ERRHRD, ERRgeneral, NT_STATUS_BAD_SERVICE_ENTRYPOINT}, { |
| 733 | ERRHRD, ERRgeneral, NT_STATUS_LPC_REPLY_LOST}, { |
| 734 | ERRHRD, ERRgeneral, NT_STATUS_IP_ADDRESS_CONFLICT1}, { |
| 735 | ERRHRD, ERRgeneral, NT_STATUS_IP_ADDRESS_CONFLICT2}, { |
| 736 | ERRHRD, ERRgeneral, NT_STATUS_REGISTRY_QUOTA_LIMIT}, { |
| 737 | ERRSRV, 3, NT_STATUS_PATH_NOT_COVERED}, { |
| 738 | ERRHRD, ERRgeneral, NT_STATUS_NO_CALLBACK_ACTIVE}, { |
| 739 | ERRHRD, ERRgeneral, NT_STATUS_LICENSE_QUOTA_EXCEEDED}, { |
| 740 | ERRHRD, ERRgeneral, NT_STATUS_PWD_TOO_SHORT}, { |
| 741 | ERRHRD, ERRgeneral, NT_STATUS_PWD_TOO_RECENT}, { |
| 742 | ERRHRD, ERRgeneral, NT_STATUS_PWD_HISTORY_CONFLICT}, { |
| 743 | ERRHRD, ERRgeneral, 0xc000025d}, { |
| 744 | ERRHRD, ERRgeneral, NT_STATUS_PLUGPLAY_NO_DEVICE}, { |
| 745 | ERRHRD, ERRgeneral, NT_STATUS_UNSUPPORTED_COMPRESSION}, { |
| 746 | ERRHRD, ERRgeneral, NT_STATUS_INVALID_HW_PROFILE}, { |
| 747 | ERRHRD, ERRgeneral, NT_STATUS_INVALID_PLUGPLAY_DEVICE_PATH}, { |
| 748 | ERRDOS, 182, NT_STATUS_DRIVER_ORDINAL_NOT_FOUND}, { |
| 749 | ERRDOS, 127, NT_STATUS_DRIVER_ENTRYPOINT_NOT_FOUND}, { |
| 750 | ERRDOS, 288, NT_STATUS_RESOURCE_NOT_OWNED}, { |
Steve French | 11aa014 | 2005-04-28 22:41:10 -0700 | [diff] [blame] | 751 | ERRDOS, ErrTooManyLinks, NT_STATUS_TOO_MANY_LINKS}, { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 752 | ERRHRD, ERRgeneral, NT_STATUS_QUOTA_LIST_INCONSISTENT}, { |
| 753 | ERRHRD, ERRgeneral, NT_STATUS_FILE_IS_OFFLINE}, { |
| 754 | ERRDOS, 21, 0xc000026e}, { |
| 755 | ERRDOS, 161, 0xc0000281}, { |
| 756 | ERRDOS, ERRnoaccess, 0xc000028a}, { |
| 757 | ERRDOS, ERRnoaccess, 0xc000028b}, { |
| 758 | ERRHRD, ERRgeneral, 0xc000028c}, { |
| 759 | ERRDOS, ERRnoaccess, 0xc000028d}, { |
| 760 | ERRDOS, ERRnoaccess, 0xc000028e}, { |
| 761 | ERRDOS, ERRnoaccess, 0xc000028f}, { |
| 762 | ERRDOS, ERRnoaccess, 0xc0000290}, { |
| 763 | ERRDOS, ERRbadfunc, 0xc000029c}, { |
Steve French | 9e39b0a | 2009-04-30 21:31:15 +0000 | [diff] [blame] | 764 | ERRDOS, ERRsymlink, NT_STATUS_STOPPED_ON_SYMLINK}, { |
Tim Gardner | 0c26606 | 2013-10-13 13:29:03 -0600 | [diff] [blame] | 765 | ERRDOS, ERRinvlevel, 0x007c0001}, { |
| 766 | 0, 0, 0 } |
| 767 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 768 | |
| 769 | /***************************************************************************** |
| 770 | Print an error message from the status code |
| 771 | *****************************************************************************/ |
| 772 | static void |
| 773 | cifs_print_status(__u32 status_code) |
| 774 | { |
| 775 | int idx = 0; |
| 776 | |
| 777 | while (nt_errs[idx].nt_errstr != NULL) { |
| 778 | if (((nt_errs[idx].nt_errcode) & 0xFFFFFF) == |
| 779 | (status_code & 0xFFFFFF)) { |
Fabian Frederick | 179d618 | 2014-05-13 19:30:33 +0200 | [diff] [blame] | 780 | pr_notice("Status code returned 0x%08x %s\n", |
| 781 | status_code, nt_errs[idx].nt_errstr); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 782 | } |
| 783 | idx++; |
| 784 | } |
| 785 | return; |
| 786 | } |
| 787 | |
| 788 | |
| 789 | static void |
Steve French | 63d2583 | 2007-11-05 21:46:10 +0000 | [diff] [blame] | 790 | ntstatus_to_dos(__u32 ntstatus, __u8 *eclass, __u16 *ecode) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 791 | { |
| 792 | int i; |
| 793 | if (ntstatus == 0) { |
| 794 | *eclass = 0; |
| 795 | *ecode = 0; |
| 796 | return; |
| 797 | } |
| 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; |
| 803 | } |
| 804 | } |
| 805 | *eclass = ERRHRD; |
| 806 | *ecode = ERRgeneral; |
| 807 | } |
| 808 | |
| 809 | int |
Pavel Shilovsky | 5ffef7b | 2012-03-23 14:28:03 -0400 | [diff] [blame] | 810 | map_smb_to_linux_error(char *buf, bool logErr) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 811 | { |
Pavel Shilovsky | 5ffef7b | 2012-03-23 14:28:03 -0400 | [diff] [blame] | 812 | struct smb_hdr *smb = (struct smb_hdr *)buf; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 813 | unsigned int i; |
Steve French | 3870253 | 2007-07-08 15:40:40 +0000 | [diff] [blame] | 814 | int rc = -EIO; /* if transport error smb error may not be set */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 815 | __u8 smberrclass; |
| 816 | __u16 smberrcode; |
| 817 | |
| 818 | /* BB if NT Status codes - map NT BB */ |
| 819 | |
| 820 | /* old style smb error codes */ |
| 821 | if (smb->Status.CifsError == 0) |
| 822 | return 0; |
| 823 | |
| 824 | if (smb->Flags2 & SMBFLG2_ERR_STATUS) { |
Steve French | 3870253 | 2007-07-08 15:40:40 +0000 | [diff] [blame] | 825 | /* translate the newer STATUS codes to old style SMB errors |
| 826 | * and then to POSIX errors */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 827 | __u32 err = le32_to_cpu(smb->Status.CifsError); |
Steve French | a761ac5 | 2007-10-18 21:45:27 +0000 | [diff] [blame] | 828 | if (logErr && (err != (NT_STATUS_MORE_PROCESSING_REQUIRED))) |
| 829 | cifs_print_status(err); |
| 830 | else if (cifsFYI & CIFS_RC) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 831 | cifs_print_status(err); |
| 832 | ntstatus_to_dos(err, &smberrclass, &smberrcode); |
| 833 | } else { |
| 834 | smberrclass = smb->Status.DosError.ErrorClass; |
| 835 | smberrcode = le16_to_cpu(smb->Status.DosError.Error); |
| 836 | } |
| 837 | |
| 838 | /* old style errors */ |
| 839 | |
| 840 | /* DOS class smb error codes - map DOS */ |
Steve French | ad7a292 | 2008-02-07 23:25:02 +0000 | [diff] [blame] | 841 | if (smberrclass == ERRDOS) { |
| 842 | /* 1 byte field no need to byte reverse */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 843 | for (i = 0; |
| 844 | i < |
Steve French | 630f3f0c | 2007-10-25 21:17:17 +0000 | [diff] [blame] | 845 | sizeof(mapping_table_ERRDOS) / |
| 846 | sizeof(struct smb_to_posix_error); i++) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 847 | if (mapping_table_ERRDOS[i].smb_err == 0) |
| 848 | break; |
Steve French | 63135e0 | 2007-07-17 17:34:02 +0000 | [diff] [blame] | 849 | else if (mapping_table_ERRDOS[i].smb_err == |
| 850 | smberrcode) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 851 | rc = mapping_table_ERRDOS[i].posix_code; |
| 852 | break; |
| 853 | } |
Steve French | 3870253 | 2007-07-08 15:40:40 +0000 | [diff] [blame] | 854 | /* else try next error mapping one to see if match */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 855 | } |
Steve French | ad7a292 | 2008-02-07 23:25:02 +0000 | [diff] [blame] | 856 | } else if (smberrclass == ERRSRV) { |
| 857 | /* server class of error codes */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 858 | for (i = 0; |
| 859 | i < |
Steve French | 630f3f0c | 2007-10-25 21:17:17 +0000 | [diff] [blame] | 860 | sizeof(mapping_table_ERRSRV) / |
| 861 | sizeof(struct smb_to_posix_error); i++) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 862 | if (mapping_table_ERRSRV[i].smb_err == 0) |
| 863 | break; |
Steve French | 63135e0 | 2007-07-17 17:34:02 +0000 | [diff] [blame] | 864 | else if (mapping_table_ERRSRV[i].smb_err == |
| 865 | smberrcode) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 866 | rc = mapping_table_ERRSRV[i].posix_code; |
| 867 | break; |
| 868 | } |
Steve French | 3870253 | 2007-07-08 15:40:40 +0000 | [diff] [blame] | 869 | /* else try next error mapping to see if match */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 870 | } |
| 871 | } |
| 872 | /* else ERRHRD class errors or junk - return EIO */ |
| 873 | |
Joe Perches | f96637b | 2013-05-04 22:12:25 -0500 | [diff] [blame] | 874 | cifs_dbg(FYI, "Mapping smb error code 0x%x to POSIX err %d\n", |
Jeff Layton | 56c2430 | 2011-01-11 07:24:25 -0500 | [diff] [blame] | 875 | le32_to_cpu(smb->Status.CifsError), rc); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 876 | |
Steve French | 50c2f75 | 2007-07-13 00:33:32 +0000 | [diff] [blame] | 877 | /* generic corrective action e.g. reconnect SMB session on |
Steve French | 3870253 | 2007-07-08 15:40:40 +0000 | [diff] [blame] | 878 | * ERRbaduid could be added */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 879 | |
| 880 | return rc; |
| 881 | } |
| 882 | |
Roberto Bergantinos Corpas | a3713ec | 2020-07-03 11:29:32 +0200 | [diff] [blame] | 883 | int |
| 884 | map_and_check_smb_error(struct mid_q_entry *mid, bool logErr) |
| 885 | { |
| 886 | int rc; |
| 887 | struct smb_hdr *smb = (struct smb_hdr *)mid->resp_buf; |
| 888 | |
| 889 | rc = map_smb_to_linux_error((char *)smb, logErr); |
| 890 | if (rc == -EACCES && !(smb->Flags2 & SMBFLG2_ERR_STATUS)) { |
| 891 | /* possible ERRBaduid */ |
| 892 | __u8 class = smb->Status.DosError.ErrorClass; |
| 893 | __u16 code = le16_to_cpu(smb->Status.DosError.Error); |
| 894 | |
| 895 | /* switch can be used to handle different errors */ |
| 896 | if (class == ERRSRV && code == ERRbaduid) { |
| 897 | cifs_dbg(FYI, "Server returned 0x%x, reconnecting session...\n", |
| 898 | code); |
Shyam Prasad N | ba978e8 | 2022-01-17 07:15:02 +0000 | [diff] [blame] | 899 | cifs_reconnect(mid->server, false); |
Roberto Bergantinos Corpas | a3713ec | 2020-07-03 11:29:32 +0200 | [diff] [blame] | 900 | } |
| 901 | } |
| 902 | |
| 903 | return rc; |
| 904 | } |
| 905 | |
| 906 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 907 | /* |
| 908 | * calculate the size of the SMB message based on the fixed header |
| 909 | * portion, the number of word parameters and the data portion of the message |
| 910 | */ |
| 911 | unsigned int |
Ronnie Sahlberg | 9ec672b | 2018-04-22 15:30:12 -0600 | [diff] [blame] | 912 | smbCalcSize(void *buf, struct TCP_Server_Info *server) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 913 | { |
Pavel Shilovsky | 92fc65a | 2012-09-18 16:20:32 -0700 | [diff] [blame] | 914 | struct smb_hdr *ptr = (struct smb_hdr *)buf; |
Steve French | 630f3f0c | 2007-10-25 21:17:17 +0000 | [diff] [blame] | 915 | return (sizeof(struct smb_hdr) + (2 * ptr->WordCount) + |
Jeff Layton | 690c522 | 2011-01-20 13:36:51 -0500 | [diff] [blame] | 916 | 2 /* size of the bcc field */ + get_bcc(ptr)); |
Steve French | 70ca734 | 2005-09-22 16:32:06 -0700 | [diff] [blame] | 917 | } |
| 918 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 919 | /* The following are taken from fs/ntfs/util.c */ |
| 920 | |
| 921 | #define NTFS_TIME_OFFSET ((u64)(369*365 + 89) * 24 * 3600 * 10000000) |
| 922 | |
Jeff Layton | 07119a4 | 2009-05-27 09:37:33 -0400 | [diff] [blame] | 923 | /* |
| 924 | * Convert the NT UTC (based 1601-01-01, in hundred nanosecond units) |
| 925 | * into Unix UTC (based 1970-01-01, in seconds). |
| 926 | */ |
Arnd Bergmann | 9539020 | 2018-06-19 17:27:58 +0200 | [diff] [blame] | 927 | struct timespec64 |
Jeff Layton | 07119a4 | 2009-05-27 09:37:33 -0400 | [diff] [blame] | 928 | cifs_NTtimeToUnix(__le64 ntutc) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 929 | { |
Arnd Bergmann | 9539020 | 2018-06-19 17:27:58 +0200 | [diff] [blame] | 930 | struct timespec64 ts; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 931 | /* BB what about the timezone? BB */ |
| 932 | |
| 933 | /* Subtract the NTFS time offset, then convert to 1s intervals. */ |
Steve French | 2ae83bf | 2014-09-14 17:06:36 -0500 | [diff] [blame] | 934 | s64 t = le64_to_cpu(ntutc) - NTFS_TIME_OFFSET; |
Kevin Cernekee | 97c7134 | 2014-11-10 13:09:23 -0800 | [diff] [blame] | 935 | u64 abs_t; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 936 | |
Steve French | 2ae83bf | 2014-09-14 17:06:36 -0500 | [diff] [blame] | 937 | /* |
| 938 | * Unfortunately can not use normal 64 bit division on 32 bit arch, but |
| 939 | * the alternative, do_div, does not work with negative numbers so have |
| 940 | * to special case them |
| 941 | */ |
| 942 | if (t < 0) { |
Kevin Cernekee | 97c7134 | 2014-11-10 13:09:23 -0800 | [diff] [blame] | 943 | abs_t = -t; |
Arnd Bergmann | 9539020 | 2018-06-19 17:27:58 +0200 | [diff] [blame] | 944 | ts.tv_nsec = (time64_t)(do_div(abs_t, 10000000) * 100); |
Steve French | 2ae83bf | 2014-09-14 17:06:36 -0500 | [diff] [blame] | 945 | ts.tv_nsec = -ts.tv_nsec; |
Kevin Cernekee | 97c7134 | 2014-11-10 13:09:23 -0800 | [diff] [blame] | 946 | ts.tv_sec = -abs_t; |
Steve French | 2ae83bf | 2014-09-14 17:06:36 -0500 | [diff] [blame] | 947 | } else { |
Kevin Cernekee | 97c7134 | 2014-11-10 13:09:23 -0800 | [diff] [blame] | 948 | abs_t = t; |
Arnd Bergmann | 9539020 | 2018-06-19 17:27:58 +0200 | [diff] [blame] | 949 | ts.tv_nsec = (time64_t)do_div(abs_t, 10000000) * 100; |
Kevin Cernekee | 97c7134 | 2014-11-10 13:09:23 -0800 | [diff] [blame] | 950 | ts.tv_sec = abs_t; |
Steve French | 2ae83bf | 2014-09-14 17:06:36 -0500 | [diff] [blame] | 951 | } |
| 952 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 953 | return ts; |
| 954 | } |
| 955 | |
| 956 | /* Convert the Unix UTC into NT UTC. */ |
| 957 | u64 |
Arnd Bergmann | 9539020 | 2018-06-19 17:27:58 +0200 | [diff] [blame] | 958 | cifs_UnixTimeToNT(struct timespec64 t) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 959 | { |
| 960 | /* Convert to 100ns intervals and then add the NTFS time offset. */ |
| 961 | return (u64) t.tv_sec * 10000000 + t.tv_nsec/100 + NTFS_TIME_OFFSET; |
| 962 | } |
Steve French | 1bd5bbc | 2006-09-28 03:35:57 +0000 | [diff] [blame] | 963 | |
Fabian Frederick | 179d618 | 2014-05-13 19:30:33 +0200 | [diff] [blame] | 964 | static const int total_days_of_prev_months[] = { |
| 965 | 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 |
| 966 | }; |
Steve French | 1bd5bbc | 2006-09-28 03:35:57 +0000 | [diff] [blame] | 967 | |
Arnd Bergmann | 9539020 | 2018-06-19 17:27:58 +0200 | [diff] [blame] | 968 | struct timespec64 cnvrtDosUnixTm(__le16 le_date, __le16 le_time, int offset) |
Steve French | 1bd5bbc | 2006-09-28 03:35:57 +0000 | [diff] [blame] | 969 | { |
Arnd Bergmann | 9539020 | 2018-06-19 17:27:58 +0200 | [diff] [blame] | 970 | struct timespec64 ts; |
Deepa Dinamani | cb7a69e | 2019-03-22 14:32:35 -0700 | [diff] [blame] | 971 | time64_t sec, days; |
| 972 | int min, day, month, year; |
Jeff Layton | c4a2c08 | 2009-05-27 09:37:33 -0400 | [diff] [blame] | 973 | u16 date = le16_to_cpu(le_date); |
| 974 | u16 time = le16_to_cpu(le_time); |
Steve French | ad7a292 | 2008-02-07 23:25:02 +0000 | [diff] [blame] | 975 | SMB_TIME *st = (SMB_TIME *)&time; |
| 976 | SMB_DATE *sd = (SMB_DATE *)&date; |
Steve French | 1bd5bbc | 2006-09-28 03:35:57 +0000 | [diff] [blame] | 977 | |
Joe Perches | f96637b | 2013-05-04 22:12:25 -0500 | [diff] [blame] | 978 | cifs_dbg(FYI, "date %d time %d\n", date, time); |
Steve French | 1bd5bbc | 2006-09-28 03:35:57 +0000 | [diff] [blame] | 979 | |
Steve French | 268f3be | 2006-10-06 21:47:09 +0000 | [diff] [blame] | 980 | sec = 2 * st->TwoSeconds; |
| 981 | min = st->Minutes; |
Steve French | 790fe57 | 2007-07-07 19:25:05 +0000 | [diff] [blame] | 982 | if ((sec > 59) || (min > 59)) |
Joe Perches | a0a3036 | 2020-04-14 22:42:53 -0700 | [diff] [blame] | 983 | cifs_dbg(VFS, "Invalid time min %d sec %lld\n", min, sec); |
Steve French | 1bd5bbc | 2006-09-28 03:35:57 +0000 | [diff] [blame] | 984 | sec += (min * 60); |
Steve French | 268f3be | 2006-10-06 21:47:09 +0000 | [diff] [blame] | 985 | sec += 60 * 60 * st->Hours; |
Steve French | 790fe57 | 2007-07-07 19:25:05 +0000 | [diff] [blame] | 986 | if (st->Hours > 24) |
Joe Perches | a0a3036 | 2020-04-14 22:42:53 -0700 | [diff] [blame] | 987 | cifs_dbg(VFS, "Invalid hours %d\n", st->Hours); |
Deepa Dinamani | cb7a69e | 2019-03-22 14:32:35 -0700 | [diff] [blame] | 988 | day = sd->Day; |
Steve French | 268f3be | 2006-10-06 21:47:09 +0000 | [diff] [blame] | 989 | month = sd->Month; |
Deepa Dinamani | cb7a69e | 2019-03-22 14:32:35 -0700 | [diff] [blame] | 990 | if (day < 1 || day > 31 || month < 1 || month > 12) { |
Joe Perches | a0a3036 | 2020-04-14 22:42:53 -0700 | [diff] [blame] | 991 | cifs_dbg(VFS, "Invalid date, month %d day: %d\n", month, day); |
Deepa Dinamani | cb7a69e | 2019-03-22 14:32:35 -0700 | [diff] [blame] | 992 | day = clamp(day, 1, 31); |
Dan Carpenter | 564277e | 2017-05-01 21:43:43 +0300 | [diff] [blame] | 993 | month = clamp(month, 1, 12); |
Steve French | d5d1850 | 2007-10-17 21:31:52 +0000 | [diff] [blame] | 994 | } |
Steve French | 1bd5bbc | 2006-09-28 03:35:57 +0000 | [diff] [blame] | 995 | month -= 1; |
Deepa Dinamani | cb7a69e | 2019-03-22 14:32:35 -0700 | [diff] [blame] | 996 | days = day + total_days_of_prev_months[month]; |
Steve French | 533f90a | 2006-10-12 00:02:32 +0000 | [diff] [blame] | 997 | days += 3652; /* account for difference in days between 1980 and 1970 */ |
Steve French | 268f3be | 2006-10-06 21:47:09 +0000 | [diff] [blame] | 998 | year = sd->Year; |
Steve French | 1bd5bbc | 2006-09-28 03:35:57 +0000 | [diff] [blame] | 999 | days += year * 365; |
| 1000 | days += (year/4); /* leap year */ |
Steve French | 438dd92 | 2006-10-11 03:49:30 +0000 | [diff] [blame] | 1001 | /* generalized leap year calculation is more complex, ie no leap year |
| 1002 | for years/100 except for years/400, but since the maximum number for DOS |
| 1003 | year is 2**7, the last year is 1980+127, which means we need only |
| 1004 | consider 2 special case years, ie the years 2000 and 2100, and only |
Steve French | 3870253 | 2007-07-08 15:40:40 +0000 | [diff] [blame] | 1005 | adjust for the lack of leap year for the year 2100, as 2000 was a |
Steve French | 438dd92 | 2006-10-11 03:49:30 +0000 | [diff] [blame] | 1006 | leap year (divisable by 400) */ |
Steve French | 790fe57 | 2007-07-07 19:25:05 +0000 | [diff] [blame] | 1007 | if (year >= 120) /* the year 2100 */ |
Steve French | 438dd92 | 2006-10-11 03:49:30 +0000 | [diff] [blame] | 1008 | days = days - 1; /* do not count leap year for the year 2100 */ |
| 1009 | |
Steve French | 1bd5bbc | 2006-09-28 03:35:57 +0000 | [diff] [blame] | 1010 | /* adjust for leap year where we are still before leap day */ |
Steve French | 790fe57 | 2007-07-07 19:25:05 +0000 | [diff] [blame] | 1011 | if (year != 120) |
Steve French | 70903ca | 2006-10-11 18:49:24 +0000 | [diff] [blame] | 1012 | days -= ((year & 0x03) == 0) && (month < 2 ? 1 : 0); |
Steve French | 790fe57 | 2007-07-07 19:25:05 +0000 | [diff] [blame] | 1013 | sec += 24 * 60 * 60 * days; |
Steve French | 1bd5bbc | 2006-09-28 03:35:57 +0000 | [diff] [blame] | 1014 | |
Jeff Layton | c4a2c08 | 2009-05-27 09:37:33 -0400 | [diff] [blame] | 1015 | ts.tv_sec = sec + offset; |
Steve French | 1bd5bbc | 2006-09-28 03:35:57 +0000 | [diff] [blame] | 1016 | |
Joe Perches | f96637b | 2013-05-04 22:12:25 -0500 | [diff] [blame] | 1017 | /* cifs_dbg(FYI, "sec after cnvrt dos to unix time %d\n",sec); */ |
Steve French | 268f3be | 2006-10-06 21:47:09 +0000 | [diff] [blame] | 1018 | |
Steve French | 1bd5bbc | 2006-09-28 03:35:57 +0000 | [diff] [blame] | 1019 | ts.tv_nsec = 0; |
| 1020 | return ts; |
Steve French | 3870253 | 2007-07-08 15:40:40 +0000 | [diff] [blame] | 1021 | } |