[SSSD] [PATCH] Fix python HBAC bindings for python <= 2.4

Alexander Bokovoy abokovoy at redhat.com
Tue Jul 12 14:40:21 UTC 2011


Hi Jakub,

(sorry for breaking the thread, I forgot to subscribe to the list 
earlier and thus got no reference to the thread).

I would NACK the patch. Few issues:

1. char *str_concat_sequence(PyObject *seq, char *delim) use is always 
with constant delim, it would make sense to change the signature to 
follow it.

2. discard_const_p() for Python 2.4 is a bit too wide use as it weakens 
2.6 (and 3.0) API usage. What if you make a simple wrapper on top of 
discard_const_p() that is ident to it for 2.4 but returns the actual 
value without type conversion for other cases.

Something like this:
#if PYTHON_2_4
#define sss_py_const_p(type, value) discard_const_p(type, (value))
#else
#define sss_py_const_p(type, value) (value)
#endif

3. hbac_rule_set_enabled() currently is too strict, it accepts only 
Python's boolean. In FreeIPA LDAP backend returned values are strings so 
we'll have to build up a wrapper on top of pyhbac. What about be more 
flexible and accepting what FreeIPA's Bool parameter type accepts:
  ('truths', frozenset, frozenset([1, u'1', u'true', u'TRUE'])),
  ('falsehoods', frozenset, frozenset([0, u'0', u'false', u'FALSE']))

This would be needed only for setter, getter would always give out PyBool.

Please split the patch into two -- compatibility fixes and API improvements.

Thanks in advance,
-- 
/ Alexander Bokovoy



More information about the sssd-devel mailing list