rra / pam-krb5

PAM module for Kerberos authentication
https://www.eyrie.org/~eagle/software/pam-krb5/
Other
19 stars 14 forks source link

`module/long` tests always fail if `default_realm` is unset. #25

Closed jcpunk closed 2 years ago

jcpunk commented 2 years ago

Test Platform: fedora-mock

The default build environment for mock on Fedora (and other rpm distros) is to have default_realm in /etc/krb5.conf unset.

I think if the unit tests provided some sort of "UNIT-TEST.EXAMPLE.COM" realm to the user argument, they would work...

[mockbuild@69883bfbc1ac4b1cab35913c388e0181 tests]$ ./runtests -o module/long-t
# Starting data/scripts/long/password
#  left: 7
# right: 3
not ok 1 - status for authenticate
#  left: 5
# right: 3
not ok 2 - output priority 1
#  left: authentication failure; logname=test uid=1000 euid=1000 tty= ruser= rhost=
# right: (user test) parse_name failed: Configuration file does not specify default realm
not ok 3 - output line 1
# unexpected: (5) authentication failure; logname=test uid=1000 euid=1000 tty= ruser= rhost=
not ok 4 - unexpected output lines
# Starting data/scripts/long/password-debug
#  left: 7
# right: 3
not ok 5 - status for authenticate
ok 6 - output priority 1
ok 7 - output line 1
#  left: 7
# right: 3
not ok 8 - output priority 2
# wanted: /^\(user test\) rejecting password longer than [0-9]+$/
#   seen: (user test) parse_name failed: Configuration file does not specify default realm
not ok 9 - output line 2
ok 10 - output priority 3
ok 11 - output line 3
ok 12 - output priority 4
ok 13 - output line 4
ok 14 - no excess output
# Starting data/scripts/long/use-first
#  left: 7
# right: 3
not ok 15 - status for authenticate
#  left: 5
# right: 3
not ok 16 - output priority 1
#  left: authentication failure; logname=test uid=1000 euid=1000 tty= ruser= rhost=
# right: (user test) parse_name failed: Configuration file does not specify default realm
not ok 17 - output line 1
# unexpected: (5) authentication failure; logname=test uid=1000 euid=1000 tty= ruser= rhost=
not ok 18 - unexpected output lines
# Starting data/scripts/long/use-first-debug
#  left: 7
# right: 3
not ok 19 - status for authenticate
ok 20 - output priority 1
ok 21 - output line 1
#  left: 7
# right: 3
not ok 22 - output priority 2
# wanted: /^\(user test\) rejecting password longer than [0-9]+$/
#   seen: (user test) parse_name failed: Configuration file does not specify default realm
not ok 23 - output line 2
ok 24 - output priority 3
ok 25 - output line 3
ok 26 - output priority 4
ok 27 - output line 4
ok 28 - no excess output
1..28
# Looks like you failed 14 tests of 28
rra commented 2 years ago

Thanks, yeah, I forgot to add the code to set up the Kerberos configuration when I added that test. Will be fixed in the next release. tests/module/long-t.c needs to start with a call like:

    /*
     * Generate a testing krb5.conf file with a nonexistent default realm so
     * that this test will run on any system.
     */
    kerberos_generate_conf("bogus.example.com");