version 1.196, 2004/06/17 11:02:25
|
version 1.200, 2004/06/21 13:25:53
|
Line 69 my $clientname; # LonCAPA name of clie
|
Line 69 my $clientname; # LonCAPA name of clie
|
my $server; |
my $server; |
my $thisserver; # DNS of us. |
my $thisserver; # DNS of us. |
|
|
|
my $keymode; |
|
|
# |
# |
# Connection type is: |
# Connection type is: |
# client - All client actions are allowed |
# client - All client actions are allowed |
Line 1218 sub logstatus {
|
Line 1220 sub logstatus {
|
{ |
{ |
my $fh=IO::File->new(">>$docdir/lon-status/londstatus.txt"); |
my $fh=IO::File->new(">>$docdir/lon-status/londstatus.txt"); |
print $fh $$."\t".$clientname."\t".$currenthostid."\t" |
print $fh $$."\t".$clientname."\t".$currenthostid."\t" |
.$status."\t".$lastlog."\n"; |
.$status."\t".$lastlog."\t $keymode\n"; |
$fh->close(); |
$fh->close(); |
} |
} |
&status("Finished londstatus.txt"); |
&status("Finished londstatus.txt"); |
{ |
{ |
my $fh=IO::File->new(">$docdir/lon-status/londchld/$$.txt"); |
my $fh=IO::File->new(">$docdir/lon-status/londchld/$$.txt"); |
print $fh $status."\n".$lastlog."\n".time; |
print $fh $status."\n".$lastlog."\n".time."\n$keymode"; |
$fh->close(); |
$fh->close(); |
} |
} |
&status("Finished logging"); |
&status("Finished logging"); |
Line 1556 sub make_new_child {
|
Line 1558 sub make_new_child {
|
print $client "ok:local\n"; |
print $client "ok:local\n"; |
&logthis('<font color="green"' |
&logthis('<font color="green"' |
. "Successful local authentication </font>"); |
. "Successful local authentication </font>"); |
|
$keymode = "local" |
} else { |
} else { |
Debug("Failed to get local key"); |
Debug("Failed to get local key"); |
$clientok = 0; |
$clientok = 0; |
Line 1570 sub make_new_child {
|
Line 1573 sub make_new_child {
|
$cipher = new IDEA($cipherkey); |
$cipher = new IDEA($cipherkey); |
&logthis('<font color="green">' |
&logthis('<font color="green">' |
."Successfull ssl authentication with $clientname </font>"); |
."Successfull ssl authentication with $clientname </font>"); |
|
$keymode = "ssl"; |
|
|
} else { |
} else { |
$clientok = 0; |
$clientok = 0; |
Line 1583 sub make_new_child {
|
Line 1587 sub make_new_child {
|
&logthis('<font color="green">' |
&logthis('<font color="green">' |
."Successful insecure authentication with $clientname </font>"); |
."Successful insecure authentication with $clientname </font>"); |
print $client "ok\n"; |
print $client "ok\n"; |
|
$keymode = "insecure"; |
} else { |
} else { |
&logthis('<font color="yellow">' |
&logthis('<font color="yellow">' |
."Attempted insecure connection disallowed </font>"); |
."Attempted insecure connection disallowed </font>"); |
Line 3115 sub make_new_child {
|
Line 3120 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; |
Line 3194 sub make_new_child {
|
Line 3200 sub make_new_child {
|
} |
} |
# -------------------------------------------------------------------- complete |
# -------------------------------------------------------------------- complete |
alarm(0); |
alarm(0); |
&status('Listening to '.$clientname); |
&status('Listening to '.$clientname." ($keymode)"); |
} |
} |
# --------------------------------------------- client unknown or fishy, refuse |
# --------------------------------------------- client unknown or fishy, refuse |
} else { |
} else { |