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

foxr lon-capa-cvs@mail.lon-capa.org
Fri, 06 Aug 2004 10:27:53 -0000


foxr		Fri Aug  6 06:27:53 2004 EDT

  Modified files:              
    /loncom	lond 
  Log:
  1. Use the 'standard' loncapa tmp directory for lcuseradd files.
  2. Raise the self esteem of all the else's by cuddling them in accordance
    with LonCAPA coding style.
  
  
Index: loncom/lond
diff -u loncom/lond:1.223 loncom/lond:1.224
--- loncom/lond:1.223	Thu Aug  5 07:37:05 2004
+++ loncom/lond	Fri Aug  6 06:27:53 2004
@@ -2,7 +2,7 @@
 # The LearningOnline Network
 # lond "LON Daemon" Server (port "LOND" 5663)
 #
-# $Id: lond,v 1.223 2004/08/05 11:37:05 foxr Exp $
+# $Id: lond,v 1.224 2004/08/06 10:27:53 foxr Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -57,7 +57,7 @@
 my $status='';
 my $lastlog='';
 
-my $VERSION='$Revision: 1.223 $'; #' stupid emacs
+my $VERSION='$Revision: 1.224 $'; #' stupid emacs
 my $remoteVERSION;
 my $currenthostid="default";
 my $currentdomainid;
@@ -194,8 +194,7 @@
 		 ."$clientdns ne $thisserver </font>");
 	close $Socket;
 	return undef;
-    } 
-    else {
+    }  else {
 	chomp($initcmd);	# Get rid of \n in filename.
 	my ($init, $type, $name) = split(/:/, $initcmd);
 	Debug(" Init command: $init $type $name ");
@@ -326,8 +325,7 @@
     $answer    =~s/\W//g;
     if($challenge eq $answer) {
 	return 1;
-    } 
-    else {
+    } else {
 	logthis("<font color='blue'>WARNING client did not respond to challenge</font>");
 	&status("No challenge reqply");
 	return 0;
@@ -656,8 +654,7 @@
 	&logthis('<font color="red"> Pushfile: unable to install '
 	 .$tablefile." $! </font>");
 	return "error:$!";
-    }
-    else {
+    } else {
 	&logthis('<font color="green"> Installed new '.$tablefile
 		 ."</font>");
 
@@ -1503,8 +1500,7 @@
 	    &Failure( $client, "auth_mode_error\n", $userinput);
 	}  
 	
-    }
-    else {
+    } else {
 	&Failure( $client, "non_authorized\n", $userinput);
     }
 
@@ -2495,8 +2491,7 @@
 		print $store2 "done\n";
 		close $store2;
 		print $client "ok\n";
-	    }
-	    else {
+	    } else {
 		print $client "error: ".($!+0)
 		    ." IO::File->new Failed ".
 		    "while attempting queryreply\n";
@@ -3694,8 +3689,7 @@
 			$inittype = ""; # This forces insecure attempt.
 			&logthis("<font color=\"blue\"> Certificates not "
 				 ."installed -- trying insecure auth</font>");
-		    }
-		    else {	# SSL certificates are in place so
+		    } else {	# SSL certificates are in place so
 		    }		# Leave the inittype alone.
 		}
 
@@ -3929,8 +3923,7 @@
 	}
 
 	return "$authtype:$availinfo";
-    }
-    else {
+    } else {
 	Debug("Returning nouser");
 	return "nouser";
     }
@@ -4010,18 +4003,15 @@
 							   $password);
 		if(!$k4error) {
 		    $validated = 1;
-		}
-		else {
+		} else {
 		    $validated = 0;
 		    &logthis('krb4: '.$user.', '.$contentpwd.', '.
 			     &Authen::Krb4::get_err_txt($Authen::Krb4::error));
 		}
-	    }
-	    else {
+	    } else {
 		$validated = 0; # Password has a match with null.
 	    }
-	}
-	elsif ($howpwd eq "krb5") { # User is in kerberos 5 auth. domain.
+	} elsif ($howpwd eq "krb5") { # User is in kerberos 5 auth. domain.
 	    if(!($password =~ /$null/)) { # Null password not allowed.
 		my $krbclient = &Authen::Krb5::parse_name($user.'@'
 							  .$contentpwd);
@@ -4034,18 +4024,15 @@
 									 $password,
 									 $credentials);
 		$validated = ($krbreturn == 1);
-	    }
-	    else {
+	    } else {
 		$validated = 0;
 	    }
-	}
-	elsif ($howpwd eq "localauth") { 
+	} elsif ($howpwd eq "localauth") { 
 	    #  Authenticate via installation specific authentcation method:
 	    $validated = &localauth::localauth($user, 
 					       $password, 
 					       $contentpwd);
-	}
-	else {			# Unrecognized auth is also bad.
+	} else {			# Unrecognized auth is also bad.
 	    $validated = 0;
 	}
     } else {
@@ -4308,7 +4295,8 @@
 	    }
 
 	    my $execpath       ="$perlvar{'lonDaemons'}/"."lcuseradd";
-	    my $lc_error_file  = "/tmp/lcuseradd".$$.".status";
+
+	    my $lc_error_file  = $execdir."/tmp/lcuseradd".$$.".status";
 	    {
 		&Debug("Executing external: ".$execpath);
 		&Debug("user  = ".$uname.", Password =". $npass);
@@ -4329,8 +4317,7 @@
 		my $error_text = &lcuseraddstrerror($useraddok);
 		&logthis("Failed lcuseradd: $error_text");
 		$result = "lcuseradd_failed:$error_text\n";
-	    }
-	    else {
+	    }  else {
 		my $pf = IO::File->new(">$passfilename");
 		print $pf "unix:\n";
 	    }