Closed
Description
When relying on KRB5_CLIENT_KTNAME
to specify a keytab, it is useful to support empty client_keytab
values in the cred store.
FreeIPA has a helper kinit_keytab
which uses python-gssapi
and when passing a None
for keytab there, python-gssapi
fails:
$ python3
Python 3.7.4 (default, Jul 9 2019, 16:32:37)
[GCC 9.1.1 20190503 (Red Hat 9.1.1-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from ipalib.install.kinit import kinit_keytab
>>> cred = kinit_keytab('user@EXAMPLE.COM', None, 'MEMORY:FOOBAR')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.7/site-packages/ipalib/install/kinit.py", line 47, in kinit_keytab
cred = gssapi.Credentials(name=name, store=store, usage='initiate')
File "/usr/lib64/python3.7/site-packages/gssapi/creds.py", line 64, in __new__
store=store)
File "/usr/lib64/python3.7/site-packages/gssapi/creds.py", line 148, in acquire
usage)
File "gssapi/raw/ext_cred_store.pyx", line 154, in gssapi.raw.ext_cred_store.acquire_cred_from
File "gssapi/raw/ext_cred_store.pyx", line 86, in gssapi.raw.ext_cred_store.c_create_key_value_set
TypeError: expected bytes, NoneType found
>>>
This is because of the following code: https://github.com/pythongssapi/python-gssapi/blob/master/gssapi/raw/ext_cred_store.pyx#L68-L88 where I'd suggest skip assignment of None values to avoid the problem I verified that kg_value_from_cred_store()
will happily work with NULL values:
for (i, (k, v)) in enumerate(values.items()):
res.elements[i].key = k
if v:
res.elements[i].value = v
Metadata
Metadata
Assignees
Labels
No labels