--- loncom/lond 2004/06/17 10:15:46 1.195
+++ loncom/lond 2004/06/17 18:48:05 1.197
@@ -2,7 +2,7 @@
# The LearningOnline Network
# lond "LON Daemon" Server (port "LOND" 5663)
#
-# $Id: lond,v 1.195 2004/06/17 10:15:46 foxr Exp $
+# $Id: lond,v 1.197 2004/06/17 18:48:05 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -51,12 +51,12 @@ use LONCAPA::ConfigFileEdit;
use LONCAPA::lonlocal;
use LONCAPA::lonssl;
-my $DEBUG = 0; # Non zero to enable debug log entries.
+my $DEBUG = 11; # Non zero to enable debug log entries.
my $status='';
my $lastlog='';
-my $VERSION='$Revision: 1.195 $'; #' stupid emacs
+my $VERSION='$Revision: 1.197 $'; #' stupid emacs
my $remoteVERSION;
my $currenthostid;
my $currentdomainid;
@@ -1527,6 +1527,25 @@ sub make_new_child {
# If the remote is attempting a local init... give that a try:
#
my ($i, $inittype) = split(/:/, $remotereq);
+
+ # If the connection type is ssl, but I didn't get my
+ # certificate files yet, then I'll drop back to
+ # insecure (if allowed).
+
+ if($inittype eq "ssl") {
+ my ($ca, $cert) = lonssl::CertificateFile;
+ my $kfile = lonssl::KeyFile;
+ if((!$ca) ||
+ (!$cert) ||
+ (!$kfile)) {
+ $inittype = ""; # This forces insecure attempt.
+ &logthis(" Certificates not "
+ ."installed -- trying insecure auth");
+ }
+ else { # SSL certificates are in place so
+ } # Leave the inittype alone.
+ }
+
if($inittype eq "local") {
my $key = LocalConnection($client, $remotereq);
if($key) {
@@ -1550,7 +1569,7 @@ sub make_new_child {
my $cipherkey = pack("H32", $key);
$cipher = new IDEA($cipherkey);
&logthis(''
- ."Successfull ssl authentication ");
+ ."Successfull ssl authentication with $clientname ");
} else {
$clientok = 0;
@@ -1562,7 +1581,7 @@ sub make_new_child {
if($ok) {
$clientok = 1;
&logthis(''
- ."Successful insecure authentication ");
+ ."Successful insecure authentication with $clientname ");
print $client "ok\n";
} else {
&logthis(''
@@ -3096,53 +3115,54 @@ sub make_new_child {
print $client "refused\n";
}
#------------------------------- is auto-enrollment enabled?
- } elsif ($userinput =~/^autorun/) {
+ } elsif ($userinput =~/^autorun:/) {
if (isClient) {
- my $outcome = &localenroll::run();
+ my ($cmd,$cdom) = split(/:/,$userinput);
+ my $outcome = &localenroll::run($cdom);
print $client "$outcome\n";
} else {
print $client "0\n";
}
#------------------------------- get official sections (for auto-enrollment).
- } elsif ($userinput =~/^autogetsections/) {
+ } elsif ($userinput =~/^autogetsections:/) {
if (isClient) {
- my ($cmd,$coursecode)=split(/:/,$userinput);
- my @secs = &localenroll::get_sections($coursecode);
+ my ($cmd,$coursecode,$cdom)=split(/:/,$userinput);
+ my @secs = &localenroll::get_sections($coursecode,$cdom);
my $seclist = &escape(join(':',@secs));
print $client "$seclist\n";
} else {
print $client "refused\n";
}
#----------------------- validate owner of new course section (for auto-enrollment).
- } elsif ($userinput =~/^autonewcourse/) {
+ } elsif ($userinput =~/^autonewcourse:/) {
if (isClient) {
- my ($cmd,$course_id,$owner)=split(/:/,$userinput);
- my $outcome = &localenroll::new_course($course_id,$owner);
+ my ($cmd,$inst_course_id,$owner,$cdom)=split(/:/,$userinput);
+ my $outcome = &localenroll::new_course($inst_course_id,$owner,$cdom);
print $client "$outcome\n";
} else {
print $client "refused\n";
}
#-------------- validate course section in schedule of classes (for auto-enrollment).
- } elsif ($userinput =~/^autovalidatecourse/) {
+ } elsif ($userinput =~/^autovalidatecourse:/) {
if (isClient) {
- my ($cmd,$course_id)=split(/:/,$userinput);
- my $outcome=&localenroll::validate_courseID($course_id);
+ my ($cmd,$inst_course_id,$cdom)=split(/:/,$userinput);
+ my $outcome=&localenroll::validate_courseID($inst_course_id,$cdom);
print $client "$outcome\n";
} else {
print $client "refused\n";
}
#--------------------------- create password for new user (for auto-enrollment).
- } elsif ($userinput =~/^autocreatepassword/) {
+ } elsif ($userinput =~/^autocreatepassword:/) {
if (isClient) {
- my ($cmd,$authparam)=split(/:/,$userinput);
- my ($create_passwd,$authchk) = @_;
- ($authparam,$create_passwd,$authchk) = &localenroll::create_password($authparam);
+ my ($cmd,$authparam,$cdom)=split(/:/,$userinput);
+ my ($create_passwd,$authchk);
+ ($authparam,$create_passwd,$authchk) = &localenroll::create_password($authparam,$cdom);
print $client &escape($authparam.':'.$create_passwd.':'.$authchk)."\n";
} else {
print $client "refused\n";
}
#--------------------------- read and remove temporary files (for auto-enrollment).
- } elsif ($userinput =~/^autoretrieve/) {
+ } elsif ($userinput =~/^autoretrieve:/) {
if (isClient) {
my ($cmd,$filename) = split(/:/,$userinput);
my $source = $perlvar{'lonDaemons'}.'/tmp/'.$filename;