summaryrefslogtreecommitdiff
path: root/source4/librpc/ndr
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2005-03-12 08:29:54 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:11:01 -0500
commite90c904a5f9b3b10a2e304be3a532ceb83424cb5 (patch)
treec2cb689c85ec789036f9924f9773dacabbd378f1 /source4/librpc/ndr
parent4b83366b6cf81a29fab0f9dac5e6074784c639a8 (diff)
downloadsamba-e90c904a5f9b3b10a2e304be3a532ceb83424cb5.tar.gz
samba-e90c904a5f9b3b10a2e304be3a532ceb83424cb5.tar.bz2
samba-e90c904a5f9b3b10a2e304be3a532ceb83424cb5.zip
r5764: add support for embedded ref pointers
metze (This used to be commit 112043b1809a96b1a39ade71ea2885c0d792c79f)
Diffstat (limited to 'source4/librpc/ndr')
-rw-r--r--source4/librpc/ndr/ndr_basic.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/source4/librpc/ndr/ndr_basic.c b/source4/librpc/ndr/ndr_basic.c
index 24ca8dcd0e..0ea38c21c2 100644
--- a/source4/librpc/ndr/ndr_basic.c
+++ b/source4/librpc/ndr/ndr_basic.c
@@ -119,6 +119,18 @@ NTSTATUS ndr_pull_unique_ptr(struct ndr_pull *ndr, uint32_t *v)
}
/*
+ parse a ref pointer referent identifier
+*/
+NTSTATUS ndr_pull_ref_ptr(struct ndr_pull *ndr, uint32_t *v)
+{
+ NTSTATUS status;
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, v));
+ /* ref pointers always point to data */
+ *v = 1;
+ return status;
+}
+
+/*
parse a udlong
*/
NTSTATUS ndr_pull_udlong(struct ndr_pull *ndr, int ndr_flags, uint64_t *v)
@@ -506,7 +518,7 @@ void ndr_push_restore(struct ndr_push *ndr, struct ndr_push_save *save)
}
/*
- push a 1 if a pointer is non-NULL, otherwise 0
+ push a unique non-zero value if a pointer is non-NULL, otherwise 0
*/
NTSTATUS ndr_push_unique_ptr(struct ndr_push *ndr, const void *p)
{
@@ -518,6 +530,17 @@ NTSTATUS ndr_push_unique_ptr(struct ndr_push *ndr, const void *p)
return ndr_push_uint32(ndr, NDR_SCALARS, ptr);
}
+/*
+ push always a 0, if a pointer is NULL it's a fatal error
+*/
+NTSTATUS ndr_push_ref_ptr(struct ndr_push *ndr, const void *p)
+{
+ uint32_t ptr = 0;
+ if (p == NULL) {
+ return NT_STATUS_INVALID_PARAMETER_MIX;
+ }
+ return ndr_push_uint32(ndr, NDR_SCALARS, 0);
+}
/*
pull a general string from the wire