[SCM] Samba Shared Repository - branch master updated - release-4-0-0alpha7-849-g213249c

Jelmer Vernooij jelmer at samba.org
Sun Apr 5 22:29:06 GMT 2009


The branch, master has been updated
       via  213249ceab8870ec678b23e3d9a764b2d7ba7ec0 (commit)
       via  b1db78c595ca7b171eeb141428e963431163cddb (commit)
      from  15f6d5e805490b35ed390f731944bc4ac4e3327b (commit)

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


- Log -----------------------------------------------------------------
commit 213249ceab8870ec678b23e3d9a764b2d7ba7ec0
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Sun Apr 5 23:03:13 2009 +0200

    Improve formatting in Python file.

commit b1db78c595ca7b171eeb141428e963431163cddb
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Sun Apr 5 23:17:43 2009 +0200

    Make valid_netbios_name() check a bit stricter.

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

Summary of changes:
 source4/scripting/python/samba/__init__.py       |    6 ++++--
 source4/scripting/python/samba/tests/__init__.py |   17 +++++++++++++++++
 2 files changed, 21 insertions(+), 2 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source4/scripting/python/samba/__init__.py b/source4/scripting/python/samba/__init__.py
index c5827b9..3ecb758 100644
--- a/source4/scripting/python/samba/__init__.py
+++ b/source4/scripting/python/samba/__init__.py
@@ -233,10 +233,12 @@ def check_all_substituted(text):
 
 def valid_netbios_name(name):
     """Check whether a name is valid as a NetBIOS name. """
-    # FIXME: There are probably more constraints here. 
-    # crh has a paragraph on this in his book (1.4.1.1)
+    # See crh's book (1.4.1.1)
     if len(name) > 15:
         return False
+    for x in name:
+        if not x.isalnum() and not x in " !#$%&'()-.@^_{}~":
+            return False
     return True
 
 version = glue.version
diff --git a/source4/scripting/python/samba/tests/__init__.py b/source4/scripting/python/samba/tests/__init__.py
index b342b93..3f8ee8d 100644
--- a/source4/scripting/python/samba/tests/__init__.py
+++ b/source4/scripting/python/samba/tests/__init__.py
@@ -26,6 +26,7 @@ import tempfile
 import unittest
 
 class LdbTestCase(unittest.TestCase):
+
     """Trivial test case for running tests against a LDB."""
     def setUp(self):
         self.filename = os.tempnam()
@@ -41,6 +42,7 @@ class LdbTestCase(unittest.TestCase):
 
 
 class TestCaseInTempDir(unittest.TestCase):
+
     def setUp(self):
         super(TestCaseInTempDir, self).setUp()
         self.tempdir = tempfile.mkdtemp()
@@ -52,6 +54,7 @@ class TestCaseInTempDir(unittest.TestCase):
 
 
 class SubstituteVarTestCase(unittest.TestCase):
+
     def test_empty(self):
         self.assertEquals("", samba.substitute_var("", {}))
 
@@ -75,6 +78,7 @@ class SubstituteVarTestCase(unittest.TestCase):
 
 
 class LdbExtensionTests(TestCaseInTempDir):
+
     def test_searchone(self):
         path = self.tempdir + "/searchone.ldb"
         l = samba.Ldb(path)
@@ -90,9 +94,22 @@ cmdline_loadparm = None
 cmdline_credentials = None
 
 class RpcInterfaceTestCase(unittest.TestCase):
+
     def get_loadparm(self):
         assert cmdline_loadparm is not None
         return cmdline_loadparm
 
     def get_credentials(self):
         return cmdline_credentials
+
+
+class ValidNetbiosNameTests(unittest.TestCase):
+
+    def test_valid(self):
+        self.assertTrue(valid_netbios_name("FOO"))
+
+    def test_too_long(self):
+        self.assertFalse(valid_netbios_name("FOO"*10))
+
+    def test_invalid_characters(self):
+        self.assertFalse(valid_netbios_name("()BLA"))


-- 
Samba Shared Repository


More information about the samba-cvs mailing list