Added test for KRB5_NT_UNKNOWN princ type
authorZhanna Tsitkov <tsitkova@mit.edu>
Tue, 10 Mar 2009 14:49:43 +0000 (14:49 +0000)
committerZhanna Tsitkov <tsitkova@mit.edu>
Tue, 10 Mar 2009 14:49:43 +0000 (14:49 +0000)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@22072 dc483132-0cff-0310-8789-dd5450dbe970

src/tests/kdc_realm/input_conf/test_KDCs_1.conf [new file with mode: 0644]
src/tests/kdc_realm/input_conf/test_setup.conf
src/tests/kdc_realm/kdcref.py

diff --git a/src/tests/kdc_realm/input_conf/test_KDCs_1.conf b/src/tests/kdc_realm/input_conf/test_KDCs_1.conf
new file mode 100644 (file)
index 0000000..e66425e
--- /dev/null
@@ -0,0 +1,9 @@
+krb5_priKDC_template.conf,0
+krb5_priKDC_1_template.conf,1
+krb5_priKDC_2_template.conf,0
+krb5_priKDC_3_template.conf,1
+krb5_priKDC_4_template.conf,1
+krb5_priKDC_5_template.conf,1
+krb5_priKDC_6_template.conf,1
+krb5_priKDC_7_template.conf,0
+krb5_priKDC_8_template.conf,1
index 7d36973818ce8159fc5201a98d47fa2ab5c97bd6..f9d8236a998729885c0ebdbc5af64cc604f191a7 100644 (file)
@@ -1,5 +1,6 @@
 sandboxDir=tests/kdc_realm/sandbox
 testKDCconf=test_KDCs.conf
+testKDCconf_1=test_KDCs_1.conf
 principals=test_princs.conf
 tier1=sandbox/tier1
-tier2=sandbox/tier2
\ No newline at end of file
+tier2=sandbox/tier2
index 6c1f2aba72877ef4668b513b3bd2f6d2345944bd..9c6fb1d18b1424590030d95d8b304480396f0c6e 100755 (executable)
@@ -28,6 +28,7 @@ class Launcher:
         self._sandboxTier1 = '%s/%s' % (self._sandboxDir, 'tier1')
         self._sandboxTier2 = '%s/%s' % (self._sandboxDir, 'tier2')
         self._configurations = self._readServerConfiguration('%s/%s' % (self._confDir,confParams['testKDCconf']))
+        self._configurations_1 = self._readServerConfiguration('%s/%s' % (self._confDir,confParams['testKDCconf_1']))
         self._principals = self._readTestInputs('%s/%s' % (self._confDir,confParams['principals']))
         os.environ["LD_LIBRARY_PATH"] = '%s/lib' % self._buildDir
         self._pidRefKDC = 0
@@ -94,7 +95,7 @@ class Launcher:
             raise LaunchError, err_msg
 
         
-    def _launchClient(self, args, env):
+    def _launchClient(self, args, env, princType):
         """
         kinit & kvno
         """
@@ -109,7 +110,11 @@ class Launcher:
 
         # testHost', 'mybox.mit.edu is a srv defined in referral KDC. Get its kvno 
         cmd = '%s/clients/kvno/kvno' % self._buildDir 
-        handle = Popen([cmd, '-C', '-S', 'testHost', 'mybox.mit.edu'], 
+        if princType == 0:
+             handle = Popen([cmd, '-C', '-S', 'testHost', 'mybox.mit.edu'],
+                            env = env, stdin=PIPE, stdout=PIPE, stderr=PIPE)
+        if princType == 1:
+            handle = Popen([cmd, '-C', '-u', 'testHost/mybox.mit.edu'],                
                        env = env, stdin=PIPE, stdout=PIPE, stderr=PIPE)
         (out, err) = handle.communicate()
         handle.wait()
@@ -185,7 +190,7 @@ class Launcher:
             self._tier1Init = True
         
         
-    def _launchTestingPair(self, srvParam,clntParam):
+    def _launchTestingPair(self, srvParam,clntParam, princType):
         # launch KDC       
         server_env = os.environ.copy()
         server_env["KRB5_KDC_PROFILE"] = '%s/kdc.conf' % self._sandboxTier2  
@@ -198,9 +203,9 @@ class Launcher:
                                      '%s/%s' % (self._confDir,'kdc_pri_template.conf'),
                                      self._vars)
         if self._tier2Init == False:
-            pid = self._createDB(server_env)
-            self._crossRealm('Y.COM', 'Z.COM', server_env)            
-            self._tier2Init = True
+          pid = self._createDB(server_env)
+          self._crossRealm('Y.COM', 'Z.COM', server_env)            
+          self._tier2Init = True
             
         server = self._launchKDC( 2, server_args, server_env)
         
@@ -211,7 +216,7 @@ class Launcher:
                         '%s/%s' % (self._confDir, 'krb5_priCL_template.conf'),
                          self._vars)  
         client_env["KRB5_KDC_PROFILE"] = server_env["KRB5_KDC_PROFILE"]                    
-        rc = self._launchClient(clntParam, client_env)
+        rc = self._launchClient(clntParam, client_env, princType)
         self._kill(server)
         return rc
  
@@ -232,9 +237,15 @@ class Launcher:
         result = dict()
         for princs in self._principals:
             for conf in self._configurations:                                         
-                rc = self._launchTestingPair( conf['confName'], princs % self._vars)
+                rc = self._launchTestingPair( conf['confName'], princs % self._vars, 0)
                 result[conf['confName']] = {'expected':conf['expected'], 'actual':rc}
-                print 'Test code for configuration %s principal %s: %s' % (conf, princs, rc)        
+                print 'Test code for configuration %s principal %s type KRB5_NT_SRV_HST: %s' % (conf, princs, rc)  
+            self.printTestResults(result)
+            for conf in self._configurations_1:                                         
+                rc = self._launchTestingPair( conf['confName'], princs % self._vars, 1)
+                result[conf['confName']] = {'expected':conf['expected'], 'actual':rc}
+                print 'Test code for configuration %s principal %si type KRB5_NT_UNKNOWN: %s' % (conf, princs, rc)    
+            self.printTestResults(result)
         return result
 
 
@@ -317,7 +328,6 @@ if __name__ == '__main__':
         test = Launcher(src_path)
         result = test.run('main')
         test.clean()
-        test.printTestResults(result)
         
     except:
         if test is not None: