Permalink
Browse files

added option lists to SSHFP new record form

  • Loading branch information...
Matt Simerson
Matt Simerson committed Apr 9, 2013
1 parent 23708da commit 4e8796f16837d12c3c910c2226c1e86d976c6921
Showing with 126 additions and 73 deletions.
  1. +5 −0 client/Changes
  2. +62 −37 client/htdocs/nt-script.js
  3. +57 −31 client/htdocs/zone.cgi
  4. +2 −5 server/lib/NicToolServer/Export/tinydns.pm
View
@@ -1,4 +1,9 @@
+2.19 2013.
+
+ * added NSEC3, NSEC3PARAM, IPSECKEY, DNAME record types
+ * added option lists to SSHFP new record form
+
2.18 2013.04.05
* lengthen NS IP field to allow AAAA to fit
View
@@ -37,7 +37,7 @@ function selectedRRType(rrType) {
case 'NSEC3':
setFormRRTypeNSEC3(); break;
case 'NSEC3PARAM':
- setFormRRTypeNSECPARAM(); break;
+ setFormRRTypeNSEC3PARAM(); break;
case 'RRSIG':
setFormRRTypeRRSIG(); break;
}
@@ -52,25 +52,29 @@ function resetZoneRecordFormFields() {
};
$('input#priority' ).attr('readonly', false);
+ $('select#priority').hide().empty();
+
+ $('select#weight').hide().empty();
+
$('td#description_label').text( 'Description' );
};
function setFormRRTypeSRV() {
- $('tr#tr_weight').show();
- $('tr#tr_priority').show();
- $('tr#tr_other').show();
- $('td#other_label').text('Port');
+ $('tr#tr_weight').show();
+ $('tr#tr_priority').show();
+ $('tr#tr_other').show();
+ $('td#other_label').text('Port');
}
function setFormRRTypeNAPTR() {
- $('tr#tr_weight').show();
- $('td#weight_label').text('Order');
+ $('tr#tr_weight').show();
+ $('td#weight_label').text('Order');
- $('tr#tr_priority').show();
- $('td#priority_label').text('Preference');
+ $('tr#tr_priority').show();
+ $('td#priority_label').text('Preference');
- $('td#address_label').text('Flags, Services, Regexp');
- $('td#description_label').text('Replacement');
+ $('td#address_label').text('Flags, Services, Regexp');
+ $('td#description_label').text('Replacement');
}
function setFormRRTypeSSHFP() {
@@ -79,54 +83,75 @@ function setFormRRTypeSSHFP() {
$('tr#tr_weight').show();
$('td#weight_label').text('Algorithm');
+
+ var algoTypes = { '1' : 'RSA', '2' : 'DSA', '3' : 'ECDSA', };
var w = $('input#weight');
- if ( w.val() == '' ) w.val('3'); // 1=RSA, 2=DSS, 3=ECDSA
+ if ( w.val() == '' ) w.val('3');
+
+ var selWeight = $('select#weight').show();
+ $.each(algoTypes, function(key, value) {
+ selWeight
+ .append($('<option>', { value : key })
+ .text(value));
+ });
+ selWeight.val( w.val() );
+// Priority field stores the Fingerprint Type
$('tr#tr_priority').show();
$('td#priority_label').text('Type');
+
+ var fpTypes = { '1' : 'SHA-1', '2' : 'SHA-256', };
var p = $('input#priority');
- if ( p.val() == '' ) p.val('2'); // 1=SHA-1, 2=SHA-256
+ if ( p.val() == '' ) p.val('2'); // set the default
+
+ var selPri = $('select#priority').show();
+ $.each(fpTypes, function(key, value) {
+ selPri
+ .append($('<option>', { value : key })
+ .text(value));
+ });
+ selPri.val( p.val() );
}
function setFormRRTypeDNSKEY() {
- $('td#address_label').text('Public Key');
+ $('td#address_label').text('Public Key');
- $('tr#tr_weight').show();
- $('td#weight_label').text('Flag');
+ $('tr#tr_weight').show();
+ $('td#weight_label').text('Flag');
- $('tr#tr_priority').show();
- $('td#priority_label').text('Protocol');
- $('input#priority').val('3').attr('readonly', true);
+ $('tr#tr_priority').show();
+ $('td#priority_label').text('Protocol');
+ $('input#priority').val('3').attr('readonly', true);
- // 1=RSA/MD5, 2=Diffie-Hellman, 3=DSA/SHA-1, 4=Elliptic Curve, 5=RSA/SHA-1
- $('tr#tr_other').show();
- $('td#other_label').text('Algorithm');
- var o = $('input#other');
- if ( o.val() == '' ) o.val('5');
+ // 1=RSA/MD5, 2=Diffie-Hellman, 3=DSA/SHA-1, 4=Elliptic Curve, 5=RSA/SHA-1
+ $('tr#tr_other').show();
+ $('td#other_label').text('Algorithm');
+ var o = $('input#other');
+ if ( o.val() == '' ) o.val('5');
}
function setFormRRTypeDS() {
- $('td#address_label').text('Digest');
+ $('td#address_label').text('Digest');
- $('tr#tr_weight').show();
- $('td#weight_label').text('Key Tag');
+ $('tr#tr_weight').show();
+ $('td#weight_label').text('Key Tag');
- $('tr#tr_priority').show();
- $('td#priority_label').text('Algorithm');
- var p = $('input#priority');
- if ( ! p.val() ) p.val('5'); // RSA/SHA1
+ $('tr#tr_priority').show();
+ $('td#priority_label').text('Algorithm');
+ var p = $('input#priority');
+ if ( ! p.val() ) p.val('5'); // RSA/SHA1
- $('tr#tr_other').show();
- $('td#other_label').text('Digest Type');
- var o = $('input#other');
- if ( ! o.val() ) o.val('2'); // 1=SHA-1 , 2=SHA-256
+ $('tr#tr_other').show();
+ $('td#other_label').text('Digest Type');
+ var o = $('input#other');
+ if ( ! o.val() ) o.val('2'); // 1=SHA-1 , 2=SHA-256
}
function setFormRRTypeNSEC() {
- $('td#address_label').text('Next Domain Name');
- $('td#description_label').text('Type Bit Map');
+ $('td#address_label').text('Next Domain Name');
+ $('td#description_label').text('Type Bit Map');
}
function setFormRRTypeNSEC3() {
}
View
@@ -894,49 +894,27 @@ sub display_edit_record {
</tr>
<tr id=address class="light_grey_bg">
<td id=address_label class="right">Address:</td>
- <td id=address class="fat">], _build_rr_address( $q, $zone_record, $modifyperm ), $nt_obj->help_link('rraddress'), qq[
+ <td id=address class="fat">],
+ _build_rr_address( $q, $zone_record, $modifyperm ), $nt_obj->help_link('rraddress'),
+ qq[
</td>
</tr>
<tr id=tr_weight class="light_grey_bg">
<td id=weight_label class="right"> Weight:</td>
- <td id=weight class="fat">], $modifyperm ? $q->textfield(
- -id => 'weight',
- -name => 'weight',
- -size => 5,
- -maxlength => 10,
- -default => '10',
- -default => $zone_record->{'weight'}
- )
- : $zone_record->{'weight'},
- qq[
+ <td id=weight class="fat">],
+ _build_rr_weight( $q, $zone_record, $modifyperm ), qq[
</td>
</tr>
<tr id="tr_priority" class="light_grey_bg">
<td id=priority_label class="right"> Priority:</td>
- <td id=priority class="fat">], $modifyperm
- ? $q->textfield(
- -id => 'priority',
- -name => 'priority',
- -size => 5,
- -maxlength => 10,
- -default => '10',
- -default => $zone_record->{'priority'}
- )
- : $zone_record->{'priority'}, qq[
+ <td id=priority class="fat">],
+ _build_rr_priority( $q, $zone_record, $modifyperm ), qq[
</td>
</tr>
<tr id="tr_other" class="light_grey_bg">
<td id=other_label class="right"> Port:</td>
- <td id=other class="fat">], $modifyperm ? $q->textfield(
- -id => 'other',
- -name => 'other',
- -size => 5,
- -maxlength => 10,
- -default => '10',
- -default => $zone_record->{'other'}
- )
- : $zone_record->{'other'},
- qq[
+ <td id=other class="fat">],
+ _build_rr_other( $q, $zone_record, $modifyperm ), qq[
</td>
</tr>
<tr id=ttl class="light_grey_bg">
@@ -1056,6 +1034,54 @@ sub _build_rr_address {
);
};
+sub _build_rr_weight {
+ my ( $q, $zone_record, $modifyperm) = @_;
+
+ return $zone_record->{'weight'} if ! $modifyperm;
+ return $q->textfield(
+ -id => 'weight',
+ -name => 'weight',
+ -size => 5,
+ -maxlength => 10,
+ -default => $zone_record->{'weight'},
+ -onChange => q[$('select#weight').val(this.value);],
+ )
+ . q[<select id=weight class='hidden' onChange="$('input#weight').val(this.value);"></select>
+];
+};
+
+sub _build_rr_priority {
+ my ( $q, $zone_record, $modifyperm) = @_;
+
+ return $zone_record->{'priority'} if ! $modifyperm;
+ return $q->textfield(
+ -id => 'priority',
+ -name => 'priority',
+ -size => 5,
+ -maxlength => 10,
+ -default => $zone_record->{'priority'},
+ -onChange => q[$('select#priority').val(this.value);],
+ )
+ . q[<select id=priority class='hidden' onChange="$('input#priority').val(this.value);"></select>
+];
+};
+
+sub _build_rr_other {
+ my ( $q, $zone_record, $modifyperm) = @_;
+
+ return $zone_record->{'other'} if ! $modifyperm;
+ return $q->textfield(
+ -id => 'other',
+ -name => 'other',
+ -size => 5,
+ -maxlength => 10,
+ -default => $zone_record->{'other'},
+ -onChange => q[$('select#other').val(this.value);],
+ )
+ . q[<select id=other class='hidden' onChange="$('input#other').val(this.value);"></select>
+];
+};
+
sub display_edit_record_delegates {
my ($nt_obj, $q, $user, $zone_record, $delegates ) = @_;
@@ -436,10 +436,7 @@ sub zr_dname {
# https://tools.ietf.org/html/rfc6672
# https://tools.ietf.org/html/rfc2672 (obsolete)
-
- my $rdata = $self->pack_domain_name(
- $self->qualify( $r->{address} )
- );
+ my $rdata = $self->pack_domain_name( $self->qualify( $r->{address} ) );
return $self->zr_generic( 39, $r, $rdata );
};
@@ -451,7 +448,7 @@ sub zr_sshfp {
# http://www.openssh.org/txt/rfc4255.txt
# http://tools.ietf.org/html/draft-os-ietf-sshfp-ecdsa-sha2-00
- my $algo = $r->{weight}; # 1 octet - 1=RSA, 2=DSS, 3=ECDSA
+ my $algo = $r->{weight}; # 1 octet - 1=RSA, 2=DSA, 3=ECDSA
my $type = $r->{priority}; # 1 octet - 1=SHA-1, 2=SHA-256
my $fingerprint = $r->{address}; # in hex

0 comments on commit 4e8796f

Please sign in to comment.