version 1.194, 2004/06/17 09:26:56
|
version 1.197, 2004/06/17 18:48:05
|
Line 51 use LONCAPA::ConfigFileEdit;
|
Line 51 use LONCAPA::ConfigFileEdit;
|
use LONCAPA::lonlocal; |
use LONCAPA::lonlocal; |
use LONCAPA::lonssl; |
use LONCAPA::lonssl; |
|
|
my $DEBUG = 1; # Non zero to enable debug log entries. |
my $DEBUG = 11; # Non zero to enable debug log entries. |
|
|
my $status=''; |
my $status=''; |
my $lastlog=''; |
my $lastlog=''; |
Line 1527 sub make_new_child {
|
Line 1527 sub make_new_child {
|
# If the remote is attempting a local init... give that a try: |
# If the remote is attempting a local init... give that a try: |
# |
# |
my ($i, $inittype) = split(/:/, $remotereq); |
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("<font color=\"blue\"> Certificates not " |
|
."installed -- trying insecure auth</font>"); |
|
} |
|
else { # SSL certificates are in place so |
|
} # Leave the inittype alone. |
|
} |
|
|
if($inittype eq "local") { |
if($inittype eq "local") { |
my $key = LocalConnection($client, $remotereq); |
my $key = LocalConnection($client, $remotereq); |
if($key) { |
if($key) { |
Line 1550 sub make_new_child {
|
Line 1569 sub make_new_child {
|
my $cipherkey = pack("H32", $key); |
my $cipherkey = pack("H32", $key); |
$cipher = new IDEA($cipherkey); |
$cipher = new IDEA($cipherkey); |
&logthis('<font color="green">' |
&logthis('<font color="green">' |
."Successfull ssl authentication </font>"); |
."Successfull ssl authentication with $clientname </font>"); |
|
|
} else { |
} else { |
$clientok = 0; |
$clientok = 0; |
Line 1562 sub make_new_child {
|
Line 1581 sub make_new_child {
|
if($ok) { |
if($ok) { |
$clientok = 1; |
$clientok = 1; |
&logthis('<font color="green">' |
&logthis('<font color="green">' |
."Successful insecure authentication </font>"); |
."Successful insecure authentication with $clientname </font>"); |
print $client "ok\n"; |
print $client "ok\n"; |
} else { |
} else { |
&logthis('<font color="yellow">' |
&logthis('<font color="yellow">' |
Line 3096 sub make_new_child {
|
Line 3115 sub make_new_child {
|
print $client "refused\n"; |
print $client "refused\n"; |
} |
} |
#------------------------------- is auto-enrollment enabled? |
#------------------------------- is auto-enrollment enabled? |
} elsif ($userinput =~/^autorun/) { |
} elsif ($userinput =~/^autorun:/) { |
if (isClient) { |
if (isClient) { |
my $outcome = &localenroll::run(); |
my ($cmd,$cdom) = split(/:/,$userinput); |
|
my $outcome = &localenroll::run($cdom); |
print $client "$outcome\n"; |
print $client "$outcome\n"; |
} else { |
} else { |
print $client "0\n"; |
print $client "0\n"; |
} |
} |
#------------------------------- get official sections (for auto-enrollment). |
#------------------------------- get official sections (for auto-enrollment). |
} elsif ($userinput =~/^autogetsections/) { |
} elsif ($userinput =~/^autogetsections:/) { |
if (isClient) { |
if (isClient) { |
my ($cmd,$coursecode)=split(/:/,$userinput); |
my ($cmd,$coursecode,$cdom)=split(/:/,$userinput); |
my @secs = &localenroll::get_sections($coursecode); |
my @secs = &localenroll::get_sections($coursecode,$cdom); |
my $seclist = &escape(join(':',@secs)); |
my $seclist = &escape(join(':',@secs)); |
print $client "$seclist\n"; |
print $client "$seclist\n"; |
} else { |
} else { |
print $client "refused\n"; |
print $client "refused\n"; |
} |
} |
#----------------------- validate owner of new course section (for auto-enrollment). |
#----------------------- validate owner of new course section (for auto-enrollment). |
} elsif ($userinput =~/^autonewcourse/) { |
} elsif ($userinput =~/^autonewcourse:/) { |
if (isClient) { |
if (isClient) { |
my ($cmd,$course_id,$owner)=split(/:/,$userinput); |
my ($cmd,$inst_course_id,$owner,$cdom)=split(/:/,$userinput); |
my $outcome = &localenroll::new_course($course_id,$owner); |
my $outcome = &localenroll::new_course($inst_course_id,$owner,$cdom); |
print $client "$outcome\n"; |
print $client "$outcome\n"; |
} else { |
} else { |
print $client "refused\n"; |
print $client "refused\n"; |
} |
} |
#-------------- validate course section in schedule of classes (for auto-enrollment). |
#-------------- validate course section in schedule of classes (for auto-enrollment). |
} elsif ($userinput =~/^autovalidatecourse/) { |
} elsif ($userinput =~/^autovalidatecourse:/) { |
if (isClient) { |
if (isClient) { |
my ($cmd,$course_id)=split(/:/,$userinput); |
my ($cmd,$inst_course_id,$cdom)=split(/:/,$userinput); |
my $outcome=&localenroll::validate_courseID($course_id); |
my $outcome=&localenroll::validate_courseID($inst_course_id,$cdom); |
print $client "$outcome\n"; |
print $client "$outcome\n"; |
} else { |
} else { |
print $client "refused\n"; |
print $client "refused\n"; |
} |
} |
#--------------------------- create password for new user (for auto-enrollment). |
#--------------------------- create password for new user (for auto-enrollment). |
} elsif ($userinput =~/^autocreatepassword/) { |
} elsif ($userinput =~/^autocreatepassword:/) { |
if (isClient) { |
if (isClient) { |
my ($cmd,$authparam)=split(/:/,$userinput); |
my ($cmd,$authparam,$cdom)=split(/:/,$userinput); |
my ($create_passwd,$authchk) = @_; |
my ($create_passwd,$authchk); |
($authparam,$create_passwd,$authchk) = &localenroll::create_password($authparam); |
($authparam,$create_passwd,$authchk) = &localenroll::create_password($authparam,$cdom); |
print $client &escape($authparam.':'.$create_passwd.':'.$authchk)."\n"; |
print $client &escape($authparam.':'.$create_passwd.':'.$authchk)."\n"; |
} else { |
} else { |
print $client "refused\n"; |
print $client "refused\n"; |
} |
} |
#--------------------------- read and remove temporary files (for auto-enrollment). |
#--------------------------- read and remove temporary files (for auto-enrollment). |
} elsif ($userinput =~/^autoretrieve/) { |
} elsif ($userinput =~/^autoretrieve:/) { |
if (isClient) { |
if (isClient) { |
my ($cmd,$filename) = split(/:/,$userinput); |
my ($cmd,$filename) = split(/:/,$userinput); |
my $source = $perlvar{'lonDaemons'}.'/tmp/'.$filename; |
my $source = $perlvar{'lonDaemons'}.'/tmp/'.$filename; |