[Freeipa-devel] [PATCH] 186 Use XML routines in ra plugin
Rob Crittenden
rcritten at redhat.com
Fri Apr 24 19:56:21 UTC 2009
Pavel Zuna wrote:
> Rob Crittenden wrote:
>> Some of the data coming back from dogtag is a horrific javascript
>> jumble, some of it is valid XML. In the case of XML lets use xml
>> parsing functions instead.
>>
>> Also strip any CR/LF off stored passwords. Leaving them in will cause
>> NSS certdb authentication issues.
>>
>> rob
> I don't know much about dogtag, but after playing a bit with
> xml.dom.minidom, I think some of the checks in this patch need to be
> changed.
>
> doc = xml.dom.minidom.parseString(stdout)
>
> item_node = doc.getElementByTagName('Status')
> # if there's no Status tag, item_node is empty, item_node[0] raises
> IndexError
> # if the value is empty ('<Status></Status>') item_node[0].childNodes is
> empty, item_node.childNodes[0] raises IndexError
> status = item_node[0].childNodes[0].data
> # I think that status will never be None at this point
> if status is not None:
> #...
>
> Something like this would probably make more sense:
>
> item_node = doc.getElementsByTagName('Status')
> try:
> status = item_node[0].childNodes[0].data
> except (IndexError, AttributeError):
> pass
> else:
> response['status'] = status
>
> Other than that, it looks fine.
>
> As I said I know almost nothing about dogtag, so maybe I'm wrong. I'm
> just commenting on what I can read from the code alone.
>
> Pavel
Bah, thanks for catching that. I've attached a revised patch.
rob
-------------- next part --------------
A non-text attachment was scrubbed...
Name: freeipa-186-2-ra.patch
Type: application/mbox
Size: 2758 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/freeipa-devel/attachments/20090424/1f553613/attachment.mbox>
More information about the Freeipa-devel
mailing list