version 1.78, 2002/05/03 03:21:25
|
version 1.82, 2002/06/18 19:39:13
|
Line 53
|
Line 53
|
# 02/12 Gerd Kortemeyer |
# 02/12 Gerd Kortemeyer |
# 02/19 Matthew Hall |
# 02/19 Matthew Hall |
# 02/25 Gerd Kortemeyer |
# 02/25 Gerd Kortemeyer |
|
# 05/11 Scott Harrison |
### |
### |
|
|
# based on "Perl Cookbook" ISBN 1-56592-243-3 |
# based on "Perl Cookbook" ISBN 1-56592-243-3 |
Line 61
|
Line 62
|
# HUPs |
# HUPs |
# uses IDEA encryption |
# uses IDEA encryption |
|
|
|
use lib '/home/httpd/lib/perl/'; |
|
use LONCAPA::Configuration; |
|
|
use IO::Socket; |
use IO::Socket; |
use IO::File; |
use IO::File; |
use Apache::File; |
use Apache::File; |
Line 101 sub timeout {
|
Line 105 sub timeout {
|
$SIG{'QUIT'}=\&catchexception; |
$SIG{'QUIT'}=\&catchexception; |
$SIG{__DIE__}=\&catchexception; |
$SIG{__DIE__}=\&catchexception; |
|
|
# ------------------------------------ Read httpd access.conf and get variables |
# ---------------------------------- Read loncapa_apache.conf and loncapa.conf |
|
&status("Read loncapa_apache.conf and loncapa.conf"); |
open (CONFIG,"/etc/httpd/conf/access.conf") || die "Can't read access.conf"; |
my $perlvarref=LONCAPA::Configuration::read_conf('loncapa_apache.conf', |
|
'loncapa.conf'); |
while ($configline=<CONFIG>) { |
my %perlvar=%{$perlvarref}; |
if ($configline =~ /PerlSetVar/) { |
undef $perlvarref; |
my ($dummy,$varname,$varvalue)=split(/\s+/,$configline); |
|
chomp($varvalue); |
|
$perlvar{$varname}=$varvalue; |
|
} |
|
} |
|
close(CONFIG); |
|
|
|
# ----------------------------- Make sure this process is running from user=www |
# ----------------------------- Make sure this process is running from user=www |
my $wwwid=getpwnam('www'); |
my $wwwid=getpwnam('www'); |
Line 549 sub make_new_child {
|
Line 547 sub make_new_child {
|
# ------------------------------------------------------------ Process requests |
# ------------------------------------------------------------ Process requests |
while (my $userinput=<$client>) { |
while (my $userinput=<$client>) { |
chomp($userinput); |
chomp($userinput); |
|
Debug("Request = $userinput\n"); |
&status('Processing '.$hostid{$clientip}.': '.$userinput); |
&status('Processing '.$hostid{$clientip}.': '.$userinput); |
my $wasenc=0; |
my $wasenc=0; |
alarm(120); |
alarm(120); |
Line 604 sub make_new_child {
|
Line 603 sub make_new_child {
|
} elsif ($userinput =~ /^currentauth/) { |
} elsif ($userinput =~ /^currentauth/) { |
if ($wasenc==1) { |
if ($wasenc==1) { |
my ($cmd,$udom,$uname)=split(/:/,$userinput); |
my ($cmd,$udom,$uname)=split(/:/,$userinput); |
my $result = GetAuthType($udom, $user); |
my $result = GetAuthType($udom, $uname); |
if($result eq "nouser") { |
if($result eq "nouser") { |
print $client "unknown_user\n"; |
print $client "unknown_user\n"; |
} |
} |
Line 1293 sub make_new_child {
|
Line 1292 sub make_new_child {
|
# ------------------------------------------------------------------- querysend |
# ------------------------------------------------------------------- querysend |
} elsif ($userinput =~ /^querysend/) { |
} elsif ($userinput =~ /^querysend/) { |
my ($cmd,$query, |
my ($cmd,$query, |
$custom,$customshow)=split(/:/,$userinput); |
$arg1,$arg2,$arg3)=split(/\:/,$userinput); |
$query=~s/\n*$//g; |
$query=~s/\n*$//g; |
unless ($custom or $customshow) { |
print $client "". |
print $client "". |
|
sqlreply("$hostid{$clientip}\&$query")."\n"; |
|
} |
|
else { |
|
print $client "". |
|
sqlreply("$hostid{$clientip}\&$query". |
sqlreply("$hostid{$clientip}\&$query". |
"\&$custom"."\&$customshow")."\n"; |
"\&$arg1"."\&$arg2"."\&$arg3")."\n"; |
} |
|
# ------------------------------------------------------------------ queryreply |
# ------------------------------------------------------------------ queryreply |
} elsif ($userinput =~ /^queryreply/) { |
} elsif ($userinput =~ /^queryreply/) { |
my ($cmd,$id,$reply)=split(/:/,$userinput); |
my ($cmd,$id,$reply)=split(/:/,$userinput); |
Line 1500 sub GetAuthType
|
Line 1493 sub GetAuthType
|
my $domain = shift; |
my $domain = shift; |
my $user = shift; |
my $user = shift; |
|
|
|
Debug("GetAuthType( $domain, $user ) \n"); |
my $proname = &propath($domain, $user); |
my $proname = &propath($domain, $user); |
my $passwdfile = "$proname/passwd"; |
my $passwdfile = "$proname/passwd"; |
if( -e $passwdfile ) { |
if( -e $passwdfile ) { |
my $pf = IO::File->new($passwdfile); |
my $pf = IO::File->new($passwdfile); |
my $realpassword = <$pf>; |
my $realpassword = <$pf>; |
chomp($realpassword); |
chomp($realpassword); |
|
Debug("Password info = $realpassword\n"); |
my ($authtype, $contentpwd) = split(/:/, $realpassword); |
my ($authtype, $contentpwd) = split(/:/, $realpassword); |
|
Debug("Authtype = $authtype, content = $contentpwd\n"); |
my $availinfo = ''; |
my $availinfo = ''; |
if($authtype eq 'krb4') { |
if($authtype eq 'krb4') { |
$availinfo = $contentpwd; |
$availinfo = $contentpwd; |
} |
} |
|
|
return "$authtype:$availinfo"; |
return "$authtype:$availinfo"; |
} |
} |
else { |
else { |
|
Debug("Returning nouser"); |
return "nouser"; |
return "nouser"; |
} |
} |
|
|