s4:rpc-dnsserver: Implement EnumDirectoryPartition operation
authorAmitay Isaacs <amitay@gmail.com>
Thu, 15 Dec 2011 07:27:39 +0000 (18:27 +1100)
committerAmitay Isaacs <amitay@gmail.com>
Fri, 23 Dec 2011 05:17:10 +0000 (16:17 +1100)
source4/rpc_server/dnsserver/dcerpc_dnsserver.c
source4/rpc_server/dnsserver/dnsdb.c

index 715b8a6c37fa006637b0fe71643a2511a7ca4d0f..2d9fadd91e868ccd1f1003e8ade4bb3da1d77c45 100644 (file)
@@ -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; i<pcount; i++) {
+                               dplist[i] = talloc_zero(dplist, struct DNS_RPC_DP_ENUM);
+
+                               dplist[i]->pszDpFqdn = 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) {
index a181e069b65df8ab663c7fd930dc0bf3e43326e0..707f7b842cd33a0e9bf79de9eddbf59c93d0b553 100644 (file)
@@ -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)