X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=login.cgi;h=6a3254716b02732d341e3c0d8fcbe2f8a8085163;hb=43878ea9452342f57b453ae2098100de2089517d;hp=60358a686228270d4abdfa181cfce1576447c25f;hpb=b62107bcdbc4fb5311f981999d838de38243e46f;p=mirror%2Fuserdir-ldap-cgi.git diff --git a/login.cgi b/login.cgi index 60358a6..6a32547 100755 --- a/login.cgi +++ b/login.cgi @@ -1,7 +1,8 @@ #!/usr/bin/perl -# $Id: login.cgi,v 1.6 2000/05/06 06:10:05 tausq 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; @@ -17,8 +18,8 @@ my %config = &Util::ReadConfigFile; my $query = new CGI; my $proto = ($ENV{HTTPS} ? "https" : "http"); -if (!($query->param('username')) || !($query->param('password'))) { - print "Location: $proto://$ENV{SERVER_NAME}/$config{webloginurl}\n\n"; +if ($proto eq "http" || !($query->param('username')) || !($query->param('password'))) { + print "Location: https://$ENV{SERVER_NAME}/$config{webloginhtml}\n\n"; exit; } @@ -46,7 +47,7 @@ if ($mesg->code == LDAP_SUCCESS) { my $oldpassword = $entries->{$dn}->{userpassword}->[0]; if ($oldpassword !~ /^{crypt}\$1\$/) { # Update their password to md5 - open (LOG, ">$config{weblogfile}"); + open (LOG, ">>$config{weblogfile}"); print LOG scalar(localtime); print LOG ": Updating MD5 password for $dn\n"; close LOG; @@ -68,7 +69,7 @@ if ($mesg->code == LDAP_SUCCESS) { $ldap->unbind; } else { - print "Content-type: text/html\n\n"; + print "Content-type: text/html; charset=utf-8\n\n"; print "

Not authenticated

\n"; }