diff options
Diffstat (limited to 'librpc/ndr')
-rw-r--r-- | librpc/ndr/ndr_dnsserver.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/librpc/ndr/ndr_dnsserver.c b/librpc/ndr/ndr_dnsserver.c index 5eaa7cadb8..3201f0428a 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; +} |