xref: /freebsd/crypto/krb5/src/tests/t_kdc_log.py (revision 7f2fe78b9dd5f51c821d771b63d2e096f6fd49e9)
1*7f2fe78bSCy Schubertfrom k5test import *
2*7f2fe78bSCy Schubert
3*7f2fe78bSCy Schubert# Make a TGS request with an expired ticket.
4*7f2fe78bSCy Schubertrealm = K5Realm()
5*7f2fe78bSCy Schubertrealm.stop()
6*7f2fe78bSCy Schubertrealm.start_kdc(['-T', '3600'])
7*7f2fe78bSCy Schubertrealm.run([kvno, realm.host_princ], expected_code=1)
8*7f2fe78bSCy Schubert
9*7f2fe78bSCy Schubertkdc_logfile = os.path.join(realm.testdir, 'kdc.log')
10*7f2fe78bSCy Schubertf = open(kdc_logfile, 'r')
11*7f2fe78bSCy Schubertfound_skew = False
12*7f2fe78bSCy Schubertfor line in f:
13*7f2fe78bSCy Schubert    if 'Clock skew too great' in line:
14*7f2fe78bSCy Schubert        found_skew = True
15*7f2fe78bSCy Schubert        if realm.user_princ not in line:
16*7f2fe78bSCy Schubert            fail('Client principal not logged in expired-ticket TGS request')
17*7f2fe78bSCy Schubertf.close()
18*7f2fe78bSCy Schubertif not found_skew:
19*7f2fe78bSCy Schubert    fail('Did not find KDC log line for expired-ticket TGS request')
20*7f2fe78bSCy Schubert
21*7f2fe78bSCy Schubertsuccess('KDC logging tests')
22