[SCM] Samba Shared Repository - branch master updated

Amitay Isaacs amitay at samba.org
Mon Nov 7 17:27:01 MST 2011


The branch, master has been updated
       via  5104abd s4-dnsserver: Test forward zones are not listed in reverse zone search
       via  8b33c48 s4-dnsserver: Fix enumeration of zones in ComplexOperation RPC call
      from  60b7dae Add the SEC_DIR_LIST check to dptr_create().

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 5104abd57322ad989244d25b0d9e7c4e367ba448
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Mon Nov 7 14:40:06 2011 +1100

    s4-dnsserver: Test forward zones are not listed in reverse zone search
    
    Autobuild-User: Amitay Isaacs <amitay at samba.org>
    Autobuild-Date: Tue Nov  8 01:26:43 CET 2011 on sn-devel-104

commit 8b33c48ba5fb73c2fd7a6849c690202d9863c0c2
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Thu Nov 3 16:59:23 2011 +1100

    s4-dnsserver: Fix enumeration of zones in ComplexOperation RPC call
    
    zone_request_flags are interpreted in different groups rather than
    a single group. This correctly returns 0 zones when there are no
    reverse zones and DNS_ZONE_REQUEST_REVERSE is set in zone_request_flags.

-----------------------------------------------------------------------

Summary of changes:
 source4/rpc_server/dnsserver/dcerpc_dnsserver.c    |  133 ++++++++++++-------
 .../python/samba/tests/dcerpc/dnsserver.py         |   17 +++-
 2 files changed, 99 insertions(+), 51 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source4/rpc_server/dnsserver/dcerpc_dnsserver.c b/source4/rpc_server/dnsserver/dcerpc_dnsserver.c
index fd0c977..e1966fa 100644
--- a/source4/rpc_server/dnsserver/dcerpc_dnsserver.c
+++ b/source4/rpc_server/dnsserver/dcerpc_dnsserver.c
@@ -1105,7 +1105,7 @@ static WERROR dnsserver_complex_operate_server(struct dnsserver_state *dsstate,
 	int valid_operation = 0;
 	struct dnsserver_zone *z, **zlist;
 	int zcount;
-	bool found;
+	bool found1, found2, found3, found4;
 	int i;
 
 	if (strcasecmp(operation, "QueryDwordProperty") == 0) {
@@ -1124,74 +1124,109 @@ static WERROR dnsserver_complex_operate_server(struct dnsserver_state *dsstate,
 		zcount = 0;
 		zlist = talloc_zero_array(mem_ctx, struct dnsserver_zone *, 0);
 		for (z = dsstate->zones; z; z = z->next) {
-			found = false;
-			if (rin->Dword & DNS_ZONE_REQUEST_PRIMARY) {
-				if (z->zoneinfo->dwZoneType & DNS_ZONE_TYPE_PRIMARY) {
-					found = true;
+
+			/* Match the flags in groups
+			 *
+			 * Group1 : PRIMARY, SECONDARY, CACHE, AUTO
+			 * Group2 : FORWARD, REVERSE, FORWARDER, STUB
+			 * Group3 : DS, NON_DS, DOMAIN_DP, FOREST_DP
+			 * Group4 : CUSTOM_DP, LEGACY_DP
+			 */
+			
+			/* Group 1 */
+			found1 = false;
+			if (rin->Dword & 0x0000000f) {
+				if (rin->Dword & DNS_ZONE_REQUEST_PRIMARY) {
+					if (z->zoneinfo->dwZoneType == DNS_ZONE_TYPE_PRIMARY) {
+					found1 = true;
+					}
 				}
-			}
-			if (rin->Dword & DNS_ZONE_REQUEST_SECONDARY) {
-				if (z->zoneinfo->dwZoneType & DNS_ZONE_TYPE_SECONDARY) {
-					found = true;
+				if (rin->Dword & DNS_ZONE_REQUEST_SECONDARY) {
+					if (z->zoneinfo->dwZoneType == DNS_ZONE_TYPE_SECONDARY) {
+						found1 = true;
+					}
 				}
-			}
-			if (rin->Dword & DNS_ZONE_REQUEST_CACHE) {
-				if (z->zoneinfo->dwZoneType & DNS_ZONE_TYPE_CACHE) {
-					found = true;
+				if (rin->Dword & DNS_ZONE_REQUEST_CACHE) {
+					if (z->zoneinfo->dwZoneType == DNS_ZONE_TYPE_CACHE) {
+						found1 = true;
+					}
 				}
-			}
-			if (rin->Dword & DNS_ZONE_REQUEST_AUTO) {
-				if (z->zoneinfo->fAutoCreated || z->zoneinfo->dwDpFlags & DNS_DP_AUTOCREATED) {
-					found = true;
+				if (rin->Dword & DNS_ZONE_REQUEST_AUTO) {
+					if (z->zoneinfo->fAutoCreated 
+						|| z->zoneinfo->dwDpFlags & DNS_DP_AUTOCREATED) {
+						found1 = true;
+					}
 				}
+			} else {
+				found1 = true;
 			}
-			if (rin->Dword & DNS_ZONE_REQUEST_FORWARD) {
-				if (!(z->zoneinfo->Flags & DNS_RPC_ZONE_REVERSE)) {
-					found = true;
+
+			/* Group 2 */
+			found2 = false;
+			if (rin->Dword & 0x000000f0) {
+				if (rin->Dword & DNS_ZONE_REQUEST_FORWARD) {
+					if (!(z->zoneinfo->Flags & DNS_RPC_ZONE_REVERSE)) {
+						found2 = true;
+					}
 				}
-			}
-			if (rin->Dword & DNS_ZONE_REQUEST_REVERSE) {
-				if (z->zoneinfo->Flags & DNS_RPC_ZONE_REVERSE) {
-					found = true;
+				if (rin->Dword & DNS_ZONE_REQUEST_REVERSE) {
+					if (z->zoneinfo->Flags & DNS_RPC_ZONE_REVERSE) {
+						found2 = true;
+					}
 				}
-			}
-			if (rin->Dword & DNS_ZONE_REQUEST_FORWARDER) {
-				if (z->zoneinfo->dwZoneType & DNS_ZONE_TYPE_FORWARDER) {
-					found = true;
+				if (rin->Dword & DNS_ZONE_REQUEST_FORWARDER) {
+					if (z->zoneinfo->dwZoneType == DNS_ZONE_TYPE_FORWARDER) {
+						found2 = true;
+					}
 				}
-			}
-			if (rin->Dword & DNS_ZONE_REQUEST_STUB) {
-				if (z->zoneinfo->dwZoneType & DNS_ZONE_TYPE_STUB) {
-					found = true;
+				if (rin->Dword & DNS_ZONE_REQUEST_STUB) {
+					if (z->zoneinfo->dwZoneType == DNS_ZONE_TYPE_STUB) {
+						found2 = true;
+					}
 				}
+			} else {
+				found2 = true;
 			}
-			if (rin->Dword & DNS_ZONE_REQUEST_DS) {
-				if (z->zoneinfo->Flags & DNS_RPC_ZONE_DSINTEGRATED) {
-					found = true;
+
+			/* Group 3 */
+			found3 = false;
+			if (rin->Dword & 0x00000f00) {
+				if (rin->Dword & DNS_ZONE_REQUEST_DS) {
+					if (z->zoneinfo->Flags & DNS_RPC_ZONE_DSINTEGRATED) {
+						found3 = true;
+					}
 				}
-			}
-			if (rin->Dword & DNS_ZONE_REQUEST_NON_DS) {
-				if (!(z->zoneinfo->Flags & DNS_RPC_ZONE_DSINTEGRATED)) {
-					found = true;
+				if (rin->Dword & DNS_ZONE_REQUEST_NON_DS) {
+					if (!(z->zoneinfo->Flags & DNS_RPC_ZONE_DSINTEGRATED)) {
+						found3 = true;
+					}
 				}
-			}
-			if (rin->Dword & DNS_ZONE_REQUEST_DOMAIN_DP) {
-				if (z->zoneinfo->dwDpFlags & DNS_DP_DOMAIN_DEFAULT) {
-					found = true;
+				if (rin->Dword & DNS_ZONE_REQUEST_DOMAIN_DP) {
+					if (!(z->zoneinfo->dwDpFlags & DNS_DP_DOMAIN_DEFAULT)) {
+						found3 = true;
+					}
 				}
-			}
-			if (rin->Dword & DNS_ZONE_REQUEST_FOREST_DP) {
-				if (z->zoneinfo->dwDpFlags & DNS_DP_FOREST_DEFAULT) {
-					found = true;
+				if (rin->Dword & DNS_ZONE_REQUEST_FOREST_DP) {
+					if (!(z->zoneinfo->dwDpFlags & DNS_DP_FOREST_DEFAULT)) {
+						found3 = true;
+					}
 				}
+			} else {
+				found3 = true;
+			}
+	
+			/* Group 4 */
+			if (rin->Dword & 0x0000f000) {
+				found4 = false;
+			} else {
+				found4 = true;
 			}
 
-			if (found) {
+			if (found1 && found2 && found3 && found4) {
 				zlist = talloc_realloc(mem_ctx, zlist, struct dnsserver_zone *, zcount+1);
 				zlist[zcount] = z;
 				zcount++;
 			}
-
 		}
 
 		if (client_version == DNS_CLIENT_VERSION_W2K) {
diff --git a/source4/scripting/python/samba/tests/dcerpc/dnsserver.py b/source4/scripting/python/samba/tests/dcerpc/dnsserver.py
index 33c5cf7..6834746 100644
--- a/source4/scripting/python/samba/tests/dcerpc/dnsserver.py
+++ b/source4/scripting/python/samba/tests/dcerpc/dnsserver.py
@@ -60,9 +60,10 @@ class DnsserverTests(RpcInterfaceTestCase):
         self.assertEquals(dnsserver.DNSSRV_TYPEID_SERVER_INFO, typeid)
 
 
-    def test_complexoepration2(self):
+    def test_complexoperation2(self):
         client_version = dnsserver.DNS_CLIENT_VERSION_LONGHORN
-        request_filter = dnsserver.DNS_ZONE_REQUEST_PRIMARY
+        request_filter = (dnsserver.DNS_ZONE_REQUEST_FORWARD |
+                            dnsserver.DNS_ZONE_REQUEST_PRIMARY)
         typeid, zones = self.conn.DnssrvComplexOperation2(client_version,
                                                             0,
                                                             self.server,
@@ -73,6 +74,18 @@ class DnsserverTests(RpcInterfaceTestCase):
         self.assertEquals(dnsserver.DNSSRV_TYPEID_ZONE_LIST, typeid)
         self.assertEquals(2, zones.dwZoneCount)
 
+        request_filter = (dnsserver.DNS_ZONE_REQUEST_REVERSE |
+                            dnsserver.DNS_ZONE_REQUEST_PRIMARY)
+        typeid, zones = self.conn.DnssrvComplexOperation2(client_version,
+                                                            0,
+                                                            self.server,
+                                                            None,
+                                                            'EnumZones',
+                                                            dnsserver.DNSSRV_TYPEID_DWORD,
+                                                            request_filter)
+        self.assertEquals(dnsserver.DNSSRV_TYPEID_ZONE_LIST, typeid)
+        self.assertEquals(0, zones.dwZoneCount)
+
 
     def test_enumrecords2(self):
         client_version = dnsserver.DNS_CLIENT_VERSION_LONGHORN


-- 
Samba Shared Repository


More information about the samba-cvs mailing list