summaryrefslogtreecommitdiffstats
path: root/librpc/ndr/ndr.c
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2011-03-08 10:14:51 +0100
committerGünther Deschner <gd@samba.org>2014-02-11 16:02:13 +0100
commite2a621466e740cc7fc2a659163f8895287c9a01e (patch)
treecc11efeb002f42e8f169cc153843ad334a1fdab9 /librpc/ndr/ndr.c
parent91b3e415d59feeb31a8255d147622a32e1bc64f1 (diff)
downloadsamba-e2a621466e740cc7fc2a659163f8895287c9a01e.tar.gz
samba-e2a621466e740cc7fc2a659163f8895287c9a01e.tar.xz
samba-e2a621466e740cc7fc2a659163f8895287c9a01e.zip
librpc/ndr: add NDR_ERR_INCOMPLETE_BUFFER and LIBNDR_FLAG_INCOMPLETE_BUFFER
If we pull a pipe chunk we need a way to check if we have enough bytes to parse the complete chunk. Setting ndr_pull->flags |= LIBNDR_FLAG_INCOMPLETE_BUFFER would change NDR_ERR_BUFSIZE (and later maybe others) into NDR_ERR_INCOMPLETE_BUFFER. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Guenther Deschner <gd@samba.org>
Diffstat (limited to 'librpc/ndr/ndr.c')
-rw-r--r--librpc/ndr/ndr.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/librpc/ndr/ndr.c b/librpc/ndr/ndr.c
index 3ed0310a639..99e9fe4d8fd 100644
--- a/librpc/ndr/ndr.c
+++ b/librpc/ndr/ndr.c
@@ -453,6 +453,15 @@ _PUBLIC_ enum ndr_err_code ndr_pull_error(struct ndr_pull *ndr,
va_list ap;
int ret;
+ if (ndr->flags & LIBNDR_FLAG_INCOMPLETE_BUFFER) {
+ switch (ndr_err) {
+ case NDR_ERR_BUFSIZE:
+ return NDR_ERR_INCOMPLETE_BUFFER;
+ default:
+ break;
+ }
+ }
+
va_start(ap, format);
ret = vasprintf(&s, format, ap);
va_end(ap);
@@ -1510,6 +1519,7 @@ const static struct {
{ NDR_ERR_INVALID_POINTER, "Invalid Pointer" },
{ NDR_ERR_UNREAD_BYTES, "Unread Bytes" },
{ NDR_ERR_NDR64, "NDR64 assertion error" },
+ { NDR_ERR_INCOMPLETE_BUFFER, "Incomplete Buffer" },
{ 0, NULL }
};