--- loncom/lond 2002/05/03 03:21:25 1.78 +++ loncom/lond 2002/05/17 14:03:04 1.81 @@ -2,7 +2,7 @@ # The LearningOnline Network # lond "LON Daemon" Server (port "LOND" 5663) # -# $Id: lond,v 1.78 2002/05/03 03:21:25 foxr Exp $ +# $Id: lond,v 1.81 2002/05/17 14:03:04 matthew Exp $ # # Copyright Michigan State University Board of Trustees # @@ -53,6 +53,7 @@ # 02/12 Gerd Kortemeyer # 02/19 Matthew Hall # 02/25 Gerd Kortemeyer +# 05/11 Scott Harrison ### # based on "Perl Cookbook" ISBN 1-56592-243-3 @@ -61,6 +62,9 @@ # HUPs # uses IDEA encryption +use lib '/home/httpd/lib/perl/'; +use LONCAPA::Configuration; + use IO::Socket; use IO::File; use Apache::File; @@ -101,18 +105,12 @@ sub timeout { $SIG{'QUIT'}=\&catchexception; $SIG{__DIE__}=\&catchexception; -# ------------------------------------ Read httpd access.conf and get variables - -open (CONFIG,"/etc/httpd/conf/access.conf") || die "Can't read access.conf"; - -while ($configline=) { - if ($configline =~ /PerlSetVar/) { - my ($dummy,$varname,$varvalue)=split(/\s+/,$configline); - chomp($varvalue); - $perlvar{$varname}=$varvalue; - } -} -close(CONFIG); +# ---------------------------------- Read loncapa_apache.conf and loncapa.conf +&status("Read loncapa_apache.conf and loncapa.conf"); +my $perlvarref=LONCAPA::Configuration::read_conf('loncapa_apache.conf', + 'loncapa.conf'); +my %perlvar=%{$perlvarref}; +undef $perlvarref; # ----------------------------- Make sure this process is running from user=www my $wwwid=getpwnam('www'); @@ -549,6 +547,7 @@ sub make_new_child { # ------------------------------------------------------------ Process requests while (my $userinput=<$client>) { chomp($userinput); + Debug("Request = $userinput\n"); &status('Processing '.$hostid{$clientip}.': '.$userinput); my $wasenc=0; alarm(120); @@ -604,7 +603,7 @@ sub make_new_child { } elsif ($userinput =~ /^currentauth/) { if ($wasenc==1) { my ($cmd,$udom,$uname)=split(/:/,$userinput); - my $result = GetAuthType($udom, $user); + my $result = GetAuthType($udom, $uname); if($result eq "nouser") { print $client "unknown_user\n"; } @@ -1500,20 +1499,25 @@ sub GetAuthType my $domain = shift; my $user = shift; + Debug("GetAuthType( $domain, $user ) \n"); my $proname = &propath($domain, $user); my $passwdfile = "$proname/passwd"; if( -e $passwdfile ) { my $pf = IO::File->new($passwdfile); my $realpassword = <$pf>; chomp($realpassword); + Debug("Password info = $realpassword\n"); my ($authtype, $contentpwd) = split(/:/, $realpassword); + Debug("Authtype = $authtype, content = $contentpwd\n"); my $availinfo = ''; if($authtype eq 'krb4') { $availinfo = $contentpwd; } + return "$authtype:$availinfo"; } else { + Debug("Returning nouser"); return "nouser"; }