Diff for /loncom/lond between versions 1.46 and 1.52

version 1.46, 2001/04/02 14:43:17 version 1.52, 2001/09/30 18:32:31
Line 14 Line 14
 # 02/12 Gerd Kortemeyer  # 02/12 Gerd Kortemeyer
 # 03/15 Scott Harrison  # 03/15 Scott Harrison
 # 03/24 Gerd Kortemeyer  # 03/24 Gerd Kortemeyer
   # 04/02 Scott Harrison
   # 05/11,05/28,08/30 Gerd Kortemeyer
   # 9/30 Scott Harrison
 #  #
 # based on "Perl Cookbook" ISBN 1-56592-243-3  # based on "Perl Cookbook" ISBN 1-56592-243-3
 # preforker - server who forks first  # preforker - server who forks first
Line 30  use Crypt::IDEA; Line 33  use Crypt::IDEA;
 use LWP::UserAgent();  use LWP::UserAgent();
 use GDBM_File;  use GDBM_File;
 use Authen::Krb4;  use Authen::Krb4;
   use lib '/home/httpd/lib/perl/';
   use localauth;
   
 # grabs exception and records it to log before exiting  # grabs exception and records it to log before exiting
 sub catchexception {  sub catchexception {
Line 362  sub make_new_child { Line 367  sub make_new_child {
             my $clientip=inet_ntoa($iaddr);              my $clientip=inet_ntoa($iaddr);
             my $clientrec=($hostid{$clientip} ne undef);              my $clientrec=($hostid{$clientip} ne undef);
             &logthis(              &logthis(
 "<font color=yellow>INFO: Connect from $clientip ($hostid{$clientip})</font>");  "<font color=yellow>INFO: Connection $i, $clientip ($hostid{$clientip})</font>"
               );
             my $clientok;              my $clientok;
             if ($clientrec) {              if ($clientrec) {
       my $remotereq=<$client>;        my $remotereq=<$client>;
Line 466  sub make_new_child { Line 472  sub make_new_child {
   (crypt($upass,$contentpwd) eq $contentpwd);    (crypt($upass,$contentpwd) eq $contentpwd);
                           } elsif ($howpwd eq 'unix') {                            } elsif ($howpwd eq 'unix') {
                               $contentpwd=(getpwnam($uname))[1];                                $contentpwd=(getpwnam($uname))[1];
                               $pwdcorrect=        my $pwauth_path="/usr/local/sbin/pwauth";
                                   (crypt($upass,$contentpwd) eq $contentpwd);        unless ($contentpwd eq 'x') {
     $pwdcorrect=
                                       (crypt($upass,$contentpwd) eq $contentpwd);
         }
         elsif (-e $pwauth_path) {
     open PWAUTH, "|$pwauth_path" or
         die "Cannot invoke authentication";
     print PWAUTH "$uname\n$upass\n";
     close PWAUTH;
     $pwdcorrect=!$?;
         }
                           } elsif ($howpwd eq 'krb4') {                            } elsif ($howpwd eq 'krb4') {
                               $pwdcorrect=(                                $pwdcorrect=(
                                  Authen::Krb4::get_pw_in_tkt($uname,"",                                   Authen::Krb4::get_pw_in_tkt($uname,"",
                                         $contentpwd,'krbtgt',$contentpwd,1,                                          $contentpwd,'krbtgt',$contentpwd,1,
      $upass) == 0);       $upass) == 0);
                           }                            } elsif ($howpwd eq 'localauth') {
       $pwdcorrect=&localauth::localauth($uname,$upass,
         $contentpwd);
     }
                           if ($pwdcorrect) {                            if ($pwdcorrect) {
                              print $client "authorized\n";                               print $client "authorized\n";
                           } else {                            } else {
Line 560  sub make_new_child { Line 579  sub make_new_child {
                                {                                  { 
                                  my $pf = IO::File->new(">$passfilename");                                   my $pf = IO::File->new(">$passfilename");
             print $pf "internal:$ncpass\n";               print $pf "internal:$ncpass\n"; 
                                }                                              }
                                print $client "ok\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') {                               } elsif ($umode eq 'none') {
                                {                                  { 
                                  my $pf = IO::File->new(">$passfilename");                                   my $pf = IO::File->new(">$passfilename");
Line 707  sub make_new_child { Line 732  sub make_new_child {
                        chomp($what);                         chomp($what);
                        my $proname=propath($udom,$uname);                         my $proname=propath($udom,$uname);
                        my $now=time;                         my $now=time;
                        {                         unless ($namespace=~/^nohist\_/) {
    my $hfh;     my $hfh;
    if (     if (
                              $hfh=IO::File->new(">>$proname/$namespace.hist")                               $hfh=IO::File->new(">>$proname/$namespace.hist")
Line 832  sub make_new_child { Line 857  sub make_new_child {
                        chomp($what);                         chomp($what);
                        my $proname=propath($udom,$uname);                         my $proname=propath($udom,$uname);
                        my $now=time;                         my $now=time;
                        {                         unless ($namespace=~/^nohist\_/) {
    my $hfh;     my $hfh;
    if (     if (
                              $hfh=IO::File->new(">>$proname/$namespace.hist")                               $hfh=IO::File->new(">>$proname/$namespace.hist")
Line 903  sub make_new_child { Line 928  sub make_new_child {
                        chomp($what);                         chomp($what);
                        my $proname=propath($udom,$uname);                         my $proname=propath($udom,$uname);
                        my $now=time;                         my $now=time;
                        {                         unless ($namespace=~/^nohist\_/) {
    my $hfh;     my $hfh;
    if (     if (
                              $hfh=IO::File->new(">>$proname/$namespace.hist")                               $hfh=IO::File->new(">>$proname/$namespace.hist")
Line 1088  sub make_new_child { Line 1113  sub make_new_child {
                        if (-e $ulsdir) {                         if (-e $ulsdir) {
  if (opendir(LSDIR,$ulsdir)) {   if (opendir(LSDIR,$ulsdir)) {
                           while ($ulsfn=readdir(LSDIR)) {                            while ($ulsfn=readdir(LSDIR)) {
      my @ulsstats=stat($ulsfn);       my @ulsstats=stat($ulsdir.'/'.$ulsfn);
                              $ulsout.=$ulsfn.'&'.join('&',@ulsstats).':';                               $ulsout.=$ulsfn.'&'.join('&',@ulsstats).':';
                           }                            }
                           closedir(LSDIR);                            closedir(LSDIR);
Line 1098  sub make_new_child { Line 1123  sub make_new_child {
                        }                         }
                        if ($ulsout eq '') { $ulsout='empty'; }                         if ($ulsout eq '') { $ulsout='empty'; }
                        print $client "$ulsout\n";                         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  # ------------------------------------------------------------- unknown command
                    } else {                     } else {
                        # unknown command                         # unknown command

Removed from v.1.46  
changed lines
  Added in v.1.52


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>