--- loncom/lond 2022/02/07 12:12:07 1.489.2.43.2.2 +++ loncom/lond 2022/02/20 20:58:26 1.489.2.43.2.3 @@ -2,7 +2,7 @@ # The LearningOnline Network # lond "LON Daemon" Server (port "LOND" 5663) # -# $Id: lond,v 1.489.2.43.2.2 2022/02/07 12:12:07 raeburn Exp $ +# $Id: lond,v 1.489.2.43.2.3 2022/02/20 20:58:26 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -63,7 +63,7 @@ my $DEBUG = 0; # Non zero to ena my $status=''; my $lastlog=''; -my $VERSION='$Revision: 1.489.2.43.2.2 $'; #' stupid emacs +my $VERSION='$Revision: 1.489.2.43.2.3 $'; #' stupid emacs my $remoteVERSION; my $currenthostid="default"; my $currentdomainid; @@ -4723,7 +4723,7 @@ sub get_domain_handler { my $userinput = "$cmd:$tail"; my ($udom,$namespace,$what)=split(/:/,$tail,3); - if ($namespace =~ /^enc/) { + if (($namespace =~ /^enc/) || ($namespace eq 'private')) { &Failure( $client, "refused\n", $userinput); } else { my $res = LONCAPA::Lond::get_dom($userinput); @@ -4743,23 +4743,28 @@ sub encrypted_get_domain_handler { my $userinput = "$cmd:$tail"; - my $res = LONCAPA::Lond::get_dom($userinput); - if ($res =~ /^error:/) { - &Failure($client, \$res, $userinput); + my ($udom,$namespace,$what) = split(/:/,$tail,3); + if ($namespace eq 'private') { + &Failure( $client, "refused\n", $userinput); } else { - if ($cipher) { - my $cmdlength=length($res); - $res.=" "; - my $encres=''; - for (my $encidx=0;$encidx<=$cmdlength;$encidx+=8) { - $encres.= unpack("H16", - $cipher->encrypt(substr($res, - $encidx, - 8))); - } - &Reply( $client,"enc:$cmdlength:$encres\n",$userinput); + my $res = LONCAPA::Lond::get_dom($userinput); + if ($res =~ /^error:/) { + &Failure($client, \$res, $userinput); } else { - &Failure( $client, "error:no_key\n",$userinput); + if ($cipher) { + my $cmdlength=length($res); + $res.=" "; + my $encres=''; + for (my $encidx=0;$encidx<=$cmdlength;$encidx+=8) { + $encres.= unpack("H16", + $cipher->encrypt(substr($res, + $encidx, + 8))); + } + &Reply( $client,"enc:$cmdlength:$encres\n",$userinput); + } else { + &Failure( $client, "error:no_key\n",$userinput); + } } } return 1;