#!/usr/bin/perl -Tw
-# autodns 0.0.5
-# Copyright 1999-2001 Project Purple. Written by Jonathan McDowell
+# autodns 0.0.6
+# Copyright 1999-2003 Project Purple. Written by Jonathan McDowell
# See ACKNOWLEDGEMENTS file for full details of contributors.
# http://www.earth.li/projectpurple/progs/autodns.html
# Released under the GPL.
+#
+# $Id: autodns.pl,v 1.3 2004/04/08 10:45:44 noodles Exp $
+#
use strict;
use IPC::Open3;
my ($domain, @MAIL, @GPGERROR, @COMMANDS, %zones);
my ($me, $ccreply, $conffile, $domainlistroot, @cfgfiles, $VERSION);
-$VERSION="0.0.5";
+$VERSION="0.0.6";
#
# Local configuration here (until it gets moved to a config file).
# These are: a-z, 0-9, - or .
#
sub valid_domain {
- my $domain = shift;
- $domain = lc $domain;
- if ($domain =~ /^(?:[a-z0-9-]+\.)+[a-z]{2,4}$/) {
- return 1;
- } else {
- return 0;
- }
+ my $domain = shift;
+ $domain = lc $domain;
+ if ($domain =~ /^(?:[a-z0-9-]+\.)+[a-z]{2,4}$/) {
+ return 1;
+ } elsif ($domain =~ /^(?:[0-9\/-]+\.)+in-addr.arpa$/) {
+ return 1;
+ } else {
+ return 0;
+ }
}
#
print REPLY "Adding domain $domain\n";
$zones{$domain}=1;
+ my $df = $domain;
+ $df =~ tr,/,:,;
+
open (DOMAINSFILE, ">>$conffile");
print DOMAINSFILE "
### Domain added for '$user'
zone \"$domain\" {
type slave;
masters { $server; };
- file \"secondary/$user/$domain\";
+ file \"secondary/$user/$df\";
allow-transfer { none; };
allow-query { any; };
};\n";