summaryrefslogtreecommitdiff
path: root/source4/librpc/ndr/ndr_basic.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2003-11-17 02:18:11 +0000
committerAndrew Tridgell <tridge@samba.org>2003-11-17 02:18:11 +0000
commit657b4d2abdad5691fc37bafe819f75cc440354b9 (patch)
treea66c51ef8e39efa62e5b7a5f9e2e227bd3138935 /source4/librpc/ndr/ndr_basic.c
parentcc5f231e95b2a322a1f1f118b8a3a363a0e4d0cc (diff)
downloadsamba-657b4d2abdad5691fc37bafe819f75cc440354b9.tar.gz
samba-657b4d2abdad5691fc37bafe819f75cc440354b9.tar.bz2
samba-657b4d2abdad5691fc37bafe819f75cc440354b9.zip
nicer method of handling spoolss EnumPrinters
this also handles the return of several printers (an array of relative subcontexts) (This used to be commit 060421c7dc9aa611fe4160843a4f76498ab16bf4)
Diffstat (limited to 'source4/librpc/ndr/ndr_basic.c')
-rw-r--r--source4/librpc/ndr/ndr_basic.c36
1 files changed, 32 insertions, 4 deletions
diff --git a/source4/librpc/ndr/ndr_basic.c b/source4/librpc/ndr/ndr_basic.c
index 408d041e3c..2c6a3aac96 100644
--- a/source4/librpc/ndr/ndr_basic.c
+++ b/source4/librpc/ndr/ndr_basic.c
@@ -440,14 +440,18 @@ void ndr_print_ptr(struct ndr_print *ndr, const char *name, const void *p)
}
}
-void ndr_print_unistr_noterm(struct ndr_print *ndr, const char *name, const char *s)
+void ndr_print_unistr(struct ndr_print *ndr, const char *name, const char *s)
{
- ndr->print(ndr, "%-25s: '%s'", name, s);
+ if (s) {
+ ndr->print(ndr, "%-25s: '%s'", name, s);
+ } else {
+ ndr->print(ndr, "%-25s: NULL", name);
+ }
}
-void ndr_print_unistr(struct ndr_print *ndr, const char *name, const char *s)
+void ndr_print_unistr_noterm(struct ndr_print *ndr, const char *name, const char *s)
{
- ndr->print(ndr, "%-25s: '%s'", name, s);
+ ndr_print_unistr(ndr, name, s);
}
void ndr_print_NTTIME(struct ndr_print *ndr, const char *name, NTTIME t)
@@ -560,3 +564,27 @@ void ndr_print_nstring(struct ndr_print *ndr, const char *name, const char **s)
{
ndr_print_unistr(ndr, name, *s);
}
+
+
+/*
+ push a DATA_BLOB onto the wire.
+*/
+NTSTATUS ndr_push_DATA_BLOB(struct ndr_push *ndr, DATA_BLOB blob)
+{
+ NDR_CHECK(ndr_push_uint32(ndr, blob.length));
+ NDR_CHECK(ndr_push_bytes(ndr, blob.data, blob.length));
+ return NT_STATUS_OK;
+}
+
+/*
+ pull a DATA_BLOB from the wire.
+*/
+NTSTATUS ndr_pull_DATA_BLOB(struct ndr_pull *ndr, DATA_BLOB *blob)
+{
+ uint32 length;
+ NDR_CHECK(ndr_pull_uint32(ndr, &length));
+ NDR_PULL_NEED_BYTES(ndr, length);
+ *blob = data_blob_talloc(ndr->mem_ctx, ndr->data+ndr->offset, length);
+ ndr->offset += length;
+ return NT_STATUS_OK;
+}