]>
Commit | Line | Data |
---|---|---|
9408dcf9 PG |
1 | --- ./autodns.pl.org 2005-02-12 22:29:00.211821472 +0100 |
2 | +++ ./autodns.pl 2005-02-12 22:29:08.709529624 +0100 | |
3 | @@ -17,12 +17,15 @@ | |
4 | my ($from, $subject, $gpguser, $gpggood, $usersfile, $lockfile, $priv); | |
5 | my ($user, $server, $inprocess, $delcount, $addcount, $reload_command); | |
6 | my ($domain, @MAIL, @GPGERROR, @COMMANDS, %zones); | |
7 | -my ($me, $ccreply, $conffile, $domainlistroot, @cfgfiles, $VERSION); | |
8 | +my ($me, $ccreply, $conffile, $configfile, $domainlistroot, @cfgfiles, $VERSION); | |
9 | ||
10 | $VERSION="0.0.6"; | |
11 | ||
12 | +# Location of config file for autodns: | |
13 | +$configfile="/etc/autodns.conf"; | |
14 | + | |
15 | # | |
16 | -# Local configuration here (until it gets moved to a config file). | |
17 | +# Defaults - these are used if no config is found. | |
18 | # | |
19 | # These are sort of suitable for a Debian setup. | |
20 | # | |
21 | @@ -58,6 +61,40 @@ | |
22 | ### using BIND). This statement might even be true now - let me know if not. | |
23 | ### | |
24 | ||
25 | +# Read config: | |
26 | +# | |
27 | + | |
28 | +sub getconfig { | |
29 | + my ($configfile) = @_; | |
30 | + | |
31 | + open (AUTODNSCONF, "< $configfile") or | |
32 | + &fatalerror("Can't open $configfile, using defaults"); | |
33 | + | |
34 | + while (<AUTODNSCONF>) { | |
35 | + if (/^\$mailfrom="([^"]+)";$/) { | |
36 | + $me=$1; | |
37 | + } elsif (/^\$ccreply="([^"]+)";$/) { | |
38 | + $ccreply=$1; | |
39 | + # FIXME: | |
40 | + # make possible to use multiline entries: | |
41 | + } elsif (/^\@cfgfiles=(.+);$/) { | |
42 | + @cfgfiles=$1; | |
43 | + } elsif (/^\$conffile="([^"]+)";$/) { | |
44 | + $conffile=$1; | |
45 | + } elsif (/^\$usersfile="([^"]+)";$/) { | |
46 | + $usersfile=$1; | |
47 | + } elsif (/^\$domainlistroot="([^"]+)";$/) { | |
48 | + $domainlistroot=$1; | |
49 | + } elsif (/^\$lockfile="([^"]+)";$/) { | |
50 | + $lockfile=$1; | |
51 | + } elsif (/^\$reload_command="([^"]+)";$/) { | |
52 | + $reload_command=$1; | |
53 | + } | |
54 | + } | |
55 | + | |
56 | + close AUTODNSCONF; | |
57 | +} | |
58 | + | |
59 | # | |
60 | # Try to figure out what zones we currently know about by parsing config | |
61 | # files. Sets the item in %zones to 1 for each zone it finds. | |
62 | @@ -167,6 +204,8 @@ | |
63 | return ($user, $priviledge, $server); | |
64 | } | |
65 | ||
66 | +getconfig($configfile); | |
67 | + | |
68 | $delcount=$addcount=$inprocess=0; | |
69 | ||
70 | # Read in the mail from stdin. |