credentials for user unless disabled by the realm construction
options.
+* Attributes for the client, server, master, and slave environments.
+ These environments are extensions of os.environ.
+ - realm.env_client
+ - realm.env_server
+ - realm.env_master
+ - realm.env_slave
+
When the test script is run, its behavior can be modified with
command-line flags. These are documented in the --help output.
self._create_acl()
self._create_dictfile()
- self._env_client = self._make_env('client', False)
- self._env_server = self._make_env('server', False)
- self._env_master = self._make_env('master', True)
- self._env_slave = self._make_env('slave', True)
+ self.env_client = self._make_env('client', False)
+ self.env_server = self._make_env('server', False)
+ self.env_master = self._make_env('master', True)
+ self.env_slave = self._make_env('slave', True)
if create_kdb:
self.create_kdb()
return env
def run_as_client(self, args, **keywords):
- return _run_cmd(args, self._env_client, **keywords)
+ return _run_cmd(args, self.env_client, **keywords)
def run_as_server(self, args, **keywords):
- return _run_cmd(args, self._env_server, **keywords)
+ return _run_cmd(args, self.env_server, **keywords)
def run_as_master(self, args, **keywords):
- return _run_cmd(args, self._env_master, **keywords)
+ return _run_cmd(args, self.env_master, **keywords)
def run_as_slave(self, args, **keywords):
- return _run_cmd(args, self._env_slave, **keywords)
+ return _run_cmd(args, self.env_slave, **keywords)
def server_port(self):
return self.portbase + 3
def start_server(self, args, sentinel):
- return _start_daemon(args, self._env_server, sentinel)
+ return _start_daemon(args, self.env_server, sentinel)
def start_in_inetd(self, args, port=None):
if not port:
port = self.server_port()
inetd_args = [t_inetd, str(port)] + args
- return _start_daemon(inetd_args, self._env_server, 'Ready!')
+ return _start_daemon(inetd_args, self.env_server, 'Ready!')
def create_kdb(self):
global kdb5_util
def start_kdc(self):
global krb5kdc
assert(self._kdc_proc is None)
- self._kdc_proc = _start_daemon([krb5kdc, '-n'], self._env_master,
+ self._kdc_proc = _start_daemon([krb5kdc, '-n'], self.env_master,
'starting...')
def stop_kdc(self):
global krb5kdc
assert(self._kadmind_proc is None)
self._kadmind_proc = _start_daemon([kadmind, '-nofork', '-W'],
- self._env_master, 'starting...')
+ self.env_master, 'starting...')
def stop_kadmind(self):
assert(self._kadmind_proc is not None)
--- /dev/null
+# Copyright (C) 2010 by the Massachusetts Institute of Technology.
+# All rights reserved.
+
+# Export of this software from the United States of America may
+# require a specific license from the United States Government.
+# It is the responsibility of any person or organization contemplating
+# export to obtain such a license before exporting.
+#
+# WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
+# distribute this software and its documentation for any purpose and
+# without fee is hereby granted, provided that the above copyright
+# notice appear in all copies and that both that copyright notice and
+# this permission notice appear in supporting documentation, and that
+# the name of M.I.T. not be used in advertising or publicity pertaining
+# to distribution of the software without specific, written prior
+# permission. Furthermore if you modify this software you must label
+# your software as modified software and not distribute it in such a
+# fashion that it might be confused with the original M.I.T. software.
+# M.I.T. makes no representations about the suitability of
+# this software for any purpose. It is provided "as is" without express
+# or implied warranty.
+
+# Invoked by the testrealm target in the top-level Makefile. Creates
+# a test realm and spawns a shell pointing at it, for convenience of
+# manual testing.
+
+from k5test import *
+
+# A list of directories containing programs in the build tree.
+progpaths = [
+ 'kdc',
+ os.path.join('kadmin', 'server'),
+ os.path.join('kadmin', 'cli'),
+ os.path.join('kadmin', 'dbutil'),
+ os.path.join('kadmin', 'ktutil'),
+ os.path.join('clients', 'kinit'),
+ os.path.join('clients', 'klist'),
+ os.path.join('clients', 'kdestroy'),
+ os.path.join('clients', 'kpasswd'),
+ 'slave'
+]
+
+# Add program directories to the beginning of PATH.
+def supplement_path(env):
+ # Construct prefixes; these will end in a trailing separator.
+ path_prefix = manpath_prefix = ''
+ for dir in progpaths:
+ path_prefix += os.path.join(buildtop, dir) + os.pathsep
+
+ # Assume PATH exists in env for simplicity.
+ env['PATH'] = path_prefix + env['PATH']
+
+realm = K5Realm()
+env = realm.env_master.copy()
+supplement_path(env)
+
+print
+print 'Realm files are in %s' % realm.testdir
+print 'KRB5_CONFIG is %s' % env['KRB5_CONFIG']
+print 'KRB5_KDC_PROFILE is %s' % env['KRB5_KDC_PROFILE']
+print 'KRB5CCNAME is %s' % env['KRB5CCNAME']
+print 'KRB5_KTNAME is %s' % env['KRB5_KTNAME']
+print 'KRB5RCACHEDIR is %s' % env['KRB5RCACHEDIR']
+print 'Password for user is %s' % password('user')
+print 'Password for admin is %s' % password('admin')
+print
+
+subprocess.call([os.getenv('SHELL')], env=env)
+success('Create test krb5 realm.')