X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2Fsvc_domain.pm;h=e1e4eb8b5a8f5350f3c1252cb376d7dcddef0bb2;hp=57fa47fa800e57bee67c373d5e5c5edad2d7dbf1;hb=b4a403644cb80a612dd028882f971bdd20839275;hpb=8ba31246d8226ff4d71d0ddabcb31d984e7a1548 diff --git a/FS/FS/svc_domain.pm b/FS/FS/svc_domain.pm index 57fa47fa8..e1e4eb8b5 100644 --- a/FS/FS/svc_domain.pm +++ b/FS/FS/svc_domain.pm @@ -3,12 +3,14 @@ package FS::svc_domain; use strict; use vars qw( @ISA $whois_hack $conf $mydomain $smtpmachine $tech_contact $from $to @nameservers @nameserver_ips @template + @mxmachines @nsmachines $soadefaultttl $soaemail $soaexpire $soamachine + $soarefresh $soaretry ); use Carp; use Mail::Internet; use Mail::Header; use Date::Format; -use Net::Whois 1.001; +use Net::Whois 1.0; use FS::Record qw(fields qsearch qsearchs); use FS::Conf; use FS::svc_Common; @@ -16,6 +18,7 @@ use FS::cust_svc; use FS::svc_acct; use FS::cust_pkg; use FS::cust_main; +use FS::domain_record; @ISA = qw( FS::svc_Common ); @@ -43,6 +46,15 @@ $FS::UID::callback{'FS::domain'} = sub { } @ns; @template = map { $_. "\n" } $conf->config("$internic/template"); + @mxmachines = $conf->config('mxmachines'); + @nsmachines = $conf->config('nsmachines'); + $soadefaultttl = $conf->config('soadefaultttl'); + $soaemail = $conf->config('soaemail'); + $soaexpire = $conf->config('soaexpire'); + $soamachine = $conf->config('soamachine'); + $soarefresh = $conf->config('soarefresh'); + $soaretry = $conf->config('soaretry'); + }; =head1 NAME @@ -114,6 +126,19 @@ email address on this email. Otherwise, the svc_acct records for this package (see L) are searched. If there is exactly one svc_acct record in the same package, it is automatically used. Otherwise an error is returned. +If any I configuration file exists, an SOA record is added to +the domain_record table (see ). + +If any machines are defined in the I configuration file, NS +records are added to the domain_record table (see L). + +If any machines are defined in the I configuration file, MX +records are added to the domain_record table (see L). + +Any problems adding FS::domain_record records will emit warnings, but will +not return errors from this method. If your configuration files are correct +you shouln't have any problems. + =cut sub insert { @@ -144,6 +169,47 @@ sub insert { $self->submit_internic unless $whois_hack; + if ( $soamachine ) { + my $soa = new FS::domain_record { + 'svcnum' => $self->svcnum, + 'reczone' => '@', + 'recaf' => 'IN', + 'rectype' => 'SOA', + 'recdata' => "$soamachine $soaemail ( ". time2str("%Y%m%e", time). "00 ". + "$soarefresh $soaretry $soaexpire $soadefaultttl )" + }; + $error = $soa->insert; + warn "WARNING: couldn't insert SOA record for new domain: $error" if $error; + + foreach my $nsmachine ( @nsmachines ) { + my $ns = new FS::domain_record { + 'svcnum' => $self->svcnum, + 'reczone' => '@', + 'recaf' => 'IN', + 'rectype' => 'NS', + 'recdata' => $nsmachine, + }; + my $error = $ns->insert; + warn "WARNING: couldn't insert NS record for new domain: $error" + if $error; + } + + foreach my $mxmachine ( @mxmachines ) { + my $mx = new FS::domain_record { + 'svcnum' => $self->svcnum, + 'reczone' => '@', + 'recaf' => 'IN', + 'rectype' => 'mx', + 'recdata' => $mxmachine, + }; + my $error = $mx->insert; + warn "WARNING: couldn't insert MX record for new domain: $error" + if $error; + } + + } + + ''; #no error } @@ -257,8 +323,8 @@ sub check { =item whois -Returns the Net::Whois object corresponding to this domain, or undef if -the domain is not found in whois. +Returns the Net::Whois::Domain object (see L) for this domain, or +undef if the domain is not found in whois. (If $FS::svc_domain::whois_hack is true, returns that in all cases instead.) @@ -393,7 +459,7 @@ sub submit_internic { =head1 VERSION -$Id: svc_domain.pm,v 1.2 1999-08-11 13:12:11 ivan Exp $ +$Id: svc_domain.pm,v 1.6 2000-03-01 08:13:59 ivan Exp $ =head1 BUGS