Diff for /loncom/lond between versions 1.91 and 1.96

version 1.91, 2002/08/22 20:00:00 version 1.96, 2002/09/13 02:46:12
Line 83  my $DEBUG = 0;         # Non zero to ena Line 83  my $DEBUG = 0;         # Non zero to ena
 my $status='';  my $status='';
 my $lastlog='';  my $lastlog='';
   
   #
   #  The array below are password error strings."
   #
   my $lasterror    = 10; # Largest error number from lcpasswd.
   my @passwderrors = ("ok",
      "lcpasswd must be run as user 'www'",
      "lcpasswd got incorrect number of arguments",
      "lcpasswd did not get the right nubmer of input text lines",
      "lcpasswd too many simultaneous pwd changes in progress",
      "lcpasswd User does not exist.",
      "lcpasswd Incorrect current passwd",
      "lcpasswd Unable to su to root.",
      "lcpasswd Cannot set new passwd.",
      "lcpasswd Username has invalid characters",
      "lcpasswd Invalid characters in password");
   
   #
   #  Convert an error return code from lcpasswd to a string value.
   #
   sub lcpasswdstrerror {
       my $ErrorCode = shift;
       if(($ErrorCode < 0) || ($ErrorCode > $lasterror)) {
    return "lcpasswd Unrecognized error return value ".$ErrorCode;
       } else {
    return $passwderrors($ErrorCode);
       }
   }
   
 # grabs exception and records it to log before exiting  # grabs exception and records it to log before exiting
 sub catchexception {  sub catchexception {
     my ($error)=@_;      my ($error)=@_;
Line 107  $SIG{'QUIT'}=\&catchexception; Line 135  $SIG{'QUIT'}=\&catchexception;
 $SIG{__DIE__}=\&catchexception;  $SIG{__DIE__}=\&catchexception;
   
 # ---------------------------------- Read loncapa_apache.conf and loncapa.conf  # ---------------------------------- Read loncapa_apache.conf and loncapa.conf
 &status("Read loncapa_apache.conf and loncapa.conf");  &status("Read loncapa.conf and loncapa_apache.conf");
 my $perlvarref=LONCAPA::Configuration::read_conf('loncapa_apache.conf',  my $perlvarref=LONCAPA::Configuration::read_conf('loncapa.conf');
                                                  'loncapa.conf');  
 my %perlvar=%{$perlvarref};  my %perlvar=%{$perlvarref};
 undef $perlvarref;  undef $perlvarref;
   
Line 501  sub make_new_child { Line 528  sub make_new_child {
 # =============================================================================  # =============================================================================
             # do something with the connection              # do something with the connection
 # -----------------------------------------------------------------------------  # -----------------------------------------------------------------------------
       $client->sockopt(SO_KEEPALIVE, 1);# Enable monitoring of
                                         # connection liveness.
             # see if we know client and check for spoof IP by challenge              # see if we know client and check for spoof IP by challenge
             my $caller=getpeername($client);              my $caller=getpeername($client);
             my ($port,$iaddr)=unpack_sockaddr_in($caller);              my ($port,$iaddr)=unpack_sockaddr_in($caller);
Line 660  sub make_new_child { Line 689  sub make_new_child {
       $null=pack("C",0);        $null=pack("C",0);
       unless ($upass=~/$null/) {        unless ($upass=~/$null/) {
   my $krbclient=&Authen::Krb5::parse_name($uname.'@'.$contentpwd);    my $krbclient=&Authen::Krb5::parse_name($uname.'@'.$contentpwd);
   &logthis("Realm ".$krbclient->realm);  
   my $krbservice="krbtgt/".$contentpwd."\@".$contentpwd;    my $krbservice="krbtgt/".$contentpwd."\@".$contentpwd;
   my $krbserver=&Authen::Krb5::parse_name($krbservice);    my $krbserver=&Authen::Krb5::parse_name($krbservice);
   my $credentials=&Authen::Krb5::cc_default();    my $credentials=&Authen::Krb5::cc_default();
Line 668  sub make_new_child { Line 696  sub make_new_child {
   my $krbreturn =     my $krbreturn = 
     &Authen::Krb5::get_in_tkt_with_password(      &Authen::Krb5::get_in_tkt_with_password(
      $krbclient,$krbserver,$upass,$credentials);       $krbclient,$krbserver,$upass,$credentials);
   unless ($krbreturn) {  #  unless ($krbreturn) {
       &logthis("Krb5 Error: ".  #      &logthis("Krb5 Error: ".
        &Authen::Krb5::error());  #       &Authen::Krb5::error());
   }  #  }
   $pwdcorrect = ($krbreturn == 1);    $pwdcorrect = ($krbreturn == 1);
    } else { $pwdcorrect=0; }     } else { $pwdcorrect=0; }
                           } elsif ($howpwd eq 'localauth') {                            } elsif ($howpwd eq 'localauth') {
Line 743  sub make_new_child { Line 771  sub make_new_child {
  close $pf;   close $pf;
  my $result = ($?>0 ? 'pwchange_failure'    my $result = ($?>0 ? 'pwchange_failure' 
        : 'ok');         : 'ok');
  &logthis("Result of password change for $uname: $result");   &logthis("Result of password change for $uname: ".
     &lcpasswdstrerror($?));
  print $client "$result\n";   print $client "$result\n";
      } else {       } else {
  print $client "non_authorized\n";   print $client "non_authorized\n";
Line 815  sub make_new_child { Line 844  sub make_new_child {
        if ($udom ne $perlvar{'lonDefDomain'}) {         if ($udom ne $perlvar{'lonDefDomain'}) {
                            print $client "not_right_domain\n";                             print $client "not_right_domain\n";
                        } else {                         } else {
    &make_passwd_file($umode,$npass,$passfilename);     my $result=&make_passwd_file($umode,$npass,
    $passfilename);
    print $client $result;     print $client $result;
                        }                         }
      } else {       } else {

Removed from v.1.91  
changed lines
  Added in v.1.96


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