[SCM] Samba Shared Repository - branch master updated

Amitay Isaacs amitay at samba.org
Thu Jan 5 18:42:02 MST 2012


The branch, master has been updated
       via  200c22b samba-tool:dns: Check through all the DNS records for a match
       via  f816319 s4-rpc:dnsserver: Do not replace @ with zone_name in update operation
      from  d583df1 Fix bug #8687 - net memberships usage info is wrong

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


- Log -----------------------------------------------------------------
commit 200c22b9940f8e222f20f95691bc61dcb883b609
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Fri Jan 6 10:28:52 2012 +1100

    samba-tool:dns: Check through all the DNS records for a match
    
    There can be multiple dns records for a specified record type.
    
    Autobuild-User: Amitay Isaacs <amitay at samba.org>
    Autobuild-Date: Fri Jan  6 02:41:22 CET 2012 on sn-devel-104

commit f8163195b083d0c2bff25a6078224605d37562e1
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Fri Jan 6 09:26:49 2012 +1100

    s4-rpc:dnsserver: Do not replace @ with zone_name in update operation
    
    This fixes the problem when updating DNS record for '@' or domain name.

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

Summary of changes:
 source4/rpc_server/dnsserver/dcerpc_dnsserver.c |    7 ++++-
 source4/scripting/python/samba/netcmd/dns.py    |   32 +++++++++++-----------
 2 files changed, 22 insertions(+), 17 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 5f4009b..fac99e1 100644
--- a/source4/rpc_server/dnsserver/dcerpc_dnsserver.c
+++ b/source4/rpc_server/dnsserver/dcerpc_dnsserver.c
@@ -1852,7 +1852,12 @@ static WERROR dnsserver_update_record(struct dnsserver_state *dsstate,
 	tmp_ctx = talloc_new(mem_ctx);
 	W_ERROR_HAVE_NO_MEMORY(tmp_ctx);
 
-	name = dns_split_node_name(tmp_ctx, node_name, z->name);
+	/* If node_name is @ or zone name, dns record is @ */
+	if (strcmp(node_name, "@") == 0 || strcmp(node_name, z->name) == 0) {
+		name = talloc_strdup(tmp_ctx, "@");
+	} else {
+		name = dns_split_node_name(tmp_ctx, node_name, z->name);
+	}
 	W_ERROR_HAVE_NO_MEMORY_AND_FREE(name, tmp_ctx);
 
 	if (add_buf != NULL) {
diff --git a/source4/scripting/python/samba/netcmd/dns.py b/source4/scripting/python/samba/netcmd/dns.py
index 002c5a2..74b649e 100644
--- a/source4/scripting/python/samba/netcmd/dns.py
+++ b/source4/scripting/python/samba/netcmd/dns.py
@@ -457,6 +457,7 @@ class SRVRecord(dnsserver.DNS_RPC_RECORD):
         srv.nameTarget.len = len(target)
         self.data = srv
 
+# Match a dns record with specified data
 def dns_record_match(dns_conn, server, zone, name, record_type, data):
     select_flags = dnsserver.DNS_RPC_VIEW_AUTHORITY_DATA
 
@@ -474,36 +475,35 @@ def dns_record_match(dns_conn, server, zone, name, record_type, data):
     except RuntimeError, e:
         return None
 
+    if not res or res.count == 0:
+        return None
+
     rec_match = None
-    if res and res.count > 0:
-        recs = res.rec[0]
-        for rec in recs.records:
-            if rec.wType == record_type:
-                rec_match = rec
-                break
-
-    if rec_match:
+    for rec in res.rec[0].records:
+        if rec.wType != record_type:
+            continue
+
         found = False
         if record_type == dnsp.DNS_TYPE_A:
-            if rec_match.data == data:
+            if rec.data == data:
                 found = True
         elif record_type == dnsp.DNS_TYPE_AAAA:
-            if rec_match.data == data:
+            if rec.data == data:
                 found = True
         elif record_type == dnsp.DNS_TYPE_PTR:
-            if rec_match.data.str.rstrip('.') == data.rstrip('.'):
+            if rec.data.str.rstrip('.') == data.rstrip('.'):
                 found = True
         elif record_type == dnsp.DNS_TYPE_CNAME:
-            if rec_match.data.str.rstrip('.') == data.rstrip('.'):
+            if rec.data.str.rstrip('.') == data.rstrip('.'):
                 found = True
         elif record_type == dnsp.DNS_TYPE_NS:
-            if rec_match.data.str.rstrip('.') == data.rstrip('.'):
+            if rec.data.str.rstrip('.') == data.rstrip('.'):
                 found = True
-
         if found:
-            return rec_match
+            rec_match = rec
+            break
 
-    return None
+    return rec_match
 
 
 class cmd_serverinfo(Command):


-- 
Samba Shared Repository


More information about the samba-cvs mailing list