Fixed PAM login buglet
authorJamie Cameron <jcameron@webmin.com>
Sat, 28 Apr 2007 04:43:10 +0000 (04:43 +0000)
committerJamie Cameron <jcameron@webmin.com>
Sat, 28 Apr 2007 04:43:10 +0000 (04:43 +0000)
miniserv.pl
pam_login.cgi

index 185f925..e6112a6 100755 (executable)
@@ -927,6 +927,8 @@ $ok_code = 200;
 $ok_message = "Document follows";
 $logged_code = undef;
 $reqline = $request_uri = $page = undef;
+$authuser = undef;
+$validated = undef;
 
 # check address against access list
 if (@deny && &ip_match($acptip, $localip, @deny) ||
@@ -1857,6 +1859,8 @@ if (&get_type($full) eq "internal/cgi") {
                                        $baseauthuser : undef;
        $ENV{"REMOTE_PASS"} = $authpass if (defined($authpass) &&
                                            $config{'pass_password'});
+       print DEBUG "REMOTE_USER = ",$ENV{"REMOTE_USER"},"\n";
+       print DEBUG "BASE_REMOTE_USER = ",$ENV{"BASE_REMOTE_USER"},"\n";
        $ENV{"SSL_USER"} = $peername if ($validated == 2);
        $ENV{"ANONYMOUS_USER"} = "1" if ($validated == 3);
        $ENV{"DOCUMENT_ROOT"} = $roots[0];
@@ -3941,12 +3945,12 @@ return $logout_time_cache{$user,$sid};
 
 sub unix_crypt
 {
-local ($user, $pass) = @_;
+local ($pass, $salt) = @_;
 if ($use_perl_crypt) {
-       return Crypt::UnixCrypt::crypt($user, $pass);
+       return Crypt::UnixCrypt::crypt($pass, $salt);
        }
 else {
-       return crypt($user, $pass);
+       return crypt($pass, $salt);
        }
 }
 
index ff99341..4dd79fa 100755 (executable)
@@ -4,6 +4,7 @@
 $pragma_no_cache = 1;
 #$ENV{'MINISERV_INTERNAL'} || die "Can only be called by miniserv.pl";
 require './web-lib.pl';
+require './ui-lib.pl';
 &init_config();
 &ReadParse();
 if ($gconfig{'loginbanner'} && $ENV{'HTTP_COOKIE'} !~ /banner=1/ &&
@@ -24,9 +25,8 @@ $sec = uc($ENV{'HTTPS'}) eq 'ON' ? "; secure" : "";
 &get_miniserv_config(\%miniserv);
 print "Set-Cookie: banner=0; path=/$sec\r\n" if ($gconfig{'loginbanner'});
 print "Set-Cookie: testing=1; path=/$sec\r\n";
-&header(undef, undef, undef, undef, 1, 1, undef, undef,
-       "document.forms[0].answer.focus()'");
-print "<hr>\n";
+&ui_print_unbuffered_header(undef, undef, undef, undef, undef, 1, 1, undef,
+                           undef, "onLoad='document.forms[0].answer.focus()'");
 
 print "<center>\n";
 if (defined($in{'failed'})) {
@@ -82,7 +82,6 @@ print "<br>\n";
 
 print "</td> </tr>\n";
 print "</table></td></tr></table><p>\n";
-print "<hr>\n";
 print "</form></center>\n";
 print "$text{'pam_postfix'}\n";
 
@@ -97,5 +96,5 @@ if (window != window.top) {
 EOF
        }
 
-&footer();
+&ui_print_footer();