Fix pulled from upstream - https://github.com/rra/pam-krb5/commit/265870985e578a78a4112bd3f6c23c171b1097b8 --- a/tests/data/generate-krb5-conf +++ b/tests/data/generate-krb5-conf @@ -67,8 +67,17 @@ { if (skip == 0) print } ' "$p" > tmp/krb5.conf.tmp if [ -n "$realm" ] ; then - sed -e "s/\\(default_realm.*=\\) .*/\\1 $realm/" \ - tmp/krb5.conf.tmp > tmp/krb5.conf + pattern='^[ ]*default_realm.*=' + if grep "$pattern" tmp/krb5.conf.tmp >/dev/null 2>/dev/null; then + sed -e "s/\\(default_realm.*=\\) .*/\\1 $realm/" \ + tmp/krb5.conf.tmp >tmp/krb5.conf + else + ( + cat tmp/krb5.conf.tmp + echo "[libdefaults]" + echo " default_realm = $realm" + ) >tmp/krb5.conf + fi rm tmp/krb5.conf.tmp else mv tmp/krb5.conf.tmp tmp/krb5.conf --- a/tests/module/basic-t.c +++ b/tests/module/basic-t.c @@ -16,7 +16,7 @@ #include #include - +#include int main(void) @@ -25,6 +25,12 @@ plan_lazy(); + /* + * 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"); + /* Attempt login as the root user to test ignore_root. */ memset(&config, 0, sizeof(config)); config.user = "root";