ndr: merge duplicate ndr_map_error2ntstatus() functions.
authorGünther Deschner <gd@samba.org>
Fri, 28 Jan 2011 22:38:21 +0000 (23:38 +0100)
committerGünther Deschner <gd@samba.org>
Tue, 8 Feb 2011 07:58:11 +0000 (08:58 +0100)
Guenther

librpc/ndr/ndr_basic.c
source3/librpc/ndr/util.c
source4/libcli/util/errormap.c

index d628faaa9aa09e5e951a1fa4670bdaec84a0ab6f..1d67e11e9d2dc43c70e58af4bd8d073a8f031901 100644 (file)
@@ -1213,3 +1213,28 @@ _PUBLIC_ void ndr_print_bool(struct ndr_print *ndr, const char *name, const bool
 {
        ndr->print(ndr, "%-25s: %s", name, b?"true":"false");
 }
+
+_PUBLIC_ 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;
+}
index ed24f87387554ae4f4ba414aa57c9959bf2110a7..ada98108e50dbd422d94302a4b22de332709d4be 100644 (file)
 
 #include "includes.h"
 
-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;
-}
-
 /*
  * Convert an ndr error to string
  */
index 29f2331cdee4c4e9ef14a1537337649c47a7c1bd..a0154e370be675804e549d7b786826aefba9ff38 100644 (file)
@@ -20,7 +20,6 @@
  */
 
 #include "includes.h"
-#include "librpc/ndr/libndr.h"
 
 /* This map was extracted by the ERRMAPEXTRACT smbtorture command. 
    The setup was a Samba HEAD (2002-01-03) PDC and an Win2k member 
@@ -1388,28 +1387,3 @@ WERROR unix_to_werror(int unix_error)
 {
        return ntstatus_to_werror(map_nt_error_from_unix(unix_error));
 }
-
-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;
-}