X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=login.cgi;h=d820af29e989c55680e7028331e0c54479bc9fdf;hb=03a2094f69b5b8d37b6d8d3734c46788a76292f2;hp=1e04ef48e5f513befb9e5c10f1b5c6e407dfbb05;hpb=e8250d78d091445fbd422fed5d3ae9ab2516eada;p=mirror%2Fuserdir-ldap-cgi.git diff --git a/login.cgi b/login.cgi index 1e04ef4..d820af2 100755 --- a/login.cgi +++ b/login.cgi @@ -1,7 +1,8 @@ #!/usr/bin/perl -# $Id: login.cgi,v 1.9 2006/06/27 04:37:45 rmurray Exp $ +# $Id: login.cgi,v 1.10 2006/12/22 08:58:50 rmurray Exp $ # (c) 1999 Randolph Chung. Licensed under the GPL. +# (c) 2006 Ryan Murray. Licensed under the GPL. use lib '.'; use strict; @@ -10,7 +11,7 @@ use CGI; use Util; use URI::Escape; use Crypt::Blowfish; -use Net::LDAP qw(:all); +use Net::LDAP qw(LDAP_SUCCESS LDAP_PROTOCOL_ERROR); my %config = &Util::ReadConfigFile; @@ -18,7 +19,7 @@ my $query = new CGI; my $proto = ($ENV{HTTPS} ? "https" : "http"); if ($proto eq "http" || !($query->param('username')) || !($query->param('password'))) { - print "Location: https://$ENV{SERVER_NAME}/$config{webloginurl}\n\n"; + print "Location: https://$ENV{SERVER_NAME}/$config{webloginhtml}\n\n"; exit; } @@ -27,6 +28,7 @@ my $hrkey = unpack("H".($config{blowfishkeylen}*2), $key); my $cipher = new Crypt::Blowfish $key; my $ldap = Net::LDAP->new($config{ldaphost}) || &Util::HTMLError($!); +&Util::UpgradeConnection($ldap) unless $config{usessl} eq 'False'; my $username = $query->param('username'); my $password = $query->param('password');