summaryrefslogtreecommitdiff
path: root/FS
diff options
context:
space:
mode:
authorivan <ivan>2010-09-11 17:02:59 +0000
committerivan <ivan>2010-09-11 17:02:59 +0000
commitd583a5d3c0647488bac7b7a33d319fd1a85c05b3 (patch)
tree01e1cf840e570ce9e3ee57fe439d8890e407d5f0 /FS
parent0afabbd646c01ed4c88826edc9d290698b220418 (diff)
dns updates from Erik L: add ttl support, add check for SRV and finish allowing additional rectypes, allow forward slashes for RFC2317 classless in-arpa delegation, RT#8933
Diffstat (limited to 'FS')
-rw-r--r--FS/FS/Schema.pm1
-rw-r--r--FS/FS/domain_record.pm27
-rw-r--r--FS/FS/part_export/domain_sql.pm3
-rw-r--r--FS/FS/svc_domain.pm6
4 files changed, 27 insertions, 10 deletions
diff --git a/FS/FS/Schema.pm b/FS/FS/Schema.pm
index cc6438ab6..459dcabd6 100644
--- 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, '', '',
+ 'ttl', 'int', 'NULL', '', '', '',
],
'primary_key' => 'recnum',
'unique' => [],
diff --git a/FS/FS/domain_record.pm b/FS/FS/domain_record.pm
index e7e9f70b7..9f1eb5318 100644
--- a/FS/FS/domain_record.pm
+++ b/FS/FS/domain_record.pm
@@ -1,7 +1,7 @@
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 );
@@ -11,6 +11,7 @@ use FS::svc_www;
@ISA = qw(FS::Record);
$DEBUG = 0;
+$me = '[FS::domain_record]';
=head1 NAME
@@ -51,6 +52,8 @@ supported:
=item recdata - data for this entry
+=item ttl - time to live
+
=back
=head1 METHODS
@@ -265,10 +268,12 @@ sub check {
$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 =~ /\*/;
@@ -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);
+ } 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
@@ -312,11 +321,17 @@ sub check {
$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 {
- die "ack!";
+ warn "$me no specific check for ". $self->rectype. " records yet";
+ $error = $self->ut_text('recdata');
+ return $error if $error;
}
$self->SUPER::check;
diff --git a/FS/FS/part_export/domain_sql.pm b/FS/FS/part_export/domain_sql.pm
index 0ce1b16e3..30103385b 100644
--- 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 %map = (%schema, %static);
my @primary_key = ();
if ( $self->option('primary_key') =~ /,/ ) {
@@ -107,6 +108,7 @@ sub _export_replace {
push @primary_key, $old->$keymap();
}
} else {
+ my %map = (%schema, %static);
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 %map = (%schema, %static);
my %primary_key = ();
if ( $self->option('primary_key') =~ /,/ ) {
diff --git a/FS/FS/svc_domain.pm b/FS/FS/svc_domain.pm
index 7d527e5be..dde6d3c2c 100644
--- 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).
-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
@@ -565,7 +562,7 @@ sub check {
$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
@@ -623,6 +620,7 @@ sub domain_record {
'A' => 5,
'TXT' => 6,
'PTR' => 7,
+ 'SRV' => 8,
);
my %sort = (