--- loncom/lond 2001/03/27 13:35:35 1.44
+++ loncom/lond 2001/08/30 20:02:28 1.51
@@ -14,6 +14,8 @@
# 02/12 Gerd Kortemeyer
# 03/15 Scott Harrison
# 03/24 Gerd Kortemeyer
+# 04/02 Scott Harrison
+# 05/11,05/28,08/30 Gerd Kortemeyer
#
# based on "Perl Cookbook" ISBN 1-56592-243-3
# preforker - server who forks first
@@ -30,6 +32,8 @@ use Crypt::IDEA;
use LWP::UserAgent();
use GDBM_File;
use Authen::Krb4;
+use lib '/home/httpd/lib/perl/';
+use localauth;
# grabs exception and records it to log before exiting
sub catchexception {
@@ -362,7 +366,8 @@ sub make_new_child {
my $clientip=inet_ntoa($iaddr);
my $clientrec=($hostid{$clientip} ne undef);
&logthis(
-"INFO: Connect from $clientip ($hostid{$clientip})");
+"INFO: Connection $i, $clientip ($hostid{$clientip})"
+ );
my $clientok;
if ($clientrec) {
my $remotereq=<$client>;
@@ -473,7 +478,10 @@ sub make_new_child {
Authen::Krb4::get_pw_in_tkt($uname,"",
$contentpwd,'krbtgt',$contentpwd,1,
$upass) == 0);
- }
+ } elsif ($howpwd eq 'localauth') {
+ $pwdcorrect=&localauth::localauth($uname,$upass,
+ $contentpwd);
+ }
if ($pwdcorrect) {
print $client "authorized\n";
} else {
@@ -560,8 +568,14 @@ sub make_new_child {
{
my $pf = IO::File->new(">$passfilename");
print $pf "internal:$ncpass\n";
- }
+ }
print $client "ok\n";
+ } elsif ($umode eq 'localauth') {
+ {
+ my $pf = IO::File->new(">$passfilename");
+ print $pf "localauth:$npass\n";
+ }
+ print $client "ok\n";
} elsif ($umode eq 'none') {
{
my $pf = IO::File->new(">$passfilename");
@@ -707,7 +721,7 @@ sub make_new_child {
chomp($what);
my $proname=propath($udom,$uname);
my $now=time;
- {
+ unless ($namespace=~/^nohist\_/) {
my $hfh;
if (
$hfh=IO::File->new(">>$proname/$namespace.hist")
@@ -832,7 +846,7 @@ sub make_new_child {
chomp($what);
my $proname=propath($udom,$uname);
my $now=time;
- {
+ unless ($namespace=~/^nohist\_/) {
my $hfh;
if (
$hfh=IO::File->new(">>$proname/$namespace.hist")
@@ -903,7 +917,7 @@ sub make_new_child {
chomp($what);
my $proname=propath($udom,$uname);
my $now=time;
- {
+ unless ($namespace=~/^nohist\_/) {
my $hfh;
if (
$hfh=IO::File->new(">>$proname/$namespace.hist")
@@ -972,7 +986,7 @@ sub make_new_child {
my ($cmd,$query,
$custom,$customshow)=split(/:/,$userinput);
$query=~s/\n*$//g;
- unless ($custom || $customshow) {
+ unless ($custom or $customshow) {
print $client "".
sqlreply("$hostid{$clientip}\&$query")."\n";
}
@@ -990,6 +1004,9 @@ sub make_new_child {
$reply=~s/\&/\n/g;
print $store $reply;
close $store;
+ my $store2=IO::File->new(">$execdir/tmp/$id.end");
+ print $store2 "done\n";
+ close $store2;
print $client "ok\n";
}
else {
@@ -1085,7 +1102,7 @@ sub make_new_child {
if (-e $ulsdir) {
if (opendir(LSDIR,$ulsdir)) {
while ($ulsfn=readdir(LSDIR)) {
- my @ulsstats=stat($ulsfn);
+ my @ulsstats=stat($ulsdir.'/'.$ulsfn);
$ulsout.=$ulsfn.'&'.join('&',@ulsstats).':';
}
closedir(LSDIR);
@@ -1095,6 +1112,13 @@ sub make_new_child {
}
if ($ulsout eq '') { $ulsout='empty'; }
print $client "$ulsout\n";
+# ------------------------------------------------------------------ Hanging up
+ } elsif (($userinput =~ /^exit/) ||
+ ($userinput =~ /^init/)) {
+ &logthis(
+ "Client $clientip ($hostid{$clientip}) hanging up: $userinput");
+ print $client "bye\n";
+ last;
# ------------------------------------------------------------- unknown command
} else {
# unknown command