r11973: make it easier to find bugs
authorStefan Metzmacher <metze@samba.org>
Wed, 30 Nov 2005 13:10:44 +0000 (13:10 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:46:53 +0000 (13:46 -0500)
metze
(This used to be commit 247f90c28d845fd2224cb07ed30d3e8122ba5644)

source4/librpc/ndr/libndr.h
source4/librpc/ndr/ndr_basic.c

index 7df3650e4af8868f0ebeea982bed4e139aeea55f..ca66078614398f06c99fe81c461ccfa5c0f74918 100644 (file)
@@ -166,7 +166,8 @@ enum ndr_err_code {
        NDR_ERR_BUFSIZE,
        NDR_ERR_ALLOC,
        NDR_ERR_RANGE,
-       NDR_ERR_TOKEN
+       NDR_ERR_TOKEN,
+       NDR_ERR_IPV4ADDRESS
 };
 
 enum ndr_compression_alg {
index d76fa45ec3848374fb61f4c9ca254b7c2922f7af..f22e7989bfdf7ce207e1d7a0e4b42ea023b16ba7 100644 (file)
@@ -570,7 +570,11 @@ NTSTATUS ndr_pull_ipv4address(struct ndr_pull *ndr, int ndr_flags, const char **
 NTSTATUS ndr_push_ipv4address(struct ndr_push *ndr, int ndr_flags, const char *address)
 {
        uint32_t addr;
-       if (!is_ipaddress(address)) return NT_STATUS_INVALID_PARAMETER_MIX;
+       if (!is_ipaddress(address)) {
+               return ndr_push_error(ndr, NDR_ERR_IPV4ADDRESS,
+                                     "Invalid IPv4 address: '%s'", 
+                                     address);
+       }
        addr = inet_addr(address);
        NDR_CHECK(ndr_push_uint32(ndr, ndr_flags, htonl(addr)));
        return NT_STATUS_OK;