krb5 commit: Prep k5test.py for iprop (add start_kpropd(), ...)

Greg Hudson ghudson at MIT.EDU
Mon Oct 8 12:18:46 EDT 2012


https://github.com/krb5/krb5/commit/3c5745e8b90baedf2ec6f42fc0ff40ce80aea001
commit 3c5745e8b90baedf2ec6f42fc0ff40ce80aea001
Author: Nicolas Williams <nico at cryptonector.com>
Date:   Mon Sep 3 18:06:44 2012 -0500

    Prep k5test.py for iprop (add start_kpropd(), ...)
    
    Add a start_kpropd() method to K5Realm and make start_kadmind() use the
    kadmind -p, -K, and -F options.
    
    ticket: 7378

 src/util/k5test.py |   48 ++++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 42 insertions(+), 6 deletions(-)

diff --git a/src/util/k5test.py b/src/util/k5test.py
index f771619..6af782c 100644
--- a/src/util/k5test.py
+++ b/src/util/k5test.py
@@ -97,7 +97,9 @@ keyword arguments:
     - port0 is used in the default krb5.conf for the KDC
     - port1 is used in the default krb5.conf for kadmind
     - port2 is used in the default krb5.conf for kpasswd
-    - port3 is the return value of realm.server_port()
+    - port3 is used in the default krb5.conf for kpropd
+    - port4 is used in the default krb5.conf for iprop (in kadmind)
+    - port5 is the return value of realm.server_port()
 
 * kdc_conf={...}: kdc.conf options, expressed as a nested dictionary,
   to be merged with the default kdc.conf settings.  The top level keys
@@ -121,6 +123,8 @@ keyword arguments:
 
 * start_kadmind=True: Start kadmind.
 
+* start_kpropd=True: Start kpropd.
+
 * get_creds=False: Don't get user credentials.
 
 Scripts may use the following functions and variables:
@@ -247,6 +251,9 @@ Scripts may use the following realm methods and attributes:
 * realm.start_kadmind(): Start a kadmind with the realm's master KDC
   environment.  Errors if a kadmind is already running.
 
+* realm.start_kpropd(): Start a kpropd with the realm's slave KDC
+  environment.  Errors if a kpropd is already running.
+
 * realm.stop_kadmind(): Stop the kadmind process.  Errors if no
   kadmind is running.
 
@@ -697,7 +704,8 @@ class K5Realm(object):
     def __init__(self, realm='KRBTEST.COM', portbase=61000, testdir='testdir',
                  krb5_conf=None, kdc_conf=None, create_kdb=True,
                  krbtgt_keysalt=None, create_user=True, get_creds=True,
-                 create_host=True, start_kdc=True, start_kadmind=False):
+                 create_host=True, start_kdc=True, start_kadmind=False,
+                 start_kpropd=False):
         global hostname, _default_krb5_conf, _default_kdc_conf
 
         self.realm = realm
@@ -716,6 +724,7 @@ class K5Realm(object):
         self._kdc_conf = _cfg_merge(_default_kdc_conf, kdc_conf)
         self._kdc_proc = None
         self._kadmind_proc = None
+        self._kpropd_proc = None
 
         self._create_empty_dir()
         self._create_krb5_conf('client')
@@ -747,6 +756,8 @@ class K5Realm(object):
             self.start_kdc()
         if start_kadmind and create_kdb:
             self.start_kadmind()
+        if start_kpropd and create_kdb:
+            self.start_kpropd()
         if get_creds and create_kdb and create_user and start_kdc:
             self.kinit(self.user_princ, password('user'))
             self.klist(self.user_princ)
@@ -842,6 +853,8 @@ class K5Realm(object):
         env['KRB5_KTNAME'] = self.keytab
         env['KRB5_CLIENT_KTNAME'] = self.client_keytab
         env['KRB5RCACHEDIR'] = self.testdir
+        env['KPROPD_PORT'] = str(self.portbase + 3)
+        env['KPROP_PORT'] = str(self.portbase + 3)
         return env
 
     def run_as_client(self, args, **keywords):
@@ -857,7 +870,7 @@ class K5Realm(object):
         return _run_cmd(args, self.env_slave, **keywords)
 
     def server_port(self):
-        return self.portbase + 3
+        return self.portbase + 5
 
     def start_server(self, args, sentinel):
         return _start_daemon(args, self.env_server, sentinel)
@@ -886,19 +899,41 @@ class K5Realm(object):
     def start_kadmind(self):
         global krb5kdc
         assert(self._kadmind_proc is None)
-        self._kadmind_proc = _start_daemon([kadmind, '-nofork', '-W'],
-                                            self.env_master, 'starting...')
+        dump_path = os.path.join(self.testdir, 'master-dump')
+        self._kadmind_proc = _start_daemon([kadmind, '-nofork', '-W',
+                                            '-p', kdb5_util, '-K', kprop,
+                                            '-F', dump_path],
+                                           self.env_master, 'starting...')
 
     def stop_kadmind(self):
         assert(self._kadmind_proc is not None)
         stop_daemon(self._kadmind_proc)
         self._kadmind_proc = None
 
+    def start_kpropd(self):
+        global krb5kdc
+        assert(self._kpropd_proc is None)
+        slavedump_path = os.path.join(self.testdir, 'incoming-slave-datatrans')
+        kpropdacl_path = os.path.join(self.testdir, 'kpropd-acl')
+        self._kpropd_proc = _start_daemon([kpropd, '-D', '-P',
+                                           str(self.portbase + 3),
+                                           '-f', slavedump_path,
+                                           '-p', kdb5_util,
+                                           '-a', kpropdacl_path],
+                                          self.env_slave, 'ready')
+
+    def stop_kpropd(self):
+        assert(self._kpropd_proc is not None)
+        stop_daemon(self._kpropd_proc)
+        self._kpropd_proc = None
+
     def stop(self):
         if self._kdc_proc:
             self.stop_kdc()
         if self._kadmind_proc:
             self.stop_kadmind()
+        if self._kpropd_proc:
+            self.stop_kpropd()
 
     def addprinc(self, princname, password=None):
         if password:
@@ -1063,7 +1098,8 @@ _default_kdc_conf = {
     'all' : {
         'realms' : {
             '$realm' : {
-                'database_module' : 'foo_db2'
+                'database_module' : 'foo_db2',
+                'iprop_port' : '$port4'
             }
         },
         'dbmodules' : {


More information about the cvs-krb5 mailing list