rjancewicz / python-kadmin

Python module for kerberos admin (kadm5)
MIT License
35 stars 42 forks source link

Add PyDateTime_IMPORT to module initialization function. #18

Closed aebruno closed 10 years ago

aebruno commented 10 years ago

Was experiencing segfaults when accessing datetime fields on the PyKAdminPrincipalObject, for example, calls to function PyKAdminPrincipal_get_expire(..) resulted in a segfault.

Example code resulting in segfault:

import kadmin

kadm = kadmin.init_with_keytab("user@example.com", "/path/to/keytab") princ = kadm.get_principal("user@example.com") print princ.expire

However, if imported datetime module first, all is well:

import kadmin import datetime

kadm = kadmin.init_with_keytab("user@example.com", "/path/to/keytab") princ = kadm.get_principal("user@example.com") print princ.expire

This suggested datetime wasn't being initialized properly? Adding this patch to ensure Py_DateTime is initialized as part of the module initialization fixed the segfaults.

rjancewicz commented 10 years ago

It would appear that you have forked from a much older branch. Please rebase off the current master and try the test again. I am unable to reproduce the error.

aebruno commented 10 years ago

Thanks, looks like your recent commit 5e7e39f6e79f9552dd9726f9334b2d916c7f0877 fixed my issue (not sure if it's related). I could reproduce this on ac95fa951e892adbaabf6c9be9eb9803b308d85f (which is where I forked from). Thanks for your work on this library! Feel free to close this out.