summaryrefslogtreecommitdiff
path: root/FS/FS/svc_domain.pm
diff options
context:
space:
mode:
authorkhoff <khoff>2002-03-09 10:19:38 +0000
committerkhoff <khoff>2002-03-09 10:19:38 +0000
commit56ef0a8a658b8449d1125fe017b21e0c636a8b0c (patch)
treed5aa8de463b64344e35031b77a1ebc277467542a /FS/FS/svc_domain.pm
parent3e2e5fecb9ef3cf39a6ac098aacb76763edd3938 (diff)
Support for default CNAME/A records
Diffstat (limited to 'FS/FS/svc_domain.pm')
-rw-r--r--FS/FS/svc_domain.pm40
1 files changed, 38 insertions, 2 deletions
diff --git a/FS/FS/svc_domain.pm b/FS/FS/svc_domain.pm
index 84a1029..1e16ba8 100644
--- a/FS/FS/svc_domain.pm
+++ b/FS/FS/svc_domain.pm
@@ -3,7 +3,7 @@ package FS::svc_domain;
use strict;
use vars qw( @ISA $whois_hack $conf $smtpmachine
@mxmachines @nsmachines $soadefaultttl $soaemail $soaexpire $soamachine
- $soarefresh $soaretry $qshellmachine $nossh_hack
+ $soarefresh $soaretry $qshellmachine $nossh_hack %arecords %cnamerecords
);
use Carp;
use Mail::Internet;
@@ -29,6 +29,8 @@ $FS::UID::callback{'FS::domain'} = sub {
$smtpmachine = $conf->config('smtpmachine');
+ %arecords = map { split /\t/ } $conf->config('arecords');
+ %cnamerecords = map { split /\t/ } $conf->config('cnamerecords');
@mxmachines = $conf->config('mxmachines');
@nsmachines = $conf->config('nsmachines');
$soadefaultttl = $conf->config('soadefaultttl');
@@ -123,6 +125,10 @@ records are added to the domain_record table (see L<FS::domain_record>).
If any machines are defined in the I<mxmachines> configuration file, MX
records are added to the domain_record table (see L<FS::domain_record>).
+If the I<arecords> configuration file exits, A records are added to the
+domain_record table. The I<cnamerecords> file does the same thing for
+CNAME records.
+
If a machine is defined in the I<shellmachine> configuration value, the
I<qmailmachines> configuration file exists, and the I<catchall> field points
to an an account with a home directory (see L<FS::svc_acct>), the command:
@@ -224,6 +230,36 @@ sub insert {
}
}
+ foreach my $arecord ( keys %arecords ) {
+ my $arec = new FS::domain_record {
+ 'svcnum' => $self->svcnum,
+ 'reczone' => $arecord,
+ 'recaf' => 'IN',
+ 'rectype' => 'A',
+ 'recdata' => $arecords{$arecord},
+ };
+ my $error = $arec->insert;
+ if ( $error ) {
+ $dbh->rollback if $oldAutoCommit;
+ return "WARNING: couldn't insert A record for new domain: $error";
+ }
+ }
+
+ foreach my $cnamerecord ( keys %cnamerecords ) {
+ my $cnamerec = new FS::domain_record {
+ 'svcnum' => $self->svcnum,
+ 'reczone' => $cnamerecord,
+ 'recaf' => 'IN',
+ 'rectype' => 'CNAME',
+ 'recdata' => $cnamerecords{$cnamerecord},
+ };
+ my $error = $cnamerec->insert;
+ if ( $error ) {
+ $dbh->rollback if $oldAutoCommit;
+ return "WARNING: couldn't insert CNAME record for new domain: $error";
+ }
+ }
+
}
$dbh->commit or die $dbh->errstr if $oldAutoCommit;
@@ -424,7 +460,7 @@ sub submit_internic {
=head1 VERSION
-$Id: svc_domain.pm,v 1.24 2002-02-20 01:03:09 ivan Exp $
+$Id: svc_domain.pm,v 1.25 2002-03-09 10:19:38 khoff Exp $
=head1 BUGS