[Freeipa-devel] [PATCH] 062-065 Ticket 1466 Validate AAAA records as valid IPv6 prior to sending to server

Petr Vobornik pvoborni at redhat.com
Tue Jan 10 09:34:59 UTC 2012


Updated patch attached.

On 01/10/2012 06:50 AM, Endi Sukma Dewata wrote:
> On 1/9/2012 9:20 AM, Petr Vobornik wrote:
>
> One problem, try adding an A record but enter an IPv6 address, you'll
> get an error message. Then change it to AAAA, the message is still there
> even though the data is now correct. I think the on_type_change() should
> call validate().

Fixed

> Another problem, after adding the AAAA record, close the dialog, then
> then an A record, the validator is still IPv6. I think the
> on_type_change() should be called from reset() instead of
> widgets_created(). The change to select_widget.save() might not be
> necessary because the dialog will call create() before reset().

Fixed

>>> 6. Existing problem, in the extract_child_value() in
>>> IPA.multivalued_text_widget if the value is an empty array the function
>>> will return the array itself instead of empty string.
>>
>> Fixed
>
> It works, but it might be better to use if (value instanceof Array).

Changed.

>> Some thoughts when I was implementing #2:
>> I wanted to use only one field and abandon the overriding of
>> create_add_command in record_adder_dialog (I don't like that hack).
>> I was thinking about two possible solutions:
>> 1) Override field's save method and use something like this:
>> "record[type_got_from_other_widget] = values". Problem is that this
>> method doesn't work with command construction in adder dialog and
>> details facet - they rely on fields.name will be different from the type.
>> 2) Second approach was to dynamically change field's name. This seemed
>> bad because the field can be saved in fields map under original name,
>> not his current name. (Adding and removing from the map seemed even
>> worse).
>>
>> In the end I left it as it was.
>>
>> How evil are those approaches or the relying on fields name (the field
>> can put something other or even more values to record in its save
>> mehtod.) in command construction? Do we want to keep those constrains
>> (field should save under its name only one value)?
>
> We might be able to fix the create_add_command() in entity_adder dialog
> to iterate through the record's contents instead of using the fields
> list. Then you can customize the save() to produce the correct record.

Yes, in adder dialog it is very trivial - just simple for-in loop. But 
to be consistent it would have to be changed in details facet too. Which 
is not so trivial but it can be done. So to summarize it: it (#1) is OK 
to do it in some future patch if it is needed.


-- 
Petr Vobornik
-------------- next part --------------
A non-text attachment was scrubbed...
Name: freeipa-pvoborni-0067-1-Added-IP-address-validator-to-Host-and-DNS-record-ad.patch
Type: text/x-patch
Size: 8727 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/freeipa-devel/attachments/20120110/6121e540/attachment.bin>


More information about the Freeipa-devel mailing list