projects
/
freeside.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
0afabbd
)
dns updates from Erik L: add ttl support, add check for SRV and finish allowing addit...
author
ivan
<ivan>
Sat, 11 Sep 2010 17:02:59 +0000
(17:02 +0000)
committer
ivan
<ivan>
Sat, 11 Sep 2010 17:02:59 +0000
(17:02 +0000)
FS/FS/Schema.pm
patch
|
blob
|
history
FS/FS/domain_record.pm
patch
|
blob
|
history
FS/FS/part_export/domain_sql.pm
patch
|
blob
|
history
FS/FS/svc_domain.pm
patch
|
blob
|
history
httemplate/view/svc_domain/dns.html
patch
|
blob
|
history
diff --git
a/FS/FS/Schema.pm
b/FS/FS/Schema.pm
index
cc6438a
..
459dcab
100644
(file)
--- a/
FS/FS/Schema.pm
+++ b/
FS/FS/Schema.pm
@@
-1795,6
+1795,7
@@
sub tables_hashref {
'recaf', 'char', '', 2, '', '',
'rectype', 'varchar', '', 5, '', '',
'recdata', 'varchar', '', 255, '', '',
'recaf', 'char', '', 2, '', '',
'rectype', 'varchar', '', 5, '', '',
'recdata', 'varchar', '', 255, '', '',
+ 'ttl', 'int', 'NULL', '', '', '',
],
'primary_key' => 'recnum',
'unique' => [],
],
'primary_key' => 'recnum',
'unique' => [],
diff --git
a/FS/FS/domain_record.pm
b/FS/FS/domain_record.pm
index
e7e9f70
..
9f1eb53
100644
(file)
--- a/
FS/FS/domain_record.pm
+++ b/
FS/FS/domain_record.pm
@@
-1,7
+1,7
@@
package FS::domain_record;
use strict;
package FS::domain_record;
use strict;
-use vars qw( @ISA $noserial_hack $DEBUG );
+use vars qw( @ISA $noserial_hack $DEBUG
$me
);
use FS::Conf;
#use FS::Record qw( qsearch qsearchs );
use FS::Record qw( qsearchs dbh );
use FS::Conf;
#use FS::Record qw( qsearch qsearchs );
use FS::Record qw( qsearchs dbh );
@@
-11,6
+11,7
@@
use FS::svc_www;
@ISA = qw(FS::Record);
$DEBUG = 0;
@ISA = qw(FS::Record);
$DEBUG = 0;
+$me = '[FS::domain_record]';
=head1 NAME
=head1 NAME
@@
-51,6
+52,8
@@
supported:
=item recdata - data for this entry
=item recdata - data for this entry
+=item ttl - time to live
+
=back
=head1 METHODS
=back
=head1 METHODS
@@
-265,10
+268,12
@@
sub check {
$self->recaf =~ /^(IN)$/ or return "Illegal recaf: ". $self->recaf;
$self->recaf($1);
$self->recaf =~ /^(IN)$/ or return "Illegal recaf: ". $self->recaf;
$self->recaf($1);
- $self->rectype =~ /^(SOA|NS|MX|A|PTR|CNAME|TXT|_mstr)$/
- or return "Illegal rectype (only SOA NS MX A PTR CNAME TXT recognized): ".
- $self->rectype;
- $self->rectype($1);
+ $self->ttl =~ /^([0-9]{0,6})$/ or return "Illegal ttl: ". $self->ttl;
+ $self->ttl($1);
+
+ my %rectypes = map { $_=>1 } ( @{ $self->rectypes }, '_mstr' );
+ return 'Illegal rectype: '. $self->rectype
+ unless exists $rectypes{$self->rectype} && $rectypes{$self->rectype};
return "Illegal reczone for ". $self->rectype. ": ". $self->reczone
if $self->rectype !~ /^MX$/i && $self->reczone =~ /\*/;
return "Illegal reczone for ". $self->rectype. ": ". $self->reczone
if $self->rectype !~ /^MX$/i && $self->reczone =~ /\*/;
@@
-291,6
+296,10
@@
sub check {
$self->recdata =~ /^((\d{1,3}\.){3}\d{1,3})$/
or return "Illegal data for A record: ". $self->recdata;
$self->recdata($1);
$self->recdata =~ /^((\d{1,3}\.){3}\d{1,3})$/
or return "Illegal data for A record: ". $self->recdata;
$self->recdata($1);
+ } elsif ( $self->rectype eq 'AAAA' ) {
+ $self->recdata =~ /^([\da-z:]+)$/
+ or return "Illegal data for AAAA record: ". $self->recdata;
+ $self->recdata($1);
} elsif ( $self->rectype eq 'PTR' ) {
if ( $conf->exists('zone-underscore') ) {
$self->recdata =~ /^([a-z0-9_\.\-]+)$/i
} elsif ( $self->rectype eq 'PTR' ) {
if ( $conf->exists('zone-underscore') ) {
$self->recdata =~ /^([a-z0-9_\.\-]+)$/i
@@
-312,11
+321,17
@@
sub check {
$self->recdata('"'. $self->recdata. '"'); #?
}
# or return "Illegal data for TXT record: ". $self->recdata;
$self->recdata('"'. $self->recdata. '"'); #?
}
# or return "Illegal data for TXT record: ". $self->recdata;
+ } elsif ( $self->rectype eq 'SRV' ) {
+ $self->recdata =~ /^(\d+)\s+(\d+)\s+(\d+)\s+([a-z0-9\.\-]+)$/i
+ or return "Illegal data for SRV record: ". $self->recdata;
+ $self->recdata("$1 $2 $3 $4");
} elsif ( $self->rectype eq '_mstr' ) {
$self->recdata =~ /^((\d{1,3}\.){3}\d{1,3})$/
or return "Illegal data for _master pseudo-record: ". $self->recdata;
} else {
} elsif ( $self->rectype eq '_mstr' ) {
$self->recdata =~ /^((\d{1,3}\.){3}\d{1,3})$/
or return "Illegal data for _master pseudo-record: ". $self->recdata;
} else {
- die "ack!";
+ warn "$me no specific check for ". $self->rectype. " records yet";
+ $error = $self->ut_text('recdata');
+ return $error if $error;
}
$self->SUPER::check;
}
$self->SUPER::check;
diff --git
a/FS/FS/part_export/domain_sql.pm
b/FS/FS/part_export/domain_sql.pm
index
0ce1b16
..
3010338
100644
(file)
--- a/
FS/FS/part_export/domain_sql.pm
+++ b/
FS/FS/part_export/domain_sql.pm
@@
-99,6
+99,7
@@
sub _export_replace {
my %schema = $self->_schema_map;
my %static = $self->_static_map;
my %schema = $self->_schema_map;
my %static = $self->_static_map;
+ #my %map = (%schema, %static);
my @primary_key = ();
if ( $self->option('primary_key') =~ /,/ ) {
my @primary_key = ();
if ( $self->option('primary_key') =~ /,/ ) {
@@
-107,6
+108,7
@@
sub _export_replace {
push @primary_key, $old->$keymap();
}
} else {
push @primary_key, $old->$keymap();
}
} else {
+ my %map = (%schema, %static);
my $keymap = $map{$self->option('primary_key')};
push @primary_key, $old->$keymap();
}
my $keymap = $map{$self->option('primary_key')};
push @primary_key, $old->$keymap();
}
@@
-135,6
+137,7
@@
sub _export_delete {
my %schema = $self->_schema_map;
my %static = $self->_static_map;
my %schema = $self->_schema_map;
my %static = $self->_static_map;
+ my %map = (%schema, %static);
my %primary_key = ();
if ( $self->option('primary_key') =~ /,/ ) {
my %primary_key = ();
if ( $self->option('primary_key') =~ /,/ ) {
diff --git
a/FS/FS/svc_domain.pm
b/FS/FS/svc_domain.pm
index
7d527e5
..
dde6d3c
100644
(file)
--- a/
FS/FS/svc_domain.pm
+++ b/
FS/FS/svc_domain.pm
@@
-303,9
+303,6
@@
defined. An FS::cust_svc record will be created and inserted.
The additional field I<action> should be set to I<N> for new domains, I<M>
for transfers, or I<I> for no action (registered elsewhere).
The additional field I<action> should be set to I<N> for new domains, I<M>
for transfers, or I<I> for no action (registered elsewhere).
-A registration or transfer email will be submitted unless
-$FS::svc_domain::whois_hack is true.
-
The additional field I<email> can be used to manually set the admin contact
email address on this email. Otherwise, the svc_acct records for this package
(see L<FS::cust_pkg>) are searched. If there is exactly one svc_acct record
The additional field I<email> can be used to manually set the admin contact
email address on this email. Otherwise, the svc_acct records for this package
(see L<FS::cust_pkg>) are searched. If there is exactly one svc_acct record
@@
-565,7
+562,7
@@
sub check {
$recref->{domain} = "$1.$2";
$recref->{suffix} ||= $2;
# hmmmmmmmm.
$recref->{domain} = "$1.$2";
$recref->{suffix} ||= $2;
# hmmmmmmmm.
- } elsif ( $whois_hack && $recref->{domain} =~ /^([\w\-\.]+)\.(\w+)$/ ) {
+ } elsif ( $whois_hack && $recref->{domain} =~ /^([\w\-\.
\/
]+)\.(\w+)$/ ) {
$recref->{domain} = "$1.$2";
# need to match a list of suffixes - no guarantee they're top-level..
# http://wiki.mozilla.org/TLD_List
$recref->{domain} = "$1.$2";
# need to match a list of suffixes - no guarantee they're top-level..
# http://wiki.mozilla.org/TLD_List
@@
-623,6
+620,7
@@
sub domain_record {
'A' => 5,
'TXT' => 6,
'PTR' => 7,
'A' => 5,
'TXT' => 6,
'PTR' => 7,
+ 'SRV' => 8,
);
my %sort = (
);
my %sort = (
diff --git
a/httemplate/view/svc_domain/dns.html
b/httemplate/view/svc_domain/dns.html
index
a73a27e
..
6380db7
100644
(file)
--- a/
httemplate/view/svc_domain/dns.html
+++ b/
httemplate/view/svc_domain/dns.html
@@
-26,6
+26,7
@@
<th CLASS="grid" BGCOLOR="#cccccc">Zone</th>
<th CLASS="grid" BGCOLOR="#cccccc">Type</th>
<th CLASS="grid" BGCOLOR="#cccccc">Data</th>
<th CLASS="grid" BGCOLOR="#cccccc">Zone</th>
<th CLASS="grid" BGCOLOR="#cccccc">Type</th>
<th CLASS="grid" BGCOLOR="#cccccc">Data</th>
+ <th CLASS="grid" BGCOLOR="#cccccc">TTL</th>
</tr>
% foreach my $domain_record ( @records ) {
</tr>
% foreach my $domain_record ( @records ) {
@@
-37,7
+38,9
@@
<tr>
<td CLASS="grid" BGCOLOR="<% $bgcolor %>"><% $domain_record->reczone %></td>
<td CLASS="grid" BGCOLOR="<% $bgcolor %>"><% $type %></td>
<tr>
<td CLASS="grid" BGCOLOR="<% $bgcolor %>"><% $domain_record->reczone %></td>
<td CLASS="grid" BGCOLOR="<% $bgcolor %>"><% $type %></td>
- <td CLASS="grid" BGCOLOR="<% $bgcolor %>"><% $domain_record->recdata %>
+ <td CLASS="grid" BGCOLOR="<% $bgcolor %>"><% $domain_record->recdata %></td>
+ <td CLASS="grid" BGCOLOR="<% $bgcolor %>"><% $domain_record->ttl %></td>
+ <td CLASS="grid" BGCOLOR="<% $bgcolor %>">
% unless ( $domain_record->rectype eq 'SOA'
% || ! $FS::CurrentUser::CurrentUser->access_right('Edit domain nameservice')
% unless ( $domain_record->rectype eq 'SOA'
% || ! $FS::CurrentUser::CurrentUser->access_right('Edit domain nameservice')
@@
-80,6
+83,7
@@
% }
</SELECT>
<INPUT TYPE="text" NAME="recdata">
% }
</SELECT>
<INPUT TYPE="text" NAME="recdata">
+ <INPUT TYPE="text" NAME="ttl" size="6">
<INPUT TYPE="submit" VALUE="Add record">
</FORM>
<INPUT TYPE="submit" VALUE="Add record">
</FORM>