summaryrefslogtreecommitdiff
path: root/FS
diff options
context:
space:
mode:
Diffstat (limited to 'FS')
-rw-r--r--FS/FS/Conf.pm14
-rw-r--r--FS/FS/svc_domain.pm40
2 files changed, 52 insertions, 2 deletions
diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm
index e8686b575..5dba387fe 100644
--- a/FS/FS/Conf.pm
+++ b/FS/FS/Conf.pm
@@ -450,6 +450,20 @@ httemplate/docs/config.html
},
{
+ 'key' => 'arecords',
+ 'section' => 'BIND',
+ 'description' => 'A list of tab seperated A records to add automatically when creating a domain',
+ 'type' => 'textarea',
+ },
+
+ {
+ 'key' => 'cnamerecords',
+ 'section' => 'BIND',
+ 'description' => 'A list of tab seperated CNAME records to add automatically when creating a domain',
+ 'type' => 'textarea',
+ },
+
+ {
'key' => 'nismachines',
'section' => 'shell',
'description' => 'Your NIS master (not slave master) machines, one per line. This enables export of `/etc/global/passwd\' and `/etc/global/shadow\'.',
diff --git a/FS/FS/svc_domain.pm b/FS/FS/svc_domain.pm
index 84a102911..1e16ba87f 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