--- loncom/lond 2011/08/02 03:11:35 1.479 +++ loncom/lond 2011/08/05 04:35:45 1.480 @@ -2,7 +2,7 @@ # The LearningOnline Network # lond "LON Daemon" Server (port "LOND" 5663) # -# $Id: lond,v 1.479 2011/08/02 03:11:35 raeburn Exp $ +# $Id: lond,v 1.480 2011/08/05 04:35:45 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -60,7 +60,7 @@ my $DEBUG = 0; # Non zero to ena my $status=''; my $lastlog=''; -my $VERSION='$Revision: 1.479 $'; #' stupid emacs +my $VERSION='$Revision: 1.480 $'; #' stupid emacs my $remoteVERSION; my $currenthostid="default"; my $currentdomainid; @@ -92,6 +92,8 @@ my %managers; # Ip -> manager names my %perlvar; # Will have the apache conf defined perl vars. +my $dist; + # # The hash below is used for command dispatching, and is therefore keyed on the request keyword. # Each element of the hash contains a reference to an array that contains: @@ -1646,20 +1648,48 @@ sub read_lonnet_global { my $userinput = "$cmd:$tail"; my $requested = &Apache::lonnet::thaw_unescape($tail); my $result; + my %packagevars = ( + spareid => \%Apache::lonnet::spareid, + perlvar => \%Apache::lonnet::perlvar, + ); + my %limit_to = ( + perlvar => { + lonOtherAuthen => 1, + lonBalancer => 1, + lonVersion => 1, + lonSysEMail => 1, + lonHostID => 1, + lonRole => 1, + lonDefDomain => 1, + lonLoadLim => 1, + lonUserLoadLim => 1, + } + ); if (ref($requested) eq 'HASH') { foreach my $what (keys(%{$requested})) { - my $type = $requested->{$what}; - my $lonnetglobal = 'Apache::lonnet::'.$what; my $response; - if ($type eq 'HASH') { - if (defined(%{$lonnetglobal})) { - my $hashref = \%{$lonnetglobal}; - $response = &Apache::lonnet::freeze_escape($hashref); + my $items = {}; + if (exists($packagevars{$what})) { + if (ref($limit_to{$what}) eq 'HASH') { + foreach my $varname (keys(%{$packagevars{$what}})) { + if ($limit_to{$what}{$varname}) { + $items->{$varname} = $packagevars{$what}{$varname}; + } + } + } else { + $items = $packagevars{$what}; } - } else { - if (defined(${$lonnetglobal})) { - $response = &escape(${$lonnetglobal}); + if ($what eq 'perlvar') { + if (!exists($packagevars{$what}{'lonBalancer'})) { + if ($dist =~ /^(centos|rhes|fedora|scientific)/) { + my $othervarref=LONCAPA::Configuration::read_conf('httpd.conf'); + if (ref($othervarref) eq 'HASH') { + $items->{'lonBalancer'} = $othervarref->{'lonBalancer'}; + } + } + } } + $response = &Apache::lonnet::freeze_escape($items); } $result .= &escape($what).'='.$response.'&'; } @@ -6404,7 +6434,7 @@ $SIG{USR2} = \&UpdateHosts; &Apache::lonnet::load_hosts_tab(); my %iphost = &Apache::lonnet::get_iphost(1); -my $dist=`$perlvar{'lonDaemons'}/distprobe`; +$dist=`$perlvar{'lonDaemons'}/distprobe`; my $arch = `uname -i`; chomp($arch);