[Freeipa-devel] [PATCH] 186 Use XML routines in ra plugin
Pavel Zuna
pzuna at redhat.com
Mon Apr 27 14:41:08 UTC 2009
Rob Crittenden wrote:
> 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
ack.
Pavel
More information about the Freeipa-devel
mailing list