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