[LON-CAPA-cvs] cvs: loncom / lond

foxr lon-capa-cvs@mail.lon-capa.org
Thu, 19 Sep 2002 21:16:24 -0000


foxr		Thu Sep 19 17:16:24 2002 EDT

  Modified files:              
    /loncom	lond 
  Log:
  Bug 701 - Fixed a backwards status check... added piles of logging.
  
  
  
Index: loncom/lond
diff -u loncom/lond:1.97 loncom/lond:1.98
--- loncom/lond:1.97	Mon Sep 16 09:26:21 2002
+++ loncom/lond	Thu Sep 19 17:16:24 2002
@@ -2,7 +2,7 @@
 # The LearningOnline Network
 # lond "LON Daemon" Server (port "LOND" 5663)
 #
-# $Id: lond,v 1.97 2002/09/16 13:26:21 foxr Exp $
+# $Id: lond,v 1.98 2002/09/19 21:16:24 foxr Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -129,7 +129,7 @@
     if(($ErrorCode < 0) || ($ErrorCode > $lastpwderror)) {
 	return "lcpasswd Unrecognized error return value ".$ErrorCode;
     } else {
-	return $passwderrors($ErrorCode);
+	return $passwderrors[$ErrorCode];
     }
 }
 
@@ -141,7 +141,7 @@
     if(($ErrorCode < 0) || ($ErrorCode > $lastadderror)) {
 	return "lcuseradd - Unrecognized error code: ".$ErrorCode;
     } else {
-	return $adderrors($ErrorCode);
+	return $adderrors[$ErrorCode];
     }
 }
 
@@ -759,7 +759,7 @@
                        chomp($npass);
                        $upass=&unescape($upass);
                        $npass=&unescape($npass);
-		       &logthis("Trying to change password for $uname");
+		       &Debug("Trying to change password for $uname");
 		       my $proname=propath($udom,$uname);
                        my $passfilename="$proname/passwd";
                        if (-e $passfilename) {
@@ -769,6 +769,7 @@
                           chomp($realpasswd);
                           my ($howpwd,$contentpwd)=split(/:/,$realpasswd);
                           if ($howpwd eq 'internal') {
+			   &Debug("internal auth");
 			   if (crypt($upass,$contentpwd) eq $contentpwd) {
 			     my $salt=time;
                              $salt=substr($salt,6,2);
@@ -785,6 +786,7 @@
 			      # one way or another.
 			      # First: Make sure the current password is
 			      #        correct
+			      &Debug("auth is unix");
 			      $contentpwd=(getpwnam($uname))[1];
 			      my $pwdcorrect = "0";
 			      my $pwauth_path="/usr/local/sbin/pwauth";
@@ -796,11 +798,13 @@
 				      die "Cannot invoke authentication";
 				  print PWAUTH "$uname\n$upass\n";
 				  close PWAUTH;
-				  my $pwdcorrect=!$?;
+				  &Debug("exited pwauth with $? ($uname,$upass) ");
+				  $pwdcorrect=($? == 0);
 			      }
 			     if ($pwdcorrect) {
 				 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";
 				 close $pf;
 				 my $err = $?;
@@ -853,7 +857,7 @@
                                }
                            }
                            unless ($fperror) {
-			       my $result=&make_passwd_file($umode,$npass,
+			       my $result=&make_passwd_file($uname, $umode,$npass,
 							    $passfilename);
 			       print $client $result;
                            } else {
@@ -879,7 +883,7 @@
 		       if ($udom ne $perlvar{'lonDefDomain'}) {
                            print $client "not_right_domain\n";
                        } else {
-			   my $result=&make_passwd_file($umode,$npass,
+			   my $result=&make_passwd_file($uname, $umode,$npass,
 							$passfilename);
 			   print $client $result;
                        }
@@ -1664,7 +1668,7 @@
 }
 
 sub make_passwd_file {
-    my ($umode,$npass,$passfilename)=@_;
+    my ($uname, $umode,$npass,$passfilename)=@_;
     my $result="ok\n";
     if ($umode eq 'krb4' or $umode eq 'krb5') {
 	{
@@ -1690,7 +1694,8 @@
 	    my $execpath="$perlvar{'lonDaemons'}/"."lcuseradd";
 	    {
 		&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 "$npass\n";
 		print $se "$npass\n";