summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source4/include/nt_status.h4
-rw-r--r--source4/libcli/raw/clitransport.c2
-rw-r--r--source4/libcli/util/errormap.c300
3 files changed, 34 insertions, 272 deletions
diff --git a/source4/include/nt_status.h b/source4/include/nt_status.h
index e427257aa9..a805a1cfbd 100644
--- a/source4/include/nt_status.h
+++ b/source4/include/nt_status.h
@@ -56,7 +56,9 @@ typedef uint32_t WERROR;
#define NT_STATUS_IS_OK(x) (NT_STATUS_V(x) == 0)
#define NT_STATUS_IS_ERR(x) ((NT_STATUS_V(x) & 0xc0000000) == 0xc0000000)
-#define NT_STATUS_EQUAL(x,y) (NT_STATUS_V(x) == NT_STATUS_V(y))
+/* checking for DOS error mapping here is ugly, but unfortunately the
+ alternative is a very intrusive rewrite of the torture code */
+#define NT_STATUS_EQUAL(x,y) (NT_STATUS_IS_DOS(x)||NT_STATUS_IS_DOS(y)?ntstatus_dos_equal(x,y):NT_STATUS_V(x) == NT_STATUS_V(y))
#define NT_STATUS_HAVE_NO_MEMORY(x) do { \
if (!(x)) {\
diff --git a/source4/libcli/raw/clitransport.c b/source4/libcli/raw/clitransport.c
index 51a718b10b..f286eff0ea 100644
--- a/source4/libcli/raw/clitransport.c
+++ b/source4/libcli/raw/clitransport.c
@@ -76,7 +76,7 @@ struct smbcli_transport *smbcli_transport_init(struct smbcli_socket *sock,
transport->socket = talloc_reference(transport, sock);
}
transport->negotiate.protocol = PROTOCOL_NT1;
- transport->options.use_spnego = lp_use_spnego();
+ transport->options.use_spnego = lp_use_spnego() && lp_nt_status_support();
transport->options.max_xmit = lp_max_xmit();
transport->options.max_mux = lp_maxmux();
transport->options.request_timeout = SMB_REQUEST_TIMEOUT;
diff --git a/source4/libcli/util/errormap.c b/source4/libcli/util/errormap.c
index b99ab3d2fe..76400c98a3 100644
--- a/source4/libcli/util/errormap.c
+++ b/source4/libcli/util/errormap.c
@@ -117,7 +117,7 @@ static const struct {
{ERRHRD, ERRgeneral, NT_STATUS_DISK_CORRUPT_ERROR},
{ERRDOS, ERRinvalidname, NT_STATUS_OBJECT_NAME_INVALID},
{ERRDOS, ERRbadfile, NT_STATUS_OBJECT_NAME_NOT_FOUND},
- {ERRDOS, 183, NT_STATUS_OBJECT_NAME_COLLISION},
+ {ERRDOS, ERRfilexists, NT_STATUS_OBJECT_NAME_COLLISION},
{ERRHRD, ERRgeneral, NT_STATUS_HANDLE_NOT_WAITABLE},
{ERRDOS, ERRbadfid, NT_STATUS_PORT_DISCONNECTED},
{ERRHRD, ERRgeneral, NT_STATUS_DEVICE_ALREADY_ATTACHED},
@@ -612,262 +612,6 @@ static const struct {
};
-/* dos -> nt status error map */
-static const struct {
- uint8_t dos_class;
- uint32_t dos_code;
- NTSTATUS ntstatus;
-} dos_to_ntstatus_map[] = {
- {ERRDOS, ERRnofiles, STATUS_NO_MORE_FILES},
- {ERRDOS, ERRbadfunc, NT_STATUS_NOT_IMPLEMENTED},
- {ERRDOS, ERRbadfile, NT_STATUS_NO_SUCH_FILE},
- {ERRDOS, ERRbadpath, NT_STATUS_OBJECT_PATH_NOT_FOUND},
- {ERRDOS, ERRnofids, NT_STATUS_TOO_MANY_OPENED_FILES},
- {ERRDOS, ERRnoaccess, NT_STATUS_ACCESS_DENIED},
- {ERRDOS, ERRbadfid, NT_STATUS_INVALID_HANDLE},
- {ERRDOS, ERRnomem, NT_STATUS_INSUFFICIENT_RESOURCES},
- {ERRDOS, ERRbadaccess, NT_STATUS_INVALID_LOCK_SEQUENCE},
- {ERRDOS, ERRbaddata, NT_STATUS_DATA_ERROR},
- {ERRDOS, 14, NT_STATUS_SECTION_NOT_EXTENDED},
- {ERRDOS, ERRremcd, NT_STATUS_DIRECTORY_NOT_EMPTY},
- {ERRDOS, ERRdiffdevice, NT_STATUS_NOT_SAME_DEVICE},
- {ERRDOS, 19, NT_STATUS_MEDIA_WRITE_PROTECTED},
- {ERRDOS, 21, NT_STATUS_NO_MEDIA_IN_DEVICE},
- {ERRDOS, 22, NT_STATUS_INVALID_DEVICE_STATE},
- {ERRDOS, 23, NT_STATUS_DATA_ERROR},
- {ERRDOS, 24, NT_STATUS_DATA_ERROR},
- {ERRDOS, 26, NT_STATUS_DISK_CORRUPT_ERROR},
- {ERRDOS, 27, NT_STATUS_NONEXISTENT_SECTOR},
- {ERRDOS, 28, NT_STATUS(0x8000000e)},
- {ERRDOS, 31, NT_STATUS_UNSUCCESSFUL},
- {ERRDOS, ERRbadshare, NT_STATUS_SHARING_VIOLATION},
- {ERRDOS, ERRlock, NT_STATUS_FILE_LOCK_CONFLICT},
- {ERRDOS, 34, NT_STATUS_WRONG_VOLUME},
- {ERRDOS, 38, NT_STATUS_END_OF_FILE},
- {ERRDOS, ERRunsup, NT_STATUS_CTL_FILE_NOT_SUPPORTED},
- {ERRDOS, 51, NT_STATUS_REMOTE_NOT_LISTENING},
- {ERRDOS, 52, NT_STATUS_DUPLICATE_NAME},
- {ERRDOS, 53, NT_STATUS_BAD_NETWORK_PATH},
- {ERRDOS, 54, NT_STATUS_NETWORK_BUSY},
- {ERRDOS, 55, NT_STATUS_DEVICE_DOES_NOT_EXIST},
- {ERRDOS, 56, NT_STATUS_TOO_MANY_COMMANDS},
- {ERRDOS, 57, NT_STATUS_ADAPTER_HARDWARE_ERROR},
- {ERRDOS, 58, NT_STATUS_INVALID_NETWORK_RESPONSE},
- {ERRDOS, 59, NT_STATUS_UNEXPECTED_NETWORK_ERROR},
- {ERRDOS, 60, NT_STATUS_BAD_REMOTE_ADAPTER},
- {ERRDOS, 61, NT_STATUS_PRINT_QUEUE_FULL},
- {ERRDOS, 62, NT_STATUS_NO_SPOOL_SPACE},
- {ERRDOS, 63, NT_STATUS_PRINT_CANCELLED},
- {ERRDOS, 64, NT_STATUS_NETWORK_NAME_DELETED},
- {ERRDOS, 65, NT_STATUS_NETWORK_ACCESS_DENIED},
- {ERRDOS, 66, NT_STATUS_BAD_DEVICE_TYPE},
- {ERRDOS, ERRnosuchshare, NT_STATUS_BAD_NETWORK_NAME},
- {ERRDOS, 68, NT_STATUS_TOO_MANY_GUIDS_REQUESTED},
- {ERRDOS, 69, NT_STATUS_TOO_MANY_SESSIONS},
- {ERRDOS, 70, NT_STATUS_SHARING_PAUSED},
- {ERRDOS, 71, NT_STATUS_REQUEST_NOT_ACCEPTED},
- {ERRDOS, 72, NT_STATUS_REDIRECTOR_PAUSED},
- {ERRDOS, ERRfilexists, NT_STATUS_OBJECT_NAME_COLLISION},
- {ERRDOS, 86, NT_STATUS_WRONG_PASSWORD},
- {ERRDOS, 87, NT_STATUS_INVALID_INFO_CLASS},
- {ERRDOS, 88, NT_STATUS_NET_WRITE_FAULT},
- {ERRDOS, 109, NT_STATUS_PIPE_BROKEN},
- {ERRDOS, 111, STATUS_MORE_ENTRIES},
- {ERRDOS, 112, NT_STATUS_DISK_FULL},
- {ERRDOS, 121, NT_STATUS_IO_TIMEOUT},
- {ERRDOS, 122, NT_STATUS_BUFFER_TOO_SMALL},
- {ERRDOS, ERRinvalidname, NT_STATUS_OBJECT_NAME_INVALID},
- {ERRDOS, 124, NT_STATUS_INVALID_LEVEL},
- {ERRDOS, 126, NT_STATUS_DLL_NOT_FOUND},
- {ERRDOS, 127, NT_STATUS_PROCEDURE_NOT_FOUND},
- {ERRDOS, 145, NT_STATUS_DIRECTORY_NOT_EMPTY},
- {ERRDOS, 154, NT_STATUS_INVALID_VOLUME_LABEL},
- {ERRDOS, 156, NT_STATUS_SUSPEND_COUNT_EXCEEDED},
- {ERRDOS, 158, NT_STATUS_NOT_LOCKED},
- {ERRDOS, 161, NT_STATUS_OBJECT_PATH_INVALID},
- {ERRDOS, 170, NT_STATUS(0x80000011)},
- {ERRDOS, 182, NT_STATUS_ORDINAL_NOT_FOUND},
- {ERRDOS, 183, NT_STATUS_OBJECT_NAME_COLLISION},
- {ERRDOS, 193, NT_STATUS_BAD_INITIAL_PC},
- {ERRDOS, 203, NT_STATUS(0xc0000100)},
- {ERRDOS, 206, NT_STATUS_NAME_TOO_LONG},
- {ERRDOS, ERRbadpipe, NT_STATUS_INVALID_INFO_CLASS},
- {ERRDOS, ERRpipebusy, NT_STATUS_INSTANCE_NOT_AVAILABLE},
- {ERRDOS, ERRpipeclosing, NT_STATUS_PIPE_CLOSING},
- {ERRDOS, ERRnotconnected, NT_STATUS_PIPE_DISCONNECTED},
- {ERRDOS, ERRmoredata, NT_STATUS_MORE_PROCESSING_REQUIRED},
- {ERRDOS, 240, NT_STATUS_VIRTUAL_CIRCUIT_CLOSED},
- {ERRDOS, 254, NT_STATUS(0x80000013)},
- {ERRDOS, 255, NT_STATUS_EA_TOO_LARGE},
- {ERRDOS, 259, NT_STATUS_GUIDS_EXHAUSTED},
- {ERRDOS, 267, NT_STATUS_NOT_A_DIRECTORY},
- {ERRDOS, 275, NT_STATUS_EA_TOO_LARGE},
- {ERRDOS, 276, NT_STATUS_NONEXISTENT_EA_ENTRY},
- {ERRDOS, 277, NT_STATUS_NONEXISTENT_EA_ENTRY},
- {ERRDOS, 278, NT_STATUS_NONEXISTENT_EA_ENTRY},
- {ERRDOS, 282, NT_STATUS_EAS_NOT_SUPPORTED},
- {ERRDOS, 288, NT_STATUS_MUTANT_NOT_OWNED},
- {ERRDOS, 298, NT_STATUS_SEMAPHORE_LIMIT_EXCEEDED},
- {ERRDOS, 299, NT_STATUS(0x8000000d)},
- {ERRDOS, 300, NT_STATUS_OPLOCK_NOT_GRANTED},
- {ERRDOS, 301, NT_STATUS_INVALID_OPLOCK_PROTOCOL},
- {ERRDOS, 487, NT_STATUS_CONFLICTING_ADDRESSES},
- {ERRDOS, 534, NT_STATUS_INTEGER_OVERFLOW},
- {ERRDOS, 535, NT_STATUS_PIPE_CONNECTED},
- {ERRDOS, 536, NT_STATUS_PIPE_LISTENING},
- {ERRDOS, 995, NT_STATUS_CANCELLED},
- {ERRDOS, 997, NT_STATUS(0x00000103)},
- {ERRDOS, 998, NT_STATUS_ACCESS_VIOLATION},
- {ERRDOS, 999, NT_STATUS_IN_PAGE_ERROR},
- {ERRDOS, 1001, NT_STATUS_BAD_INITIAL_STACK},
- {ERRDOS, 1005, NT_STATUS_UNRECOGNIZED_VOLUME},
- {ERRDOS, 1006, NT_STATUS_FILE_INVALID},
- {ERRDOS, 1007, NT_STATUS_FULLSCREEN_MODE},
- {ERRDOS, 1008, NT_STATUS_NO_TOKEN},
- {ERRDOS, 1009, NT_STATUS_REGISTRY_CORRUPT},
- {ERRDOS, 1016, NT_STATUS_REGISTRY_IO_FAILED},
- {ERRDOS, 1017, NT_STATUS_NOT_REGISTRY_FILE},
- {ERRDOS, 1018, NT_STATUS_KEY_DELETED},
- {ERRDOS, 1019, NT_STATUS_NO_LOG_SPACE},
- {ERRDOS, 1020, NT_STATUS_KEY_HAS_CHILDREN},
- {ERRDOS, 1021, NT_STATUS_CHILD_MUST_BE_VOLATILE},
- {ERRDOS, 1022, NT_STATUS(0x0000010c)},
- {ERRSRV, ERRbadpw, NT_STATUS_WRONG_PASSWORD},
- {ERRSRV, ERRbadtype, NT_STATUS_BAD_DEVICE_TYPE},
- {ERRSRV, ERRaccess, NT_STATUS_NETWORK_ACCESS_DENIED},
- {ERRSRV, ERRinvnid, NT_STATUS_NETWORK_NAME_DELETED},
- {ERRSRV, ERRinvnetname, NT_STATUS_BAD_NETWORK_NAME},
- {ERRSRV, ERRinvdevice, NT_STATUS_BAD_DEVICE_TYPE},
- {ERRSRV, ERRqfull, NT_STATUS_PRINT_QUEUE_FULL},
- {ERRSRV, ERRqtoobig, NT_STATUS_NO_SPOOL_SPACE},
- {ERRSRV, ERRinvpfid, NT_STATUS_PRINT_CANCELLED},
- {ERRSRV, ERRsmbcmd, NT_STATUS_NOT_IMPLEMENTED},
- {ERRSRV, ERRbadpermits, NT_STATUS_NETWORK_ACCESS_DENIED},
- {ERRSRV, ERRpaused, NT_STATUS_SHARING_PAUSED},
- {ERRSRV, ERRmsgoff, NT_STATUS_REQUEST_NOT_ACCEPTED},
- {ERRSRV, ERRnoroom, NT_STATUS_DISK_FULL},
- {ERRSRV, ERRnoresource, NT_STATUS_REQUEST_NOT_ACCEPTED},
- {ERRSRV, ERRtoomanyuids, NT_STATUS_TOO_MANY_SESSIONS},
- {ERRSRV, ERRbaduid, NT_STATUS_INVALID_HANDLE},
- {ERRSRV, 123, NT_STATUS_OBJECT_NAME_INVALID},
- {ERRSRV, 206, NT_STATUS_OBJECT_NAME_INVALID},
- {ERRHRD, 1, NT_STATUS_NOT_IMPLEMENTED},
- {ERRHRD, 2, NT_STATUS_NO_SUCH_DEVICE},
- {ERRHRD, 3, NT_STATUS_OBJECT_PATH_NOT_FOUND},
- {ERRHRD, 4, NT_STATUS_TOO_MANY_OPENED_FILES},
- {ERRHRD, 5, NT_STATUS_INVALID_LOCK_SEQUENCE},
- {ERRHRD, 6, NT_STATUS_INVALID_HANDLE},
- {ERRHRD, 8, NT_STATUS_INSUFFICIENT_RESOURCES},
- {ERRHRD, 12, NT_STATUS_INVALID_LOCK_SEQUENCE},
- {ERRHRD, 13, NT_STATUS_DATA_ERROR},
- {ERRHRD, 14, NT_STATUS_SECTION_NOT_EXTENDED},
- {ERRHRD, 16, NT_STATUS_DIRECTORY_NOT_EMPTY},
- {ERRHRD, 17, NT_STATUS_NOT_SAME_DEVICE},
- {ERRHRD, 18, NT_STATUS(0x80000006)},
- {ERRHRD, ERRnowrite, NT_STATUS_MEDIA_WRITE_PROTECTED},
- {ERRHRD, ERRnotready, NT_STATUS_NO_MEDIA_IN_DEVICE},
- {ERRHRD, ERRbadcmd, NT_STATUS_INVALID_DEVICE_STATE},
- {ERRHRD, ERRdata, NT_STATUS_DATA_ERROR},
- {ERRHRD, ERRbadreq, NT_STATUS_DATA_ERROR},
- {ERRHRD, ERRbadmedia, NT_STATUS_DISK_CORRUPT_ERROR},
- {ERRHRD, ERRbadsector, NT_STATUS_NONEXISTENT_SECTOR},
- {ERRHRD, ERRnopaper, NT_STATUS(0x8000000e)},
- {ERRHRD, ERRgeneral, NT_STATUS_UNSUCCESSFUL},
- {ERRHRD, ERRbadshare, NT_STATUS_SHARING_VIOLATION},
- {ERRHRD, ERRlock, NT_STATUS_FILE_LOCK_CONFLICT},
- {ERRHRD, ERRwrongdisk, NT_STATUS_WRONG_VOLUME},
- {ERRHRD, 38, NT_STATUS_END_OF_FILE},
- {ERRHRD, ERRdiskfull, NT_STATUS_DISK_FULL},
- {ERRHRD, 50, NT_STATUS_CTL_FILE_NOT_SUPPORTED},
- {ERRHRD, 51, NT_STATUS_REMOTE_NOT_LISTENING},
- {ERRHRD, 52, NT_STATUS_DUPLICATE_NAME},
- {ERRHRD, 53, NT_STATUS_BAD_NETWORK_PATH},
- {ERRHRD, 54, NT_STATUS_NETWORK_BUSY},
- {ERRHRD, 55, NT_STATUS_DEVICE_DOES_NOT_EXIST},
- {ERRHRD, 56, NT_STATUS_TOO_MANY_COMMANDS},
- {ERRHRD, 57, NT_STATUS_ADAPTER_HARDWARE_ERROR},
- {ERRHRD, 58, NT_STATUS_INVALID_NETWORK_RESPONSE},
- {ERRHRD, 59, NT_STATUS_UNEXPECTED_NETWORK_ERROR},
- {ERRHRD, 60, NT_STATUS_BAD_REMOTE_ADAPTER},
- {ERRHRD, 61, NT_STATUS_PRINT_QUEUE_FULL},
- {ERRHRD, 62, NT_STATUS_NO_SPOOL_SPACE},
- {ERRHRD, 63, NT_STATUS_PRINT_CANCELLED},
- {ERRHRD, 64, NT_STATUS_NETWORK_NAME_DELETED},
- {ERRHRD, 65, NT_STATUS_NETWORK_ACCESS_DENIED},
- {ERRHRD, 66, NT_STATUS_BAD_DEVICE_TYPE},
- {ERRHRD, 67, NT_STATUS_BAD_NETWORK_NAME},
- {ERRHRD, 68, NT_STATUS_TOO_MANY_GUIDS_REQUESTED},
- {ERRHRD, 69, NT_STATUS_TOO_MANY_SESSIONS},
- {ERRHRD, 70, NT_STATUS_SHARING_PAUSED},
- {ERRHRD, 71, NT_STATUS_REQUEST_NOT_ACCEPTED},
- {ERRHRD, 72, NT_STATUS_REDIRECTOR_PAUSED},
- {ERRHRD, 80, NT_STATUS_OBJECT_NAME_COLLISION},
- {ERRHRD, 86, NT_STATUS_WRONG_PASSWORD},
- {ERRHRD, 87, NT_STATUS_INVALID_INFO_CLASS},
- {ERRHRD, 88, NT_STATUS_NET_WRITE_FAULT},
- {ERRHRD, 109, NT_STATUS_PIPE_BROKEN},
- {ERRHRD, 111, STATUS_MORE_ENTRIES},
- {ERRHRD, 112, NT_STATUS_DISK_FULL},
- {ERRHRD, 121, NT_STATUS_IO_TIMEOUT},
- {ERRHRD, 122, NT_STATUS_BUFFER_TOO_SMALL},
- {ERRHRD, 123, NT_STATUS_OBJECT_NAME_INVALID},
- {ERRHRD, 124, NT_STATUS_INVALID_LEVEL},
- {ERRHRD, 126, NT_STATUS_DLL_NOT_FOUND},
- {ERRHRD, 127, NT_STATUS_PROCEDURE_NOT_FOUND},
- {ERRHRD, 145, NT_STATUS_DIRECTORY_NOT_EMPTY},
- {ERRHRD, 154, NT_STATUS_INVALID_VOLUME_LABEL},
- {ERRHRD, 156, NT_STATUS_SUSPEND_COUNT_EXCEEDED},
- {ERRHRD, 158, NT_STATUS_NOT_LOCKED},
- {ERRHRD, 161, NT_STATUS_OBJECT_PATH_INVALID},
- {ERRHRD, 170, NT_STATUS(0x80000011)},
- {ERRHRD, 182, NT_STATUS_ORDINAL_NOT_FOUND},
- {ERRHRD, 183, NT_STATUS_OBJECT_NAME_COLLISION},
- {ERRHRD, 193, NT_STATUS_BAD_INITIAL_PC},
- {ERRHRD, 203, NT_STATUS(0xc0000100)},
- {ERRHRD, 206, NT_STATUS_NAME_TOO_LONG},
- {ERRHRD, 230, NT_STATUS_INVALID_INFO_CLASS},
- {ERRHRD, 231, NT_STATUS_INSTANCE_NOT_AVAILABLE},
- {ERRHRD, 232, NT_STATUS_PIPE_CLOSING},
- {ERRHRD, 233, NT_STATUS_PIPE_DISCONNECTED},
- {ERRHRD, 234, STATUS_MORE_ENTRIES},
- {ERRHRD, 240, NT_STATUS_VIRTUAL_CIRCUIT_CLOSED},
- {ERRHRD, 254, NT_STATUS(0x80000013)},
- {ERRHRD, 255, NT_STATUS_EA_TOO_LARGE},
- {ERRHRD, 259, NT_STATUS_GUIDS_EXHAUSTED},
- {ERRHRD, 267, NT_STATUS_NOT_A_DIRECTORY},
- {ERRHRD, 275, NT_STATUS_EA_TOO_LARGE},
- {ERRHRD, 276, NT_STATUS_NONEXISTENT_EA_ENTRY},
- {ERRHRD, 277, NT_STATUS_NONEXISTENT_EA_ENTRY},
- {ERRHRD, 278, NT_STATUS_NONEXISTENT_EA_ENTRY},
- {ERRHRD, 282, NT_STATUS_EAS_NOT_SUPPORTED},
- {ERRHRD, 288, NT_STATUS_MUTANT_NOT_OWNED},
- {ERRHRD, 298, NT_STATUS_SEMAPHORE_LIMIT_EXCEEDED},
- {ERRHRD, 299, NT_STATUS(0x8000000d)},
- {ERRHRD, 300, NT_STATUS_OPLOCK_NOT_GRANTED},
- {ERRHRD, 301, NT_STATUS_INVALID_OPLOCK_PROTOCOL},
- {ERRHRD, 487, NT_STATUS_CONFLICTING_ADDRESSES},
- {ERRHRD, 534, NT_STATUS_INTEGER_OVERFLOW},
- {ERRHRD, 535, NT_STATUS_PIPE_CONNECTED},
- {ERRHRD, 536, NT_STATUS_PIPE_LISTENING},
- {ERRHRD, 995, NT_STATUS_CANCELLED},
- {ERRHRD, 997, NT_STATUS(0x00000103)},
- {ERRHRD, 998, NT_STATUS_ACCESS_VIOLATION},
- {ERRHRD, 999, NT_STATUS_IN_PAGE_ERROR},
- {ERRHRD, 1001, NT_STATUS_BAD_INITIAL_STACK},
- {ERRHRD, 1005, NT_STATUS_UNRECOGNIZED_VOLUME},
- {ERRHRD, 1006, NT_STATUS_FILE_INVALID},
- {ERRHRD, 1007, NT_STATUS_FULLSCREEN_MODE},
- {ERRHRD, 1008, NT_STATUS_NO_TOKEN},
- {ERRHRD, 1009, NT_STATUS_REGISTRY_CORRUPT},
- {ERRHRD, 1016, NT_STATUS_REGISTRY_IO_FAILED},
- {ERRHRD, 1017, NT_STATUS_NOT_REGISTRY_FILE},
- {ERRHRD, 1018, NT_STATUS_KEY_DELETED},
- {ERRHRD, 1019, NT_STATUS_NO_LOG_SPACE},
- {ERRHRD, 1020, NT_STATUS_KEY_HAS_CHILDREN},
- {ERRHRD, 1021, NT_STATUS_CHILD_MUST_BE_VOLATILE},
- {ERRHRD, 1022, NT_STATUS(0x0000010c)},
-};
-
/* errmap NTSTATUS->Win32 */
static const struct {
NTSTATUS ntstatus;
@@ -1410,22 +1154,38 @@ static const struct {
{NT_STATUS_OK, WERR_OK}};
-/*****************************************************************************
-convert a dos eclas/ecode to a NT status32 code
- *****************************************************************************/
-NTSTATUS dos_to_ntstatus(uint8_t eclass, uint32_t ecode)
+/*
+ check if a DOS encoded NTSTATUS code maps to the given NTSTATUS code
+*/
+BOOL ntstatus_dos_equal(NTSTATUS status1, NTSTATUS status2)
{
- int i;
- if (eclass == 0 && ecode == 0) return NT_STATUS_OK;
- for (i=0; NT_STATUS_V(dos_to_ntstatus_map[i].ntstatus); i++) {
- if (eclass == dos_to_ntstatus_map[i].dos_class &&
- ecode == dos_to_ntstatus_map[i].dos_code) {
- return dos_to_ntstatus_map[i].ntstatus;
- }
+ /* when we negotiate nt status support, we don't want to consider
+ the mapping of dos codes, as we want to catch the cases where
+ a forced dos code is needed
+ */
+ if (lp_nt_status_support()) {
+ return NT_STATUS_V(status1) == NT_STATUS_V(status2);
}
- return NT_STATUS_UNSUCCESSFUL;
-}
+ /* otherwise check if the mapping comes out right. Note that it is important
+ that we do the mapping only from ntstatus -> dos and not from dos -> ntstatus,
+ as that is the mapping that servers must do */
+ if (!NT_STATUS_IS_DOS(status1) && NT_STATUS_IS_DOS(status2)) {
+ uint8_t eclass;
+ uint32_t ecode;
+ ntstatus_to_dos(status1, &eclass, &ecode);
+ return eclass == NT_STATUS_DOS_CLASS(status2) &&
+ ecode == NT_STATUS_DOS_CODE(status2);
+ }
+ if (NT_STATUS_IS_DOS(status1) && !NT_STATUS_IS_DOS(status2)) {
+ uint8_t eclass;
+ uint32_t ecode;
+ ntstatus_to_dos(status2, &eclass, &ecode);
+ return eclass == NT_STATUS_DOS_CLASS(status1) &&
+ ecode == NT_STATUS_DOS_CODE(status1);
+ }
+ return NT_STATUS_V(status1) == NT_STATUS_V(status2);
+}
/*****************************************************************************
convert a NT status code to a dos class/code