If a caller tries to acquire krb5 acceptor creds with no desired name
and we have no keytab keys, fail from gss_acquire_cred instead of
deferring until gss_accept_sec_context.
ticket: 7159 (new)
}
if (desired_name != NULL) {
+ /* Make sure we keys matching the desired name in the keytab. */
code = check_keytab(context, kt, desired_name);
if (code) {
krb5_kt_close(context, kt);
*minor_status = code;
return GSS_S_FAILURE;
}
+ } else {
+ /* Make sure we have a keytab with keys in it. */
+ code = krb5_kt_have_content(context, kt);
+ if (code) {
+ *minor_status = code;
+ return GSS_S_FAILURE;
+ }
}
cred->keytab = kt;
if 'Wrong principal in request' not in output:
fail('Expected error message not seen in t_imp_cred output')
+# Verify that we can't acquire acceptor creds without a keytab.
+os.remove(realm.keytab)
+output = realm.run_as_client(['./t_accname', 'abc'], expected_code=1)
+if ('gss_acquire_cred: Keytab' not in output or
+ 'nonexistent or empty' not in output):
+ fail('Expected error message not seen for nonexistent keytab')
+
realm.stop()
# Re-run the last acceptor name test with ignore_acceptor_hostname set