From 413124cb5a0033e3f7cb39b50389811984241408 Mon Sep 17 00:00:00 2001 From: Zhanna Tsitkov Date: Tue, 10 Mar 2009 14:49:43 +0000 Subject: [PATCH] Added test for KRB5_NT_UNKNOWN princ type git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@22072 dc483132-0cff-0310-8789-dd5450dbe970 --- .../kdc_realm/input_conf/test_KDCs_1.conf | 9 ++++++ .../kdc_realm/input_conf/test_setup.conf | 3 +- src/tests/kdc_realm/kdcref.py | 30 ++++++++++++------- 3 files changed, 31 insertions(+), 11 deletions(-) create mode 100644 src/tests/kdc_realm/input_conf/test_KDCs_1.conf 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 index 000000000..e66425e4d --- /dev/null +++ b/src/tests/kdc_realm/input_conf/test_KDCs_1.conf @@ -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 diff --git a/src/tests/kdc_realm/input_conf/test_setup.conf b/src/tests/kdc_realm/input_conf/test_setup.conf index 7d3697381..f9d8236a9 100644 --- a/src/tests/kdc_realm/input_conf/test_setup.conf +++ b/src/tests/kdc_realm/input_conf/test_setup.conf @@ -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 diff --git a/src/tests/kdc_realm/kdcref.py b/src/tests/kdc_realm/kdcref.py index 6c1f2aba7..9c6fb1d18 100755 --- a/src/tests/kdc_realm/kdcref.py +++ b/src/tests/kdc_realm/kdcref.py @@ -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: -- 2.26.2