Author: metze Date: 2007-11-09 19:23:57 +0000 (Fri, 09 Nov 2007) New Revision: 25917
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=25917 Log: ndr: move ndr_map_error2ntstatus to errormap.c metze Modified: branches/SAMBA_4_0/source/libcli/util/error.h branches/SAMBA_4_0/source/libcli/util/errormap.c branches/SAMBA_4_0/source/librpc/ndr/ndr.c Changeset: Modified: branches/SAMBA_4_0/source/libcli/util/error.h =================================================================== --- branches/SAMBA_4_0/source/libcli/util/error.h 2007-11-09 19:23:40 UTC (rev 25916) +++ branches/SAMBA_4_0/source/libcli/util/error.h 2007-11-09 19:23:57 UTC (rev 25917) @@ -22,6 +22,7 @@ #include "libcli/util/werror.h" #include "libcli/util/doserr.h" #include "libcli/util/ntstatus.h" +#include "librpc/ndr/libndr.h" /** NT error on DOS connection! (NT_STATUS_OK) */ bool ntstatus_dos_equal(NTSTATUS status1, NTSTATUS status2); @@ -46,6 +47,9 @@ *********************************************************************/ NTSTATUS map_nt_error_from_unix(int unix_error); +/********************************************************************* + Map an NT error code from a NDR error code. +*********************************************************************/ +NTSTATUS ndr_map_error2ntstatus(enum ndr_err_code ndr_err); - #endif /* _SAMBA_ERROR_H */ Modified: branches/SAMBA_4_0/source/libcli/util/errormap.c =================================================================== --- branches/SAMBA_4_0/source/libcli/util/errormap.c 2007-11-09 19:23:40 UTC (rev 25916) +++ branches/SAMBA_4_0/source/libcli/util/errormap.c 2007-11-09 19:23:57 UTC (rev 25917) @@ -1375,3 +1375,28 @@ /* Default return */ return NT_STATUS_UNSUCCESSFUL; } + +NTSTATUS ndr_map_error2ntstatus(enum ndr_err_code ndr_err) +{ + switch (ndr_err) { + case NDR_ERR_SUCCESS: + return NT_STATUS_OK; + case NDR_ERR_BUFSIZE: + return NT_STATUS_BUFFER_TOO_SMALL; + case NDR_ERR_TOKEN: + return NT_STATUS_INTERNAL_ERROR; + case NDR_ERR_ALLOC: + return NT_STATUS_NO_MEMORY; + case NDR_ERR_ARRAY_SIZE: + return NT_STATUS_ARRAY_BOUNDS_EXCEEDED; + case NDR_ERR_INVALID_POINTER: + return NT_STATUS_INVALID_PARAMETER_MIX; + case NDR_ERR_UNREAD_BYTES: + return NT_STATUS_PORT_MESSAGE_TOO_LONG; + default: + break; + } + + /* we should map all error codes to different status codes */ + return NT_STATUS_INVALID_PARAMETER; +} Modified: branches/SAMBA_4_0/source/librpc/ndr/ndr.c =================================================================== --- branches/SAMBA_4_0/source/librpc/ndr/ndr.c 2007-11-09 19:23:40 UTC (rev 25916) +++ branches/SAMBA_4_0/source/librpc/ndr/ndr.c 2007-11-09 19:23:57 UTC (rev 25917) @@ -353,31 +353,6 @@ (*pflags) |= new_flags; } -NTSTATUS ndr_map_error2ntstatus(enum ndr_err_code ndr_err) -{ - switch (ndr_err) { - case NDR_ERR_SUCCESS: - return NT_STATUS_OK; - case NDR_ERR_BUFSIZE: - return NT_STATUS_BUFFER_TOO_SMALL; - case NDR_ERR_TOKEN: - return NT_STATUS_INTERNAL_ERROR; - case NDR_ERR_ALLOC: - return NT_STATUS_NO_MEMORY; - case NDR_ERR_ARRAY_SIZE: - return NT_STATUS_ARRAY_BOUNDS_EXCEEDED; - case NDR_ERR_INVALID_POINTER: - return NT_STATUS_INVALID_PARAMETER_MIX; - case NDR_ERR_UNREAD_BYTES: - return NT_STATUS_PORT_MESSAGE_TOO_LONG; - default: - break; - } - - /* we should map all error codes to different status codes */ - return NT_STATUS_INVALID_PARAMETER; -} - /* return and possibly log an NDR error */