[SCM] Samba Shared Repository - branch master updated

Jelmer Vernooij jelmer at samba.org
Tue Mar 13 07:54:03 MDT 2012


The branch, master has been updated
       via  85f128e nbench: Fix typo.
       via  58b205d samba.8: Fix typo: deamon -> daemon.
       via  441c214 samba_dnsupdate: Mention contents of invalid line when encountering parsing error.
       via  8b42801 samba_dnsupdate: Raise proper exception when getting unexpected DNS reply.
       via  d87a24f samba_dnsupdate: Use docstrings, which show up nicely in API docs.
      from  7d4ed89 s3-rpc: Decrypt with the proper session key in CreateTrustedDomainEx2.

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


- Log -----------------------------------------------------------------
commit 85f128e8f3b8cd86926dc9097e96c31b66ab0f61
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Mon Mar 12 19:36:51 2012 +0100

    nbench: Fix typo.
    
    Autobuild-User: Jelmer Vernooij <jelmer at samba.org>
    Autobuild-Date: Tue Mar 13 14:53:07 CET 2012 on sn-devel-104

commit 58b205d48690498e3595ba16bb5521efcaa83ad4
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Mon Mar 12 19:34:43 2012 +0100

    samba.8: Fix typo: deamon -> daemon.

commit 441c214dda2ca93980461c03115b094a1e606d4a
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Mon Mar 12 19:29:34 2012 +0100

    samba_dnsupdate: Mention contents of invalid line when encountering parsing error.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=8809

commit 8b42801609c82b5745a61a70149a41039973cfa1
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Mon Mar 12 19:25:39 2012 +0100

    samba_dnsupdate: Raise proper exception when getting unexpected DNS reply.

commit d87a24fe171139d2b3bab12bcc9266318e22107b
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Mon Mar 12 19:23:50 2012 +0100

    samba_dnsupdate: Use docstrings, which show up nicely in API docs.

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

Summary of changes:
 source4/scripting/bin/samba_dnsupdate |   48 +++++++++++++++-----------------
 source4/smbd/samba.8.xml              |    2 +-
 source4/torture/nbench/nbench.c       |    2 +-
 3 files changed, 25 insertions(+), 27 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source4/scripting/bin/samba_dnsupdate b/source4/scripting/bin/samba_dnsupdate
index 86af6d8..d21496c 100755
--- a/source4/scripting/bin/samba_dnsupdate
+++ b/source4/scripting/bin/samba_dnsupdate
@@ -1,4 +1,5 @@
 #!/usr/bin/env python
+# vim: expandtab
 #
 # update our DNS names using TSIG-GSS
 #
@@ -104,9 +105,9 @@ for i in IPs:
 if opts.verbose:
     print "IPs: %s" % IPs
 
-########################################################
-# get credentials if we haven't got them already
+
 def get_credentials(lp):
+    """# get credentials if we haven't got them already."""
     from samba import credentials
     global ccachename, creds
     if creds is not None:
@@ -119,11 +120,13 @@ def get_credentials(lp):
     creds.get_named_ccache(lp, ccachename)
 
 
-#############################################
-# an object to hold a parsed DNS line
 class dnsobj(object):
+    """an object to hold a parsed DNS line"""
+
     def __init__(self, string_form):
         list = string_form.split()
+        if len(list) < 3:
+            raise Exception("Invalid DNS entry %r" % string_form)
         self.dest = None
         self.port = None
         self.ip = None
@@ -132,6 +135,8 @@ class dnsobj(object):
         self.type = list[0]
         self.name = list[1].lower()
         if self.type == 'SRV':
+            if len(list) < 4:
+                raise Exception("Invalid DNS entry %r" % string_form)
             self.dest = list[2].lower()
             self.port = list[3]
         elif self.type in ['A', 'AAAA']:
@@ -141,8 +146,7 @@ class dnsobj(object):
         elif self.type == 'NS':
             self.dest = list[2].lower()
         else:
-            print "Received unexpected DNS reply of type %s" % self.type
-            raise
+            raise Exception("Received unexpected DNS reply of type %s" % self.type)
 
     def __str__(self):
         if d.type == "A":     return "%s %s %s" % (self.type, self.name, self.ip)
@@ -152,38 +156,35 @@ class dnsobj(object):
         if d.type == "NS":    return "%s %s %s" % (self.type, self.name, self.dest)
 
 
-################################################
-# parse a DNS line from
 def parse_dns_line(line, sub_vars):
+    """parse a DNS line from."""
     if line.startswith("SRV _ldap._tcp.pdc._msdcs.") and not samdb.am_pdc():
         if opts.verbose:
             print "Skipping PDC entry (%s) as we are not a PDC" % line
         return None
     subline = samba.substitute_var(line, sub_vars)
-    d = dnsobj(subline)
-    return d
+    return dnsobj(subline)
+
 
-############################################
-# see if two hostnames match
 def hostname_match(h1, h2):
+    """see if two hostnames match."""
     h1 = str(h1)
     h2 = str(h2)
     return h1.lower().rstrip('.') == h2.lower().rstrip('.')
 
 
-############################################
-# check that a DNS entry exists
 def check_dns_name(d):
+    """check that a DNS entry exists."""
     normalised_name = d.name.rstrip('.') + '.'
     if opts.verbose:
         print "Looking for DNS entry %s as %s" % (d, normalised_name)
- 
+
     if opts.use_file is not None:
         try:
             dns_file = open(opts.use_file, "r")
         except IOError:
             return False
-        
+
         for line in dns_file:
             line = line.strip()
             if line == '' or line[0] == "#":
@@ -226,15 +227,15 @@ def check_dns_name(d):
         for rdata in ans:
             if str(rdata) == str(d.ip):
                 return True
-    if d.type == 'CNAME':
+    elif d.type == 'CNAME':
         for i in range(len(ans)):
             if hostname_match(ans[i].target, d.dest):
                 return True
-    if d.type == 'NS':
+    elif d.type == 'NS':
         for i in range(len(ans)):
             if hostname_match(ans[i].target, d.dest):
                 return True
-    if d.type == 'SRV':
+    elif d.type == 'SRV':
         for rdata in ans:
             if opts.verbose:
                 print "Checking %s against %s" % (rdata, d)
@@ -251,9 +252,8 @@ def check_dns_name(d):
     return False
 
 
-###########################################
-# get the list of substitution vars
 def get_subst_vars(samdb):
+    """get the list of substitution vars."""
     global lp, am_rodc
     vars = {}
 
@@ -270,9 +270,8 @@ def get_subst_vars(samdb):
     return vars
 
 
-############################################
-# call nsupdate for an entry
 def call_nsupdate(d):
+    """call nsupdate for an entry."""
     global ccachename, nsupdate_cmd
 
     if opts.verbose:
@@ -426,8 +425,7 @@ os.environ['KRB5_CONFIG'] = krb5conf
 
 file = open(dns_update_list, "r")
 
-samdb = SamDB(url=lp.samdb_url(), session_info=system_session(),
-              lp=lp)
+samdb = SamDB(url=lp.samdb_url(), session_info=system_session(), lp=lp)
 
 # get the substitution dictionary
 sub_vars = get_subst_vars(samdb)
diff --git a/source4/smbd/samba.8.xml b/source4/smbd/samba.8.xml
index e0dd28c..2fa126f 100644
--- a/source4/smbd/samba.8.xml
+++ b/source4/smbd/samba.8.xml
@@ -66,7 +66,7 @@
 		<listitem><para>If this parameter is specified it causes the
 		server to run "interactively", not as a daemon, even if the
 		server is executed on the command line of a shell. Setting this
-		parameter negates the implicit deamon mode when run from the
+		parameter negates the implicit daemon mode when run from the
 		command line. <command>samba</command> also logs to standard
 		output, as if the <command>-S</command> parameter had been
 		given.
diff --git a/source4/torture/nbench/nbench.c b/source4/torture/nbench/nbench.c
index 71a319f..3258e19 100644
--- a/source4/torture/nbench/nbench.c
+++ b/source4/torture/nbench/nbench.c
@@ -66,7 +66,7 @@ static bool run_netbench(struct torture_context *tctx, struct smbcli_state *cli,
 	int n = 0;
 
 	if (target_rate != 0 && client == 0) {
-		printf("Targetting %.4f MByte/sec\n", target_rate);
+		printf("Targeting %.4f MByte/sec\n", target_rate);
 	}
 
 	nb_setup(cli, client);


-- 
Samba Shared Repository


More information about the samba-cvs mailing list