[Freeipa-devel] [PATCH] fix user.getValue()

Pete Rowley prowley at redhat.com
Tue Aug 14 00:34:17 UTC 2007


Kevin McCarthy wrote:
> Andrew Bartlett wrote:
>   
>> On Mon, 2007-08-13 at 09:31 -0400, Rob Crittenden wrote:
>>     
>>> Kevin McCarthy wrote:
>>>       
>>>> I think we should be looking at the value instead of value[0] to
>>>> determine what it is.  I stumbled across this bug because I was able to
>>>> submit telephoneNumber as an empty string.  The code was blowing up
>>>> trying to do a value[0] on "".
>>>>
>>>> This raises a point about whether we should allow empty strings into
>>>> LDAP.  Pete had some points about this, but I'll allow him to state them
>>>> (since I'm not sure I understood them).
>>>>
>>>> -Kevin
>>>>         
>>> I suspect that the proper fix is to not allow empty attributes to be set 
>>> in the first place.
>>>       
>> Empty attributes sounds like a route to pain...  Also perhaps ensure
>> admins can't set an attribute to " ". 
>>     
>
> So should this be filtered out in funcs.py, or should the web (and
> commandline) gui filter out empty fields?
>
> Also, I didn't want it to get lost that the patch I sent should be
> applied regardless of how we filter empty attributes:  value is
> either a string or a sequence.  It was a bug/typo to check if value[0]
> is an instance of a list or tuple.  It just became apparent when
> telephoneNumber was zero-length and we tried to grab value[0] of "".
>   
I think the server side rpc should return an error if asked to apply an 
empty value, that tends to get clients to do the right thing, and I 
don't think we ought to be in the business of silently cleaning up after 
rpc clients. I would _not_ filter out whitespace only values either 
since that takes effort on the part of the client, or in other words the 
client is probably specifically trying to do that for some reason - 
perhaps to work around us not allowing empty values :)

-- 
Pete

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3241 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://listman.redhat.com/archives/freeipa-devel/attachments/20070813/7d5ed164/attachment.bin>


More information about the Freeipa-devel mailing list