From acaa556eedd2f3899a8b9337b5f051cdf50f2764 Mon Sep 17 00:00:00 2001 From: rpm-build Date: Nov 25 2020 08:14:11 +0000 Subject: Correctly-import-service-GSS-host-based-name.patch patch_name: Correctly-import-service-GSS-host-based-name.patch present_in_specfile: true location_in_specfile: 13 --- diff --git a/src/lib/gssapi/krb5/import_name.c b/src/lib/gssapi/krb5/import_name.c index da2ab14..21023dd 100644 --- a/src/lib/gssapi/krb5/import_name.c +++ b/src/lib/gssapi/krb5/import_name.c @@ -102,8 +102,8 @@ parse_hostbased(const char *str, size_t len, memcpy(service, str, servicelen); service[servicelen] = '\0'; - /* If present, copy the hostname. */ - if (at != NULL) { + /* Copy the hostname if present (at least one character after '@'). */ + if (len - servicelen > 1) { hostlen = len - servicelen - 1; host = malloc(hostlen + 1); if (host == NULL) { diff --git a/src/tests/gssapi/t_gssapi.py b/src/tests/gssapi/t_gssapi.py index 54d5cf5..ecf9826 100755 --- a/src/tests/gssapi/t_gssapi.py +++ b/src/tests/gssapi/t_gssapi.py @@ -47,6 +47,9 @@ realm.run(['./t_accname', 'p:service2/calvin', 'h:service2'], expected_msg='service2/calvin') realm.run(['./t_accname', 'p:service2/calvin', 'h:service1'], expected_code=1, expected_msg=' found in keytab but does not match server principal') +# Regression test for #8892 (trailing @ in name). +realm.run(['./t_accname', 'p:service1/andrew', 'h:service1@'], + expected_msg='service1/abraham') # Test with acceptor name containing service and host. Use the # client's un-canonicalized hostname as acceptor input to mirror what