diff options
author | metze <metze@0c0555d6-39d7-0310-84fc-f1cc0bd64818> | 2007-11-01 09:50:24 +0000 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2007-11-07 12:10:30 +0100 |
commit | e04b21f7d4ac5e8940d38d231c46064152cdbf7f (patch) | |
tree | 2055f4fffbd3a17a0c787e2a344c424964ac0055 | |
parent | fbb8cff0b801f61dfe93688223cd82a639e0b7cc (diff) | |
download | samba-e04b21f7d4ac5e8940d38d231c46064152cdbf7f.tar.gz samba-e04b21f7d4ac5e8940d38d231c46064152cdbf7f.tar.bz2 samba-e04b21f7d4ac5e8940d38d231c46064152cdbf7f.zip |
add NDR_ERR_UNREAD_BYTES and don't use NTSTATUS directly
metze
git-svn-id: svn+ssh://svn.samba.org/data/svn/samba/branches/SAMBA_4_0@25777 0c0555d6-39d7-0310-84fc-f1cc0bd64818
(This used to be commit 52c422f4d7f8549a11d637de1abceabc1ae86497)
-rw-r--r-- | source3/librpc/ndr/libndr.h | 3 | ||||
-rw-r--r-- | source3/librpc/ndr/ndr.c | 10 |
2 files changed, 10 insertions, 3 deletions
diff --git a/source3/librpc/ndr/libndr.h b/source3/librpc/ndr/libndr.h index ee27464031..f09693feb8 100644 --- a/source3/librpc/ndr/libndr.h +++ b/source3/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/source3/librpc/ndr/ndr.c b/source3/librpc/ndr/ndr.c index 3ceb728a3f..26bda33723 100644 --- a/source3/librpc/ndr/ndr.c +++ b/source3/librpc/ndr/ndr.c @@ -330,6 +330,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; } @@ -711,7 +713,9 @@ NTSTATUS ndr_pull_struct_blob_all(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx, vo 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; } @@ -749,7 +753,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; } |