From 2229e89bbb2b89ad72e467de83f735b308a7bca1 Mon Sep 17 00:00:00 2001 From: Martin Basti Date: Tue, 17 Jun 2014 17:52:37 +0200 Subject: [PATCH] Digest part in DLV/DS records allows only heaxadecimal characters Reviewed-By: Petr Vobornik --- API.txt | 8 ++++---- ipalib/plugins/dns.py | 2 ++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/API.txt b/API.txt index d0cd4768d..0dd28068e 100644 --- a/API.txt +++ b/API.txt @@ -825,7 +825,7 @@ option: DNSNameParam('cname_part_hostname', attribute=False, cli_name='cname_hos option: CNAMERecord('cnamerecord', attribute=True, cli_name='cname_rec', csv=True, multivalue=True, option_group=u'CNAME Record', required=False) option: DHCIDRecord('dhcidrecord', attribute=True, cli_name='dhcid_rec', csv=True, multivalue=True, option_group=u'DHCID Record', required=False) option: Int('dlv_part_algorithm', attribute=False, cli_name='dlv_algorithm', maxvalue=255, minvalue=0, multivalue=False, option_group=u'DLV Record', required=False) -option: Str('dlv_part_digest', attribute=False, cli_name='dlv_digest', multivalue=False, option_group=u'DLV Record', required=False) +option: Str('dlv_part_digest', attribute=False, cli_name='dlv_digest', multivalue=False, option_group=u'DLV Record', pattern='^[0-9a-fA-F]+$', required=False) option: Int('dlv_part_digest_type', attribute=False, cli_name='dlv_digest_type', maxvalue=255, minvalue=0, multivalue=False, option_group=u'DLV Record', required=False) option: Int('dlv_part_key_tag', attribute=False, cli_name='dlv_key_tag', maxvalue=65535, minvalue=0, multivalue=False, option_group=u'DLV Record', required=False) option: DLVRecord('dlvrecord', attribute=True, cli_name='dlv_rec', csv=True, multivalue=True, option_group=u'DLV Record', required=False) @@ -835,7 +835,7 @@ option: StrEnum('dnsclass', attribute=True, cli_name='class', multivalue=False, option: DNSKEYRecord('dnskeyrecord', attribute=True, cli_name='dnskey_rec', csv=True, multivalue=True, option_group=u'DNSKEY Record', required=False) option: Int('dnsttl', attribute=True, cli_name='ttl', multivalue=False, required=False) option: Int('ds_part_algorithm', attribute=False, cli_name='ds_algorithm', maxvalue=255, minvalue=0, multivalue=False, option_group=u'DS Record', required=False) -option: Str('ds_part_digest', attribute=False, cli_name='ds_digest', multivalue=False, option_group=u'DS Record', required=False) +option: Str('ds_part_digest', attribute=False, cli_name='ds_digest', multivalue=False, option_group=u'DS Record', pattern='^[0-9a-fA-F]+$', required=False) option: Int('ds_part_digest_type', attribute=False, cli_name='ds_digest_type', maxvalue=255, minvalue=0, multivalue=False, option_group=u'DS Record', required=False) option: Int('ds_part_key_tag', attribute=False, cli_name='ds_key_tag', maxvalue=65535, minvalue=0, multivalue=False, option_group=u'DS Record', required=False) option: DSRecord('dsrecord', attribute=True, cli_name='ds_rec', csv=True, multivalue=True, option_group=u'DS Record', required=False) @@ -1038,7 +1038,7 @@ option: CNAMERecord('cnamerecord', attribute=True, autofill=False, cli_name='cna option: Str('delattr*', cli_name='delattr', exclude='webui') option: DHCIDRecord('dhcidrecord', attribute=True, autofill=False, cli_name='dhcid_rec', csv=True, multivalue=True, option_group=u'DHCID Record', required=False) option: Int('dlv_part_algorithm', attribute=False, autofill=False, cli_name='dlv_algorithm', maxvalue=255, minvalue=0, multivalue=False, option_group=u'DLV Record', required=False) -option: Str('dlv_part_digest', attribute=False, autofill=False, cli_name='dlv_digest', multivalue=False, option_group=u'DLV Record', required=False) +option: Str('dlv_part_digest', attribute=False, autofill=False, cli_name='dlv_digest', multivalue=False, option_group=u'DLV Record', pattern='^[0-9a-fA-F]+$', required=False) option: Int('dlv_part_digest_type', attribute=False, autofill=False, cli_name='dlv_digest_type', maxvalue=255, minvalue=0, multivalue=False, option_group=u'DLV Record', required=False) option: Int('dlv_part_key_tag', attribute=False, autofill=False, cli_name='dlv_key_tag', maxvalue=65535, minvalue=0, multivalue=False, option_group=u'DLV Record', required=False) option: DLVRecord('dlvrecord', attribute=True, autofill=False, cli_name='dlv_rec', csv=True, multivalue=True, option_group=u'DLV Record', required=False) @@ -1048,7 +1048,7 @@ option: StrEnum('dnsclass', attribute=True, autofill=False, cli_name='class', mu option: DNSKEYRecord('dnskeyrecord', attribute=True, autofill=False, cli_name='dnskey_rec', csv=True, multivalue=True, option_group=u'DNSKEY Record', required=False) option: Int('dnsttl', attribute=True, autofill=False, cli_name='ttl', multivalue=False, required=False) option: Int('ds_part_algorithm', attribute=False, autofill=False, cli_name='ds_algorithm', maxvalue=255, minvalue=0, multivalue=False, option_group=u'DS Record', required=False) -option: Str('ds_part_digest', attribute=False, autofill=False, cli_name='ds_digest', multivalue=False, option_group=u'DS Record', required=False) +option: Str('ds_part_digest', attribute=False, autofill=False, cli_name='ds_digest', multivalue=False, option_group=u'DS Record', pattern='^[0-9a-fA-F]+$', required=False) option: Int('ds_part_digest_type', attribute=False, autofill=False, cli_name='ds_digest_type', maxvalue=255, minvalue=0, multivalue=False, option_group=u'DS Record', required=False) option: Int('ds_part_key_tag', attribute=False, autofill=False, cli_name='ds_key_tag', maxvalue=65535, minvalue=0, multivalue=False, option_group=u'DS Record', required=False) option: DSRecord('dsrecord', attribute=True, autofill=False, cli_name='ds_rec', csv=True, multivalue=True, option_group=u'DS Record', required=False) diff --git a/ipalib/plugins/dns.py b/ipalib/plugins/dns.py index 38b8bcffc..a81fb575b 100644 --- a/ipalib/plugins/dns.py +++ b/ipalib/plugins/dns.py @@ -1018,6 +1018,8 @@ class DSRecord(DNSRecord): ), Str('digest', label=_('Digest'), + pattern=r'^[0-9a-fA-F]+$', + pattern_errmsg=u'only hexadecimal digits are allowed' ), )