summaryrefslogtreecommitdiffstats
path: root/librpc/ndr/ndr_dnsserver.c
diff options
context:
space:
mode:
authorAmitay Isaacs <amitay@gmail.com>2012-02-28 14:57:23 +1100
committerAmitay Isaacs <amitay@gmail.com>2012-03-02 00:24:50 +1100
commita0d6904ed30b7edd41715c0e8c8517e1486b38e4 (patch)
tree222e101b86c4ce95126a29ebca93197dac780f0e /librpc/ndr/ndr_dnsserver.c
parente15fc28e6bdf4488940260c8a26459845283f617 (diff)
downloadsamba-a0d6904ed30b7edd41715c0e8c8517e1486b38e4.tar.gz
samba-a0d6904ed30b7edd41715c0e8c8517e1486b38e4.tar.xz
samba-a0d6904ed30b7edd41715c0e8c8517e1486b38e4.zip
ndr: dnsserver: Add pull and push functions for DNS_RPC_RECORD_STRING
Diffstat (limited to 'librpc/ndr/ndr_dnsserver.c')
-rw-r--r--librpc/ndr/ndr_dnsserver.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/librpc/ndr/ndr_dnsserver.c b/librpc/ndr/ndr_dnsserver.c
index 5eaa7cadb80..3201f0428a3 100644
--- a/librpc/ndr/ndr_dnsserver.c
+++ b/librpc/ndr/ndr_dnsserver.c
@@ -61,3 +61,40 @@ enum ndr_err_code ndr_push_DNS_RPC_RECORDS_ARRAY(struct ndr_push *ndr,
return NDR_ERR_SUCCESS;
}
+
+/*
+ * Parsing of DNS_RPC_RECORD_STRING
+ */
+
+enum ndr_err_code ndr_pull_DNS_RPC_RECORD_STRING(struct ndr_pull *ndr,
+ int ndr_flags, struct DNS_RPC_RECORD_STRING *rec)
+{
+ rec->count = 0;
+ rec->str = talloc_array(ndr->current_mem_ctx, struct DNS_RPC_NAME, rec->count);
+ if (! rec->str) {
+ return ndr_pull_error(ndr, NDR_ERR_ALLOC, "Failed to pull DNS_RPC_RECORD_STRING");
+ }
+
+ while (ndr->offset < ndr->data_size) {
+ rec->str = talloc_realloc(ndr->current_mem_ctx, rec->str, struct DNS_RPC_NAME, rec->count+1);
+ if (! rec->str) {
+ return ndr_pull_error(ndr, NDR_ERR_ALLOC, "Failed to pull DNS_RPC_RECORD_STRING");
+ }
+ NDR_CHECK(ndr_pull_DNS_RPC_NAME(ndr, ndr_flags, &rec->str[rec->count]));
+ rec->count++;
+ }
+
+ return NDR_ERR_SUCCESS;
+}
+
+enum ndr_err_code ndr_push_DNS_RPC_RECORD_STRING(struct ndr_push *ndr,
+ int ndr_flags, const struct DNS_RPC_RECORD_STRING *rec)
+{
+ int i;
+
+ for (i=0; i<rec->count; i++) {
+ NDR_CHECK(ndr_push_DNS_RPC_NAME(ndr, ndr_flags, &rec->str[i]));
+ }
+
+ return NDR_ERR_SUCCESS;
+}