--- /dev/null
+--- ./autodns.pl.org 2005-02-12 22:29:00.211821472 +0100
++++ ./autodns.pl 2005-02-12 22:29:08.709529624 +0100
+@@ -17,12 +17,15 @@
+ my ($from, $subject, $gpguser, $gpggood, $usersfile, $lockfile, $priv);
+ my ($user, $server, $inprocess, $delcount, $addcount, $reload_command);
+ my ($domain, @MAIL, @GPGERROR, @COMMANDS, %zones);
+-my ($me, $ccreply, $conffile, $domainlistroot, @cfgfiles, $VERSION);
++my ($me, $ccreply, $conffile, $configfile, $domainlistroot, @cfgfiles, $VERSION);
+
+ $VERSION="0.0.6";
+
++# Location of config file for autodns:
++$configfile="/etc/autodns.conf";
++
+ #
+-# Local configuration here (until it gets moved to a config file).
++# Defaults - these are used if no config is found.
+ #
+ # These are sort of suitable for a Debian setup.
+ #
+@@ -58,6 +61,40 @@
+ ### using BIND). This statement might even be true now - let me know if not.
+ ###
+
++# Read config:
++#
++
++sub getconfig {
++ my ($configfile) = @_;
++
++ open (AUTODNSCONF, "< $configfile") or
++ &fatalerror("Can't open $configfile, using defaults");
++
++ while (<AUTODNSCONF>) {
++ if (/^\$mailfrom="([^"]+)";$/) {
++ $me=$1;
++ } elsif (/^\$ccreply="([^"]+)";$/) {
++ $ccreply=$1;
++ # FIXME:
++ # make possible to use multiline entries:
++ } elsif (/^\@cfgfiles=(.+);$/) {
++ @cfgfiles=$1;
++ } elsif (/^\$conffile="([^"]+)";$/) {
++ $conffile=$1;
++ } elsif (/^\$usersfile="([^"]+)";$/) {
++ $usersfile=$1;
++ } elsif (/^\$domainlistroot="([^"]+)";$/) {
++ $domainlistroot=$1;
++ } elsif (/^\$lockfile="([^"]+)";$/) {
++ $lockfile=$1;
++ } elsif (/^\$reload_command="([^"]+)";$/) {
++ $reload_command=$1;
++ }
++ }
++
++ close AUTODNSCONF;
++}
++
+ #
+ # Try to figure out what zones we currently know about by parsing config
+ # files. Sets the item in %zones to 1 for each zone it finds.
+@@ -167,6 +204,8 @@
+ return ($user, $priviledge, $server);
+ }
+
++getconfig($configfile);
++
+ $delcount=$addcount=$inprocess=0;
+
+ # Read in the mail from stdin.
--- /dev/null
+# Who I should reply as.
+$mailfrom="autodns\@earth.li";
+
+# Who replies should be CCed to.
+$ccreply="noodles\@earth.li";
+
+# Where to look for zones we're already hosting.
+# It has to be one line!! (temporary) -- blues
+#@cfgfiles=("/etc/named.conf", "/etc/bind/named.secondary.conf");
+@cfgfiles=("/etc/named.conf");
+
+# The file we should add/delete domains from.
+$conffile="/etc/named.secondary.conf";
+
+# The file that contains details of the authorized users.
+$usersfile="/etc/autodns/autodns.users";
+
+# Base file name to for list of users domains.
+$domainlistroot="/etc/autodns/domains.";
+
+# The lockfile we use to ensure we have exclusive access to the
+# $domainlistroot$user files and $conffile.
+$lockfile="/var/lib/autodns.lock";
+
+# The command to reload the nameserver domains list.
+$reload_command="sudo ndc reconfig 2>&1";
+