#!/usr/local/bin/perl # Ask one PAM question $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/ && $in{'initial'}) { # Show pre-login HTML page print "Set-Cookie: banner=1; path=/\r\n"; &PrintHeader(); $url = $in{'page'}; open(BANNER, $gconfig{'loginbanner'}); while() { s/LOGINURL/$url/g; print; } close(BANNER); return; } $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"; &ui_print_unbuffered_header(undef, undef, undef, undef, undef, 1, 1, undef, undef, "onLoad='document.forms[0].answer.focus()'"); print "
\n"; if (defined($in{'failed'})) { print "

$text{'session_failed'}

\n"; } elsif ($in{'logout'}) { print "

$text{'session_logout'}

\n"; } elsif ($in{'timed_out'}) { print "

",&text('session_timed_out', int($in{'timed_out'}/60)),"

\n"; } print "$text{'pam_prefix'}\n"; print "

\n"; print "\n"; print "\n"; print "\n"; print "
$text{'pam_header'}
\n"; if ($gconfig{'realname'}) { $host = &get_system_hostname(); } else { $host = $ENV{'HTTP_HOST'}; $host =~ s/:\d+//g; $host = &html_escape($host); } if ($in{'message'}) { # Showing a message print "\n"; print "\n"; } else { # Asking a question print "\n"; $pass = "type=password" if ($in{'password'}); print "\n"; print "\n"; } print "\n"; print "
", $in{'message'},"
", &text($gconfig{'nohostname'} ? 'pam_mesg2' : 'pam_mesg', "$host"),"
$in{'question'}
\n"; print "\n"; print "\n"; if (!$in{'initial'}) { print "\n"; } print "
\n"; print "

\n"; print "

\n"; print "$text{'pam_postfix'}\n"; # Output frame-detection Javascript, if theme uses frames if ($tconfig{'inframe'}) { print < if (window != window.top) { window.top.location = window.location; } EOF } &ui_print_footer();