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