From 6a5352da594bcd6c109c883f3db7e307f171f228 Mon Sep 17 00:00:00 2001 From: Amitay Isaacs Date: Thu, 15 Dec 2011 18:27:39 +1100 Subject: s4:rpc-dnsserver: Implement EnumDirectoryPartition operation --- source4/rpc_server/dnsserver/dcerpc_dnsserver.c | 35 ++++++++++++++++++++++++- source4/rpc_server/dnsserver/dnsdb.c | 2 ++ 2 files changed, 36 insertions(+), 1 deletion(-) (limited to 'source4/rpc_server/dnsserver') diff --git a/source4/rpc_server/dnsserver/dcerpc_dnsserver.c b/source4/rpc_server/dnsserver/dcerpc_dnsserver.c index 715b8a6c37..2d9fadd91e 100644 --- a/source4/rpc_server/dnsserver/dcerpc_dnsserver.c +++ b/source4/rpc_server/dnsserver/dcerpc_dnsserver.c @@ -1294,7 +1294,40 @@ static WERROR dnsserver_complex_operate_server(struct dnsserver_state *dsstate, } else if (strcasecmp(operation, "EnumZones2") == 0) { valid_operation = true; } else if (strcasecmp(operation, "EnumDirectoryPartitions") == 0) { - valid_operation = true; + if (typeid_in != DNSSRV_TYPEID_DWORD) { + return WERR_DNS_ERROR_INVALID_PROPERTY; + } + + *typeid_out = DNSSRV_TYPEID_DP_LIST; + rout->DirectoryPartitionList = talloc_zero(mem_ctx, struct DNS_RPC_DP_LIST); + + if (rin->Dword != 0) { + rout->DirectoryPartitionList->dwDpCount = 0; + rout->DirectoryPartitionList->DpArray = NULL; + } else { + struct DNS_RPC_DP_ENUM **dplist; + struct dnsserver_partition *p; + int pcount = 2; + + dplist = talloc_zero_array(mem_ctx, struct DNS_RPC_DP_ENUM *, pcount); + if (dplist == NULL) { + return WERR_NOMEM; + } + + p = dsstate->partitions; + for (i=0; ipszDpFqdn = talloc_strdup(mem_ctx, p->pszDpFqdn); + dplist[i]->dwFlags = p->dwDpFlags; + dplist[i]->dwZoneCount = p->zones_count; + p = p->next; + } + + rout->DirectoryPartitionList->dwDpCount = pcount; + rout->DirectoryPartitionList->DpArray = dplist; + } + return WERR_OK; } else if (strcasecmp(operation, "DirectoryPartitionInfo") == 0) { valid_operation = true; } else if (strcasecmp(operation, "Statistics") == 0) { diff --git a/source4/rpc_server/dnsserver/dnsdb.c b/source4/rpc_server/dnsserver/dnsdb.c index a181e069b6..707f7b842c 100644 --- a/source4/rpc_server/dnsserver/dnsdb.c +++ b/source4/rpc_server/dnsserver/dnsdb.c @@ -75,6 +75,8 @@ failed: } + +/* Search for all dnsZone records */ struct dnsserver_zone *dnsserver_db_enumerate_zones(TALLOC_CTX *mem_ctx, struct ldb_context *samdb, struct dnsserver_partition *p) -- cgit