X-Git-Url: https://the.earth.li/gitweb/?a=blobdiff_plain;f=autodns.pl;h=6f14bd35efe3ba46266b45135e4996ac164ae9af;hb=c233fb649154c99c88fbba671aa8d1d5e98c07a4;hp=f84300fee11d88d4155bdb9417a72bf5fdf1352a;hpb=88e5b43bbafc83d80e3e2d17d856c84deb922593;p=autodns.git diff --git a/autodns.pl b/autodns.pl index f84300f..6f14bd3 100755 --- a/autodns.pl +++ b/autodns.pl @@ -5,7 +5,7 @@ # http://www.earth.li/projectpurple/progs/autodns.html # Released under the GPL. # -# $Id: autodns.pl,v 1.8 2005/04/08 13:51:13 noodles Exp $ +# $Id: autodns.pl,v 1.11 2005/05/16 17:26:47 noodles Exp $ # use strict; @@ -16,10 +16,12 @@ use MIME::Parser; $ENV{'PATH'}="/usr/local/bin:/usr/bin:/bin:/usr/sbin"; -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 ($from, $subject, $gpguser, $gpggood, $priv); +my ($user, $server, $inprocess, $delcount, $addcount); +my ($domain, @MAIL, @GPGERROR, @COMMANDS, %zones, $VERSION); + +use vars qw($me $ccreply $conffile $domainlistroot @cfgfiles $usersfile + $lockfile $reload_command); $VERSION="0.0.8"; @@ -230,7 +232,8 @@ if ($entity->parts) { } if ($got_sig && $got_text) { - open3(\*GPGIN, \*GPGOUT, \*GPGERR, "gpg --batch --verify ". + my $pid = open3(\*GPGIN, \*GPGOUT, \*GPGERR, + "gpg --batch --verify ". $sig_name." ".$text_name); close GPGIN; @@ -239,6 +242,7 @@ if ($entity->parts) { my @GPGOUTPUT=; close GPGERR; close GPGOUT; + waitpid $pid, 0; unlink($text_name); unlink($sig_name); @@ -246,7 +250,7 @@ if ($entity->parts) { } else { # Clear text. - open3(\*GPGIN, \*GPGOUT, \*GPGERR, "gpg --batch"); + my $pid = open3(\*GPGIN, \*GPGOUT, \*GPGERR, "gpg --batch"); # Feed it the mail. print GPGIN @MAIL; @@ -257,6 +261,7 @@ if ($entity->parts) { @COMMANDS=; close GPGERR; close GPGOUT; + waitpid $pid, 0; } # Check who it's from and if the signature was a good one. @@ -453,6 +458,17 @@ zone \"$domain\" { } else { print REPLY "Couldn't open $domainlistroot$user: $!\n"; } + } elsif ($inprocess && /^MASTER\s(.*)$/) { + if (($priv & 1) != 1) { + print REPLY "You're not authorised to use the MASTER ", + "command.\n"; + } elsif ($1 =~ /^(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})$/) { + $server = $1; + print REPLY "Set master IP address to $1\n"; + } else { + print REPLY "$1 doesn't look like a valid IPv4 ", + "address to me.\n"; + } } elsif ($inprocess && /^HELP$/) { print REPLY "In order to use the service, you will need to send GPG signed\n"; print REPLY "messages.\n\n";