[Freeipa-devel] [PATCH] 199 convert uidnumber to string

Pavel Zuna pzuna at redhat.com
Mon May 11 14:57:59 UTC 2009


Rob Crittenden wrote:
> Jason Gerard DeRose wrote:
>> On Wed, 2009-05-06 at 07:40 -0400, Rob Crittenden wrote:
>>> Jason Gerard DeRose wrote:
>>>> On Mon, 2009-05-04 at 16:31 -0400, Rob Crittenden wrote:
>>>>> We need to convert the uidnumber to a string when adding/modifying 
>>>>> users to avoid a type error on the LDAP side.
>>>>>
>>>>> Pavel, I'm not sure whether this is handled automagically or not in 
>>>>> your version of the plugin.
>>>>>
>>>>> rob
>>>> ack.
>>>>
>>>> This is fine as a stop gap, but we really need a better solution in the
>>>> long run.
>>>>
>>>> So the UID is always in integer, correct?  Do all LDAP "types" need to
>>>> be sent as strings, or is this just a case where we are using a more
>>>> restrictive type in IPA than the attribute in LDAP?
>>>>
>>> Pavel is working on some smarter schema handling in the new LDAP 
>>> plugin.   I think that will handle the type conversions for us.
>>>
>>> rob
>>
>> Still confused about the LDAP type, though: so is there such a thing as
>> an LDAP integer type?  Why exactly are we converting to a string
>> representation of the integer?
>>
> 
> We're converting because python-ldap blew up, reporting an incorrect 
> type with the uid. Converting to a string makes it work.
> 
> rob
python-ldap requires all attribute values to be strings. The conversion 
was done automatically by args_options_2_entry Command method, but:
1) plugins that were written prior to it's introduction are not using it
2) it blows up for unicode strings composed of non-ASCII characters 
(although this problem isn't specific to this method only)

There is an integer type in LDAP or more precisely an integer SYNTAX, 
but integers are still stored as text. As pointed out by Simo (iirc) 
they have a practically unlimited range, so we can't use the python int
type when retrieving them back. (Well, we can in most cases, but it 
shouldn't be done automatically.)

The new LDAP backends accepts any python type and makes it's own safe 
conversions based on the schema.

Pavel




More information about the Freeipa-devel mailing list