Diff for /loncom/lond between versions 1.97 and 1.98

version 1.97, 2002/09/16 13:26:21 version 1.98, 2002/09/19 21:16:24
Line 129  sub lcpasswdstrerror { Line 129  sub lcpasswdstrerror {
     if(($ErrorCode < 0) || ($ErrorCode > $lastpwderror)) {      if(($ErrorCode < 0) || ($ErrorCode > $lastpwderror)) {
  return "lcpasswd Unrecognized error return value ".$ErrorCode;   return "lcpasswd Unrecognized error return value ".$ErrorCode;
     } else {      } else {
  return $passwderrors($ErrorCode);   return $passwderrors[$ErrorCode];
     }      }
 }  }
   
Line 141  sub lcuseraddstrerror { Line 141  sub lcuseraddstrerror {
     if(($ErrorCode < 0) || ($ErrorCode > $lastadderror)) {      if(($ErrorCode < 0) || ($ErrorCode > $lastadderror)) {
  return "lcuseradd - Unrecognized error code: ".$ErrorCode;   return "lcuseradd - Unrecognized error code: ".$ErrorCode;
     } else {      } else {
  return $adderrors($ErrorCode);   return $adderrors[$ErrorCode];
     }      }
 }  }
   
Line 759  sub make_new_child { Line 759  sub make_new_child {
                        chomp($npass);                         chomp($npass);
                        $upass=&unescape($upass);                         $upass=&unescape($upass);
                        $npass=&unescape($npass);                         $npass=&unescape($npass);
        &logthis("Trying to change password for $uname");         &Debug("Trying to change password for $uname");
        my $proname=propath($udom,$uname);         my $proname=propath($udom,$uname);
                        my $passfilename="$proname/passwd";                         my $passfilename="$proname/passwd";
                        if (-e $passfilename) {                         if (-e $passfilename) {
Line 769  sub make_new_child { Line 769  sub make_new_child {
                           chomp($realpasswd);                            chomp($realpasswd);
                           my ($howpwd,$contentpwd)=split(/:/,$realpasswd);                            my ($howpwd,$contentpwd)=split(/:/,$realpasswd);
                           if ($howpwd eq 'internal') {                            if ($howpwd eq 'internal') {
      &Debug("internal auth");
    if (crypt($upass,$contentpwd) eq $contentpwd) {     if (crypt($upass,$contentpwd) eq $contentpwd) {
      my $salt=time;       my $salt=time;
                              $salt=substr($salt,6,2);                               $salt=substr($salt,6,2);
Line 785  sub make_new_child { Line 786  sub make_new_child {
       # one way or another.        # one way or another.
       # First: Make sure the current password is        # First: Make sure the current password is
       #        correct        #        correct
         &Debug("auth is unix");
       $contentpwd=(getpwnam($uname))[1];        $contentpwd=(getpwnam($uname))[1];
       my $pwdcorrect = "0";        my $pwdcorrect = "0";
       my $pwauth_path="/usr/local/sbin/pwauth";        my $pwauth_path="/usr/local/sbin/pwauth";
Line 796  sub make_new_child { Line 798  sub make_new_child {
       die "Cannot invoke authentication";        die "Cannot invoke authentication";
   print PWAUTH "$uname\n$upass\n";    print PWAUTH "$uname\n$upass\n";
   close PWAUTH;    close PWAUTH;
   my $pwdcorrect=!$?;    &Debug("exited pwauth with $? ($uname,$upass) ");
     $pwdcorrect=($? == 0);
       }        }
      if ($pwdcorrect) {       if ($pwdcorrect) {
  my $execdir=$perlvar{'lonDaemons'};   my $execdir=$perlvar{'lonDaemons'};
  my $pf = IO::File->new("|$execdir/lcpasswd");   &Debug("Opening lcpasswd pipeline");
    my $pf = IO::File->new("|$execdir/lcpasswd > /home/www/lcpasswd.log");
  print $pf "$uname\n$npass\n$npass\n";   print $pf "$uname\n$npass\n$npass\n";
  close $pf;   close $pf;
  my $err = $?;   my $err = $?;
Line 853  sub make_new_child { Line 857  sub make_new_child {
                                }                                 }
                            }                             }
                            unless ($fperror) {                             unless ($fperror) {
        my $result=&make_passwd_file($umode,$npass,         my $result=&make_passwd_file($uname, $umode,$npass,
     $passfilename);      $passfilename);
        print $client $result;         print $client $result;
                            } else {                             } else {
Line 879  sub make_new_child { Line 883  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 {
    my $result=&make_passwd_file($umode,$npass,     my $result=&make_passwd_file($uname, $umode,$npass,
  $passfilename);   $passfilename);
    print $client $result;     print $client $result;
                        }                         }
Line 1664  sub subscribe { Line 1668  sub subscribe {
 }  }
   
 sub make_passwd_file {  sub make_passwd_file {
     my ($umode,$npass,$passfilename)=@_;      my ($uname, $umode,$npass,$passfilename)=@_;
     my $result="ok\n";      my $result="ok\n";
     if ($umode eq 'krb4' or $umode eq 'krb5') {      if ($umode eq 'krb4' or $umode eq 'krb5') {
  {   {
Line 1690  sub make_passwd_file { Line 1694  sub make_passwd_file {
     my $execpath="$perlvar{'lonDaemons'}/"."lcuseradd";      my $execpath="$perlvar{'lonDaemons'}/"."lcuseradd";
     {      {
  &Debug("Executing external: ".$execpath);   &Debug("Executing external: ".$execpath);
  my $se = IO::File->new("|$execpath");   &Debug("user  = ".$uname.", Password =". $npass);
    my $se = IO::File->new("|$execpath > /home/www/lcuseradd.log");
  print $se "$uname\n";   print $se "$uname\n";
  print $se "$npass\n";   print $se "$npass\n";
  print $se "$npass\n";   print $se "$npass\n";

Removed from v.1.97  
changed lines
  Added in v.1.98


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