X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=update.cgi;h=1a66b753b7932faa7883fadffebb7164c241cccd;hb=7186c5b0dbf23f02d1564637b55c5f45fbb44193;hp=7dd776b5672a43e6548ea2e51367828a90ba8f15;hpb=632ec5349cd7921ebb17a4693a27d36424e64d74;p=mirror%2Fuserdir-ldap-cgi.git diff --git a/update.cgi b/update.cgi index 7dd776b..1a66b75 100755 --- a/update.cgi +++ b/update.cgi @@ -1,6 +1,6 @@ #!/usr/bin/perl -# $Id: update.cgi,v 1.12 2006/12/22 08:58:50 rmurray Exp $ +# $Id: update.cgi,v 1.13 2006/12/28 02:44:02 rmurray Exp $ # (c) 1999 Randolph Chung. Licensed under the GPL. # (c) 2006 Ryan Murray. Licensed under the GPL. @@ -8,7 +8,10 @@ use lib '.'; use strict vars; #use Apache::Registry; use CGI; +use Data::UUID; +use Digest::HMAC_SHA1 qw(hmac_sha1_hex); use Util; +use English; use URI::Escape; use Net::LDAP qw(:all); @@ -29,6 +32,11 @@ if ($proto eq "http" || !($id && $password)) { my $ldap; +open (F, "<$config{passdir}/key-hmac-$UID") || &Util::HTMLError($!); +my $hmac_key = ; +close(F); +chomp($hmac_key); + sub DieHandler { $ldap->unbind if (defined($ldap)); } @@ -36,6 +44,7 @@ sub DieHandler { $SIG{__DIE__} = \&DieHandler; $ldap = Net::LDAP->new($config{ldaphost}); +&Util::UpgradeConnection($ldap) unless $config{usessl} eq 'False'; my $auth = 0; my $mesg; $mesg = $ldap->bind($editdn, password => $password); @@ -57,7 +66,11 @@ my $entries = $mesg->as_struct; if ($mesg->count != 1) { # complain and quit } - + +$mesg = $ldap->search(base => $config{hostbasedn}, filter => 'host=*'); +$mesg->code && &Util::HTMLError($mesg->error); +my $host_entries = $mesg->as_struct; + my @dns = keys(%$entries); my $entry = $entries->{$dns[0]}; @@ -80,6 +93,18 @@ if (!($query->param('doupdate'))) { $data{staddress} = $entry->{postaladdress}->[0]; $data{staddress} =~ s/\$/\n/; $data{countryname} = &Util::LookupCountry($data{c}); + + if ($data{mailgreylisting} eq "TRUE") { + $data{mailgreylisting} = " checked"; + } else { + $data{mailgreylisting} = ""; + } + + if ($data{mailcallout} eq "TRUE") { + $data{mailcallout} = " checked"; + } else { + $data{mailcallout} = ""; + } $data{email} = join(", ", @{$entry->{emailforward}}); @@ -92,6 +117,39 @@ if (!($query->param('doupdate'))) { . '>male