[Freeipa-devel] [PATCH][WIP] LDAP encoding redone

Jan Cholasta jcholast at redhat.com
Wed Jun 27 16:01:53 UTC 2012


Hi,

this is the next patch in the input validation & handling series 
<https://fedorahosted.org/freeipa/ticket/2357>. It changes the way 
entries are encoded and decoded in the LDAP backend.

The patch consists of several changes:

   * Refactored the Encoder class to be more universally usable. It uses 
a polymorphic interface, which hopefully makes the encoding code more 
readable.

   * Attribute values now use Python data types matching the syntax of 
the attribute. This removes the need to decode/encode the values from/to 
raw LDAP values in the CallbackInterface callbacks as well as other 
parts of IPA.

   * On command output, attribute values are converted to strings so 
that the resulting entry is the same as it is without the patch. I don't 
like this code and I'd like to get rid of at least some parts of it, but 
I'm not sure how that would affect API compatibility. Removing the 
special case for boolean values would fix 
<https://fedorahosted.org/freeipa/ticket/2025>.

   * Entries are more strictly checked when they are encoded and 
decoded. Values of multi-value attributes must be lists (not tuples!) of 
objects of the appropriate python type, values of single-value 
attributes must be objects of the appropriate python type. This helps 
detecting data type errors that would previously go unnoticed.

   * Some parameters use data type that doesn't match the syntax of the 
according attribute, or are single-value even when the according 
attribute is multi-value. Values of such parameters wouldn't pass the 
new strict checking if they were used in attributes without 
modifications. To remedy this, added a new parameter option 
attr_convertor, which allows specifying a custom function for converting 
parameter values to attribute values.

Note that this is work in progress, some things may be (and certainly 
are) broken, there is some low-quality code and docstrings, comments and 
tests are TBD.

Suggestions and comments are welcome.

Honza

-- 
Jan Cholasta

-------------- next part --------------
A non-text attachment was scrubbed...
Name: jcholast-wip80-ldap-encoding.patch
Type: text/x-patch
Size: 116148 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/freeipa-devel/attachments/20120627/ffeb0366/attachment.bin>


More information about the Freeipa-devel mailing list