s4:rpc-dnsserver: Make sure that zone information is filled in
authorAmitay Isaacs <amitay@gmail.com>
Fri, 16 Dec 2011 06:59:59 +0000 (17:59 +1100)
committerAmitay Isaacs <amitay@gmail.com>
Fri, 23 Dec 2011 05:18:25 +0000 (16:18 +1100)
This fixes the problem of NULL zone in zone operations when specific
zone is specified and no zone filter is specified.

source4/rpc_server/dnsserver/dcerpc_dnsserver.c

index c9de4406210a238ec1f23a0d89ab25fa1a38d463..5f4009bafea82c6057b1c4ce2b9c98a914cff991 100644 (file)
@@ -1914,6 +1914,11 @@ static WERROR dcesrv_DnssrvOperation(struct dcesrv_call_state *dce_call, TALLOC_
                                                r->in.dwTypeId,
                                                &r->in.pData);
        } else {
+               z = dnsserver_find_zone(dsstate->zones, r->in.pszZone);
+               if (z == NULL && request_filter == 0) {
+                       return WERR_DNS_ERROR_ZONE_DOES_NOT_EXIST;
+               }
+
                ret = dnsserver_operate_zone(dsstate, mem_ctx, z,
                                                request_filter,
                                                r->in.pszOperation,
@@ -2116,6 +2121,11 @@ static WERROR dcesrv_DnssrvOperation2(struct dcesrv_call_state *dce_call, TALLOC
                                                r->in.dwTypeId,
                                                &r->in.pData);
        } else {
+               z = dnsserver_find_zone(dsstate->zones, r->in.pszZone);
+               if (z == NULL && request_filter == 0) {
+                       return WERR_DNS_ERROR_ZONE_DOES_NOT_EXIST;
+               }
+
                ret = dnsserver_operate_zone(dsstate, mem_ctx, z,
                                                request_filter,
                                                r->in.pszOperation,