summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2007-11-01 09:50:24 +0100
committerStefan Metzmacher <metze@samba.org>2007-12-21 05:43:54 +0100
commit5885662475ab8baa1732a88a4bec0f1361edc4fb (patch)
tree80996af3fc195100245e3592612973ac85a886d4 /source4
parent5ef00987cb8363b32776c14ade64edd7ee9bfed2 (diff)
downloadsamba-5885662475ab8baa1732a88a4bec0f1361edc4fb.tar.gz
samba-5885662475ab8baa1732a88a4bec0f1361edc4fb.tar.bz2
samba-5885662475ab8baa1732a88a4bec0f1361edc4fb.zip
r25777: add NDR_ERR_UNREAD_BYTES and don't use NTSTATUS directly
metze (This used to be commit 757d547696b1f2903429cfa831c2b0922ab6d2fc)
Diffstat (limited to 'source4')
-rw-r--r--source4/librpc/ndr/libndr.h3
-rw-r--r--source4/librpc/ndr/ndr.c10
2 files changed, 10 insertions, 3 deletions
diff --git a/source4/librpc/ndr/libndr.h b/source4/librpc/ndr/libndr.h
index 1f0a3a976c..84a2bd52e3 100644
--- a/source4/librpc/ndr/libndr.h
+++ b/source4/librpc/ndr/libndr.h
@@ -175,7 +175,8 @@ enum ndr_err_code {
NDR_ERR_RANGE,
NDR_ERR_TOKEN,
NDR_ERR_IPV4ADDRESS,
- NDR_ERR_INVALID_POINTER
+ NDR_ERR_INVALID_POINTER,
+ NDR_ERR_UNREAD_BYTES
};
enum ndr_compression_alg {
diff --git a/source4/librpc/ndr/ndr.c b/source4/librpc/ndr/ndr.c
index c209ee8088..f12be783b1 100644
--- a/source4/librpc/ndr/ndr.c
+++ b/source4/librpc/ndr/ndr.c
@@ -367,6 +367,8 @@ static NTSTATUS ndr_map_error(enum ndr_err_code ndr_err)
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;
}
@@ -748,7 +750,9 @@ _PUBLIC_ NTSTATUS ndr_pull_struct_blob_all(const DATA_BLOB *blob, TALLOC_CTX *me
status = fn(ndr, NDR_SCALARS|NDR_BUFFERS, p);
if (!NT_STATUS_IS_OK(status)) return status;
if (ndr->offset < ndr->data_size) {
- return NT_STATUS_PORT_MESSAGE_TOO_LONG;
+ return ndr_pull_error(ndr, NDR_ERR_UNREAD_BYTES,
+ "not all bytes consumed ofs[%u] size[%u]",
+ ndr->offset, ndr->data_size);
}
return NT_STATUS_OK;
}
@@ -786,7 +790,9 @@ _PUBLIC_ NTSTATUS ndr_pull_union_blob_all(const DATA_BLOB *blob, TALLOC_CTX *mem
status = fn(ndr, NDR_SCALARS|NDR_BUFFERS, p);
if (!NT_STATUS_IS_OK(status)) return status;
if (ndr->offset < ndr->data_size) {
- return NT_STATUS_PORT_MESSAGE_TOO_LONG;
+ return ndr_pull_error(ndr, NDR_ERR_UNREAD_BYTES,
+ "not all bytes consumed ofs[%u] size[%u]",
+ ndr->offset, ndr->data_size);
}
return NT_STATUS_OK;
}