aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGreg Hudson <ghudson@mit.edu>2020-10-07 01:25:01 -0400
committerGreg Hudson <ghudson@mit.edu>2020-10-08 13:47:06 -0400
commitad1c56d9b7dc3ce37b50cb3d72ff98513bf84073 (patch)
tree7c09c8560f22a0a11898f49ccc9cb6d084b4933c /src
parent90fedf8188fc47aa5a476a969af34671555df389 (diff)
downloadkrb5-ad1c56d9b7dc3ce37b50cb3d72ff98513bf84073.zip
krb5-ad1c56d9b7dc3ce37b50cb3d72ff98513bf84073.tar.gz
krb5-ad1c56d9b7dc3ce37b50cb3d72ff98513bf84073.tar.bz2
Fix Python deprecation warnings
Address all warnings issued by "python -Werror::DeprecationWarning" in the test suite and doc build, as of Python 3.8.2.
Diffstat (limited to 'src')
-rwxr-xr-xsrc/tests/gssapi/t_s4u.py2
-rwxr-xr-xsrc/tests/t_kdb.py4
-rwxr-xr-xsrc/tests/t_mkey.py10
-rwxr-xr-xsrc/tests/t_referral.py4
-rwxr-xr-xsrc/tests/t_sesskeynego.py2
-rw-r--r--src/util/k5test.py15
6 files changed, 16 insertions, 21 deletions
diff --git a/src/tests/gssapi/t_s4u.py b/src/tests/gssapi/t_s4u.py
index 67eba44..746c07f 100755
--- a/src/tests/gssapi/t_s4u.py
+++ b/src/tests/gssapi/t_s4u.py
@@ -209,7 +209,7 @@ msgs = ('Getting initial credentials for enterprise\\@abc@SREALM',
'/Additional pre-authentication required',
'Identified realm of client principal as UREALM',
'Getting credentials enterprise\\@abc@UREALM -> user@SREALM',
- 'TGS reply is for enterprise\@abc@UREALM -> user@SREALM')
+ 'TGS reply is for enterprise\\@abc@UREALM -> user@SREALM')
r1.run(['./t_s4u', 'e:enterprise@abc@NOREALM', '-', r1.keytab],
expected_trace=msgs)
diff --git a/src/tests/t_kdb.py b/src/tests/t_kdb.py
index de8ae9c..5211cbc 100755
--- a/src/tests/t_kdb.py
+++ b/src/tests/t_kdb.py
@@ -370,7 +370,7 @@ ldap_modify('dn: krbPrincipalName=canon@KRBTEST.COM,cn=t1,cn=krb5\n'
'krbCanonicalName: canon@KRBTEST.COM\n')
realm.run([kadminl, 'getprinc', 'alias'],
expected_msg='Principal: canon@KRBTEST.COM\n')
-realm.run([kadminl, 'getprinc', 'ent\@abc'],
+realm.run([kadminl, 'getprinc', 'ent\\@abc'],
expected_msg='Principal: canon@KRBTEST.COM\n')
realm.run([kadminl, 'getprinc', 'canon'],
expected_msg='Principal: canon@KRBTEST.COM\n')
@@ -424,7 +424,7 @@ realm.klist('canon@KRBTEST.COM', 'alias@KRBTEST.COM')
realm.kinit('ent@abc', password('canon'), ['-E'])
realm.run([kvno, 'alias'])
-realm.klist('ent\@abc@KRBTEST.COM', 'alias@KRBTEST.COM')
+realm.klist('ent\\@abc@KRBTEST.COM', 'alias@KRBTEST.COM')
# Test client name canonicalization in non-krbtgt AS reply
realm.kinit('alias', password('canon'), ['-C', '-S', 'kadmin/changepw'])
diff --git a/src/tests/t_mkey.py b/src/tests/t_mkey.py
index 41831fa..32f4070 100755
--- a/src/tests/t_mkey.py
+++ b/src/tests/t_mkey.py
@@ -23,7 +23,7 @@ nprincs = len(realm.run([kadminl, 'listprincs']).splitlines())
# have an activation time, and whether the key is expected to be
# currently active.
list_mkeys_re = re.compile(r'^KVNO: (\d+), Enctype: (\S+), '
- '(Active on: [^\*]+|No activate time set)( \*)?$')
+ r'(Active on: [^\*]+|No activate time set)( \*)?$')
def check_mkey_list(*expected):
# Split the output of kdb5_util list_mkeys into lines and ignore the first.
outlines = realm.run([kdb5_util, 'list_mkeys']).splitlines()[1:]
@@ -118,13 +118,13 @@ def add_mkey(options):
# specified) and verify the output against the expected mkvno, number
# of updated principals, and number of already-current principals.
mkvno_re = {False: re.compile(r'^Principals whose keys are being re-encrypted '
- 'to master key vno (\d+) if necessary:$'),
+ r'to master key vno (\d+) if necessary:$'),
True: re.compile(r'^Principals whose keys WOULD BE re-encrypted '
- 'to master key vno (\d+):$')}
+ r'to master key vno (\d+):$')}
count_re = {False: re.compile(r'^(\d+) principals processed: (\d+) updated, '
- '(\d+) already current$'),
+ r'(\d+) already current$'),
True: re.compile(r'^(\d+) principals processed: (\d+) would be '
- 'updated, (\d+) already current$')}
+ r'updated, (\d+) already current$')}
def update_princ_encryption(dry_run, expected_mkvno, expected_updated,
expected_current):
opts = ['-f', '-v']
diff --git a/src/tests/t_referral.py b/src/tests/t_referral.py
index dc56561..f427d5b 100755
--- a/src/tests/t_referral.py
+++ b/src/tests/t_referral.py
@@ -117,14 +117,14 @@ kdcconf = {'realms': {'$realm': {'database_module': 'test'}},
r1, r2 = cross_realms(2, xtgts=(),
args=({'kdc_conf': kdcconf, 'create_kdb': False}, None),
create_host=False)
-r2.addprinc('abc\@XYZ', 'pw')
+r2.addprinc('abc\\@XYZ', 'pw')
r1.start_kdc()
r1.kinit('user', expected_code=1,
expected_msg='not found in Kerberos database')
r1.kinit('user', password('user'), ['-C'])
r1.klist('user@KRBTEST2.COM', 'krbtgt/KRBTEST2.COM')
r1.kinit('abc@XYZ', 'pw', ['-E'])
-r1.klist('abc\@XYZ@KRBTEST2.COM', 'krbtgt/KRBTEST2.COM')
+r1.klist('abc\\@XYZ@KRBTEST2.COM', 'krbtgt/KRBTEST2.COM')
# Test that disable_encrypted_timestamp persists across client
# referrals. (This test relies on SPAKE not being enabled by default
diff --git a/src/tests/t_sesskeynego.py b/src/tests/t_sesskeynego.py
index 73a5536..9024aee 100755
--- a/src/tests/t_sesskeynego.py
+++ b/src/tests/t_sesskeynego.py
@@ -4,7 +4,7 @@ import re
# Run "kvno server" with a fresh set of client tickets, then check that the
# enctypes in the service ticket match the expected values.
etypes_re = re.compile(r'server@[^\n]+\n\tEtype \(skey, tkt\): '
- '([^,]+), ([^\s]+)')
+ r'([^,]+), ([^\s]+)')
def test_kvno(realm, expected_skey, expected_tkt):
realm.kinit(realm.user_princ, password('user'))
realm.run([kvno, 'server'])
diff --git a/src/util/k5test.py b/src/util/k5test.py
index e58c9fd..10f6b0a 100644
--- a/src/util/k5test.py
+++ b/src/util/k5test.py
@@ -385,7 +385,6 @@ import socket
import string
import subprocess
import sys
-import imp
# Used when most things go wrong (other than programming errors) so
# that the user sees an error message rather than a Python traceback,
@@ -601,14 +600,6 @@ def _build_env():
return env
-def _import_runenv():
- global buildtop
- runenv_py = os.path.join(buildtop, 'runenv.py')
- if not os.path.exists(runenv_py):
- fail('You must run "make runenv.py" in %s first.' % buildtop)
- return imp.load_source('runenv', runenv_py)
-
-
# Merge the nested dictionaries cfg1 and cfg2 into a new dictionary.
# cfg1 or cfg2 may be None, in which case the other is returned. If
# cfg2 contains keys mapped to None, the corresponding keys will be
@@ -1349,10 +1340,14 @@ _last_cmd_output = None
buildtop = _find_buildtop()
srctop = _find_srctop()
plugins = os.path.join(buildtop, 'plugins')
-runenv = _import_runenv()
hostname = socket.gethostname().lower()
null_input = open(os.devnull, 'r')
+if not os.path.exists(os.path.join(buildtop, 'runenv.py')):
+ fail('You must run "make runenv.py" in %s first.' % buildtop)
+sys.path = [buildtop] + sys.path
+import runenv
+
# A DB pass is a tuple of: name, kdc_conf.
_dbpasses = [('db2', None)]
if runenv.have_lmdb == 'yes':