[LON-CAPA-cvs] cvs: loncom /auth lonlogin.pm lonracc.pm lonroles.pm lontokacc.pm switchserver.pm /interface lonannounce.pm loncommon.pm lonindexer.pm lonmsg.pm lonsyllabus.pm /lonnet/perl lonnet.pm /publisher lonpublisher.pm lonunauthorized.pm

albertel lon-capa-cvs@mail.lon-capa.org
Fri, 02 Mar 2007 23:18:19 -0000


This is a MIME encoded message

--albertel1172877499
Content-Type: text/plain

albertel		Fri Mar  2 18:18:19 2007 EDT

  Modified files:              
    /loncom/lonnet/perl	lonnet.pm 
    /loncom/auth	lonlogin.pm lonroles.pm switchserver.pm lonracc.pm 
                	lontokacc.pm 
    /loncom/interface	lonsyllabus.pm lonannounce.pm loncommon.pm 
                     	lonindexer.pm lonmsg.pm 
    /loncom/publisher	lonpublisher.pm lonunauthorized.pm 
  Log:
  - starting work on moving to distributed DNS, eliminate usage of the lonnet hostanme global
  
  
--albertel1172877499
Content-Type: text/plain
Content-Disposition: attachment; filename="albertel-20070302181819.txt"

Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.837 loncom/lonnet/perl/lonnet.pm:1.838
--- loncom/lonnet/perl/lonnet.pm:1.837	Thu Mar  1 12:51:56 2007
+++ loncom/lonnet/perl/lonnet.pm	Fri Mar  2 18:17:40 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.837 2007/03/01 17:51:56 raeburn Exp $
+# $Id: lonnet.pm,v 1.838 2007/03/02 23:17:40 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -35,7 +35,7 @@
 use HTTP::Date;
 # use Date::Parse;
 use vars 
-qw(%perlvar %hostname %badServerCache %iphost %spareid %hostdom 
+qw(%perlvar %badServerCache %iphost %spareid %hostdom 
    %libserv %pr %prp $memcache %packagetab 
    %courselogs %accesshash %userrolehash %domainrolehash $processmarker $dumpcount 
    %coursedombuf %coursenumbuf %coursehombuf %coursedescrbuf %courseinstcodebuf %courseownerbuf %coursetypebuf
@@ -149,7 +149,7 @@
 # -------------------------------------------------- Non-critical communication
 sub subreply {
     my ($cmd,$server)=@_;
-    my $peerfile="$perlvar{'lonSockDir'}/".$hostname{$server};
+    my $peerfile="$perlvar{'lonSockDir'}/".&hostname($server);
     #
     #  With loncnew process trimming, there's a timing hole between lonc server
     #  process exit and the master server picking up the listen on the AF_UNIX
@@ -189,7 +189,7 @@
 
 sub reply {
     my ($cmd,$server)=@_;
-    unless (defined($hostname{$server})) { return 'no_such_host'; }
+    unless (defined(&hostname($server))) { return 'no_such_host'; }
     my $answer=subreply($cmd,$server);
     if (($answer=~/^refused/) || ($answer=~/^rejected/)) {
        &logthis("<font color=\"blue\">WARNING:".
@@ -224,7 +224,7 @@
 
 sub critical {
     my ($cmd,$server)=@_;
-    unless ($hostname{$server}) {
+    unless (&hostname($server)) {
         &logthis("<font color=\"blue\">WARNING:".
                " Critical message to unknown server ($server)</font>");
         return 'no_such_host';
@@ -517,7 +517,7 @@
     }
 
     if (!$want_server_name) {
-	$spare_server="http://$hostname{$spare_server}";
+	$spare_server="http://".&hostname($spare_server);
     }
     return $spare_server;
 }
@@ -2295,7 +2295,7 @@
     my $now=time;
     my ($ta,$tb,$lonhost)=split(/\*/,$token);
     $lonhost=~tr/A-Z/a-z/;
-    my $dtoken=$ta.'_'.$hostname{$lonhost}.'_'.$tb;
+    my $dtoken=$ta.'_'.&hostname($lonhost).'_'.$tb;
     $dtoken=~s/\W/\_/g;
     my ($dummy,$tuname,$tudom,$tcrsid,$symb,$chtim,$rmaddr)=
                  split(/\&/,&unescape(&reply('tmpget:'.$dtoken,$lonhost)));
@@ -2964,7 +2964,7 @@
     my ($allroles,$trole,$tdomain,$trest,$spec,$area) = @_;
     my ($rdummy,$rdomain,$rauthor,$rrole)=split(/\//,$trole);
     my $homsvr=homeserver($rauthor,$rdomain);
-    if ($hostname{$homsvr} ne '') {
+    if (&hostname($homsvr) ne '') {
         my ($rdummy,$roledef)=
             &get('roles',["rolesdef_$rrole"],$rdomain,$rauthor);
         if (($rdummy ne 'con_lost') && ($roledef ne '')) {
@@ -4195,7 +4195,7 @@
     my ($uname,$udom,$query,%filters)=@_;
     my $uhome=&homeserver($uname,$udom);
     if ($uhome eq 'no_host') { return 'error: no_host'; }
-    my $uhost=$hostname{$uhome};
+    my $uhost=&hostname($uhome);
     my $command=&escape(join(':',map{$_.'='.$filters{$_}} keys(%filters)));
     my $queryid=&reply("querysend:".$query.':'.$udom.':'.$uname.':'.$command,
                        $uhome);
@@ -4227,7 +4227,7 @@
     } else {
         $homeserver = &homeserver($cnum,$dom);
     }
-    my $host=$hostname{$homeserver};
+    my $host=&hostname($homeserver);
     my $cmd = '';
     foreach my $affiliate (keys %{$affiliatesref}) {
         $cmd .= $affiliate.'='.join(",",@{$$affiliatesref{$affiliate}}).'%%';
@@ -4418,7 +4418,7 @@
 sub auto_photoupdate {
     my ($affiliatesref,$dom,$cnum,$photo) = @_;
     my $homeserver = &homeserver($cnum,$dom);
-    my $host=$hostname{$homeserver};
+    my $host=&hostname($homeserver);
     my $cmd = '';
     my $maxtries = 1;
     foreach my $affiliate (keys(%{$affiliatesref})) {
@@ -7286,7 +7286,7 @@
     if (-e $transferfile) { return 'ok'; }
     my $request;
     $uri=~s/^\///;
-    $request=new HTTP::Request('GET','http://'.$hostname{&homeserver($cnum,$cdom)}.'/raw/'.$uri);
+    $request=new HTTP::Request('GET','http://'.&hostname(&homeserver($cnum,$cdom)).'/raw/'.$uri);
     my $response=$ua->request($request,$transferfile);
 # did it work?
     if ($response->is_error()) {
@@ -7309,7 +7309,7 @@
     if ($udom && $uname && $file) {
 	$file=~s|(\?\.*)*$||;
         &appenv("userfile.$udom/$uname/$file" => $env{'request.course.id'});
-        return 'http://'.$hostname{ &homeserver($uname,$udom)}.'/'.$uri.
+        return 'http://'.&hostname(&homeserver($uname,$udom)).'/'.$uri.
                (($uri=~/\?/)?'&':'?').'token='.$token.
                                '&tokenissued='.$perlvar{'lonHostID'};
     } else {
@@ -7324,7 +7324,7 @@
 sub getuploaded {
     my ($reqtype,$uri,$cdom,$cnum,$info,$rtncode) = @_;
     $uri=~s/^\///;
-    $uri = 'http://'.$hostname{ &homeserver($cnum,$cdom)}.'/raw/'.$uri;
+    $uri = 'http://'.&hostname(&homeserver($cnum,$cdom)).'/raw/'.$uri;
     my $ua=new LWP::UserAgent;
     my $request=new HTTP::Request($reqtype,$uri);
     my $response=$ua->request($request);
@@ -7414,8 +7414,9 @@
 }
 
 sub current_machine_domains {
-    my $hostname=$hostname{$perlvar{'lonHostID'}};
+    my $hostname=&hostname($perlvar{'lonHostID'});
     my @domains;
+    my %hostname = &all_hostnames();
     while( my($id, $name) = each(%hostname)) {
 #	&logthis("-$id-$name-$hostname-");
 	if ($hostname eq $name) {
@@ -7426,8 +7427,9 @@
 }
 
 sub current_machine_ids {
-    my $hostname=$hostname{$perlvar{'lonHostID'}};
+    my $hostname=&hostname($perlvar{'lonHostID'});
     my @ids;
+    my %hostname = &all_hostnames();
     while( my($id, $name) = each(%hostname)) {
 #	&logthis("-$id-$name-$hostname-");
 	if ($hostname eq $name) {
@@ -7605,6 +7607,7 @@
 
 # ------------------------------------------------------------- Read hosts file
 {
+    my %hostname;
     open(my $config,"<$perlvar{'lonTabDir'}/hosts.tab");
 
     while (my $configline=<$config>) {
@@ -7621,11 +7624,20 @@
     close($config);
     # FIXME: dev server don't want this, production servers _do_ want this
     #&get_iphost();
+
+    sub hostname {
+	my ($lonid) = @_;
+	return $hostname{$lonid};
+    }
+    sub all_hostnames {
+	return %hostname;
+    }
 }
 
 sub get_iphost {
     if (%iphost) { return %iphost; }
     my %name_to_ip;
+    my %hostname = &all_hostnames();
     foreach my $id (keys(%hostname)) {
 	my $name=$hostname{$id};
 	my $ip;
Index: loncom/auth/lonlogin.pm
diff -u loncom/auth/lonlogin.pm:1.87 loncom/auth/lonlogin.pm:1.88
--- loncom/auth/lonlogin.pm:1.87	Sat Jan 13 21:00:04 2007
+++ loncom/auth/lonlogin.pm	Fri Mar  2 18:17:48 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Login Screen
 #
-# $Id: lonlogin.pm,v 1.87 2007/01/14 02:00:04 raeburn Exp $
+# $Id: lonlogin.pm,v 1.88 2007/03/02 23:17:48 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -138,7 +138,7 @@
     my $include = $r->dir_config('lonIncludes');
     my $expire  = $r->dir_config('lonExpire');
     my $version = $r->dir_config('lonVersion');
-    my $host_name = $Apache::lonnet::hostname{$lonhost};
+    my $host_name = &Apache::lonnet::hostname($lonhost);
 
 # --------------------------------------------- Default values for login fields
 
@@ -200,33 +200,36 @@
 	my $last;
         foreach my $hostid (sort
 			    {
-				$Apache::lonnet::hostname{$a} cmp
-				    $Apache::lonnet::hostname{$b};
+				&Apache::lonnet::hostname($a) cmp
+				    &Apache::lonnet::hostname($b);
 			    }
 			    keys(%Apache::lonnet::spareid)) {
             next if ($hostid eq $lonhost);
-            next if ($last eq $Apache::lonnet::hostname{$hostid});
+	    my $hostname = &Apache::lonnet::hostname($hostid);
+	    next if ($last eq $hostname);
             $spares.='<br /><font size="+1"><a href="http://'.
-                $Apache::lonnet::hostname{$hostid}.
+                $hostname.
                 '/adm/login?domain='.$authdomain.'">'.
-                $Apache::lonnet::hostname{$hostid}.'</a>'.
+                $hostname.'</a>'.
                 ' (preferred)</font>'.$/;
-	    $last=$Apache::lonnet::hostname{$hostid};
+	    $last=$hostname;
         }
         $spares.= '<br />';
+	my %all_hostnames = &Apache::lonnet::all_hostnames();
         foreach my $hostid (sort
 			    {
-				$Apache::lonnet::hostname{$a} cmp
-				    $Apache::lonnet::hostname{$b};
+				&Apache::lonnet::hostname($a) cmp
+				    &Apache::lonnet::hostname($b);
 			    }
-			    keys(%Apache::lonnet::hostname)) {
+			    keys(%all_hostnames)) {
             next if ($hostid eq $lonhost || $Apache::lonnet::spareid{$hostid});
-            next if ($last eq $Apache::lonnet::hostname{$hostid});
+	    my $hostname = &Apache::lonnet::hostname($hostid);
+            next if ($last eq $hostname);
             $spares.='<br /><a href="http://'.
-                $Apache::lonnet::hostname{$hostid}.
+                $hostname.
                 '/adm/login?domain='.$authdomain.'">'.
-                $Apache::lonnet::hostname{$hostid}.'</a>';
-	    $last=$Apache::lonnet::hostname{$hostid};
+                $hostname.'</a>';
+	    $last=$hostname;
         }
 	$r->print(<<ENDTROUBLE);
 <html>
Index: loncom/auth/lonroles.pm
diff -u loncom/auth/lonroles.pm:1.175 loncom/auth/lonroles.pm:1.176
--- loncom/auth/lonroles.pm:1.175	Wed Dec 20 15:46:18 2006
+++ loncom/auth/lonroles.pm	Fri Mar  2 18:17:48 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # User Roles Screen
 #
-# $Id: lonroles.pm,v 1.175 2006/12/20 20:46:18 albertel Exp $
+# $Id: lonroles.pm,v 1.176 2007/03/02 23:17:48 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -445,8 +445,8 @@
     } else {
         if ($advanced) {
 	    $r->print(&mt("Your home server is ").
-		      $Apache::lonnet::hostname{&Apache::lonnet::homeserver
-                      ($env{'user.name'},$env{'user.domain'})}.
+		      &Apache::lonnet::hostname(&Apache::lonnet::homeserver
+                      ($env{'user.name'},$env{'user.domain'})).
 		      "<br />\n");
 	    $r->print(&mt(
       "Author and Co-Author roles are not available on servers other than their respective home servers."));
@@ -546,7 +546,7 @@
                         $switchserver='otherserver='.$home.'&role='.$trolecode;
                     }
                     #next if ($home eq 'no_host');
-                    $home = $Apache::lonnet::hostname{$home};
+                    $home = &Apache::lonnet::hostname($home);
                     $ttype='Construction Space';
                     $twhere=&mt('User').': '.$trest.'<br />'.&mt('Domain').
 			': '.$tdom.'<br />'.
@@ -566,7 +566,7 @@
                         $switchserver='otherserver='.$home.'&role='.$trolecode;
                     }
                     #next if ($home eq 'no_host');
-                    $home = $Apache::lonnet::hostname{$home};
+                    $home = &Apache::lonnet::hostname($home);
                     $ttype='Construction Space';
                     $twhere=&mt('Domain').': '.$tdom.'<br />'.&mt('Server').
 			':&nbsp;'.$home;
Index: loncom/auth/switchserver.pm
diff -u loncom/auth/switchserver.pm:1.12 loncom/auth/switchserver.pm:1.13
--- loncom/auth/switchserver.pm:1.12	Thu Mar  1 18:14:12 2007
+++ loncom/auth/switchserver.pm	Fri Mar  2 18:17:48 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Switch Servers Handler
 #
-# $Id: switchserver.pm,v 1.12 2007/03/01 23:14:12 albertel Exp $
+# $Id: switchserver.pm,v 1.13 2007/03/02 23:17:48 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -68,10 +68,10 @@
     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
 					    ['otherserver','role']);
 
-    my $switch_to=$Apache::lonnet::hostname{$env{'form.otherserver'}};
+    my $switch_to=&Apache::lonnet::hostname($env{'form.otherserver'});
     if (!$env{'form.otherserver'}) {
 	$env{'form.otherserver'}=&Apache::lonnet::spareserver(30000,undef,1);
-	$switch_to=$Apache::lonnet::hostname{$env{'form.otherserver'}};
+	$switch_to=&Apache::lonnet::hostname($env{'form.otherserver'});
     }
 
     if (!defined($switch_to)) { return FORBIDDEN; }
Index: loncom/auth/lonracc.pm
diff -u loncom/auth/lonracc.pm:1.20 loncom/auth/lonracc.pm:1.21
--- loncom/auth/lonracc.pm:1.20	Thu Feb  1 02:13:04 2007
+++ loncom/auth/lonracc.pm	Fri Mar  2 18:17:48 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Access Handler for File Transfers
 #
-# $Id: lonracc.pm,v 1.20 2007/02/01 07:13:04 albertel Exp $
+# $Id: lonracc.pm,v 1.21 2007/03/02 23:17:48 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -39,7 +39,7 @@
 
     return 0 if (!-e "$filename.subscription");
 
-    my $hostname=$Apache::lonnet::hostname{$id};
+    my $hostname=&Apache::lonnet::hostname($id);
     my (undef,undef,undef,undef,$ip) = gethostbyname($hostname);
     
     return 0 if (length($ip) != 4);
Index: loncom/auth/lontokacc.pm
diff -u loncom/auth/lontokacc.pm:1.16 loncom/auth/lontokacc.pm:1.17
--- loncom/auth/lontokacc.pm:1.16	Tue Feb  7 14:46:26 2006
+++ loncom/auth/lontokacc.pm	Fri Mar  2 18:17:48 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Access Handler for User File Transfers
 #
-# $Id: lontokacc.pm,v 1.16 2006/02/07 19:46:26 albertel Exp $
+# $Id: lontokacc.pm,v 1.17 2007/03/02 23:17:48 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -59,7 +59,7 @@
 	   $readline=~s/\s*$//;
 	   my ($id,$domain,$role,$name)=split(/:/,$readline);
 	   foreach my $hostid (@{$hostids}) {
-	       my $hostname=$Apache::lonnet::hostname{$hostid};
+	       my $hostname=&Apache::lonnet::hostname($hostid);
 	       if ($name =~ /^\Q$hostname\E$/i) {
 		   return OK; 
 	       }
Index: loncom/interface/lonsyllabus.pm
diff -u loncom/interface/lonsyllabus.pm:1.56 loncom/interface/lonsyllabus.pm:1.57
--- loncom/interface/lonsyllabus.pm:1.56	Mon Oct 23 16:25:45 2006
+++ loncom/interface/lonsyllabus.pm	Fri Mar  2 18:17:58 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Syllabus
 #
-# $Id: lonsyllabus.pm,v 1.56 2006/10/23 20:25:45 banghart Exp $
+# $Id: lonsyllabus.pm,v 1.57 2007/03/02 23:17:58 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -192,7 +192,7 @@
           $r->print('<p>'.
 &Apache::loncommon::help_open_topic('Uploaded_Templates_TextBoxes','Help with filling in text boxes').'</p><p>'.&mt('This syllabus can be publicly viewed at')
 		    .' <tt>http://'.
-		    $Apache::lonnet::hostname{$homeserver}.$r->uri.'</tt>'.
+		    &Apache::lonnet::hostname($homeserver).$r->uri.'</tt>'.
                &Apache::loncommon::help_open_topic('Syllabus_ExtLink').'</p>'.
           '<p>'.&mt('You can specify an external URL as Syllabus in the [_1].','<a href="/adm/parmset?action=crsenv">'.&mt('Course Parameters').'</a>').'</p>'.
 	  '<p><a href="'.$r->uri.'?forcestudent=1"><font size="+1">'.
@@ -225,9 +225,10 @@
 			  my $host = $1;
                           my $remainder=$2;
 # remove the hostname from internal URLs
-		          foreach my $possible_host (keys(%Apache::lonnet::hostname)) {
-                              if ($possible_host =~
-				     /\Q$Apache::lonnet::hostname{$host}\E/i) {
+			  my $hostname = &Apache::lonnet::hostname($host);
+			  my %all_hostnames = &Apache::lonnet::all_hostnames();
+		          foreach my $possible_host (keys(%all_hostnames)) {
+                              if ($possible_host =~ /\Q$hostname\E/i) {
 			         $url=$remainder;
 			      }
 		          }
Index: loncom/interface/lonannounce.pm
diff -u loncom/interface/lonannounce.pm:1.65 loncom/interface/lonannounce.pm:1.66
--- loncom/interface/lonannounce.pm:1.65	Wed Dec 20 17:36:17 2006
+++ loncom/interface/lonannounce.pm	Fri Mar  2 18:17:58 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Announce
 #
-# $Id: lonannounce.pm,v 1.65 2006/12/20 22:36:17 albertel Exp $
+# $Id: lonannounce.pm,v 1.66 2007/03/02 23:17:58 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -497,11 +497,12 @@
 Check machines:<br />
 SERVERANNOUNCE
 # list servers
-    foreach my $host (sort(keys(%Apache::lonnet::hostname))) {
+    my %hostname = &Apache::lonnet::all_hostnames();
+    foreach my $host (sort(keys(%hostname))) {
 	if (&Apache::lonnet::allowed('psa',$Apache::lonnet::hostdom{$host})) {
 	    $r->print ('<br /><label><input type="checkbox" name="postto_'.$host.'" /> '.
-		       $host.' <tt>'.$Apache::lonnet::hostname{$host}.'</tt> '.
-		       '</label><a href="http://'.$Apache::lonnet::hostname{$host}.
+		       $host.' <tt>'.$hostname{$host}.'</tt> '.
+		       '</label><a href="http://'.$hostname{$host}.
 		       '/announcement.txt" target="annowin">current</a>');
 	}
     }
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.510 loncom/interface/loncommon.pm:1.511
--- loncom/interface/loncommon.pm:1.510	Wed Feb 28 21:33:04 2007
+++ loncom/interface/loncommon.pm	Fri Mar  2 18:17:58 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.510 2007/03/01 02:33:04 albertel Exp $
+# $Id: loncommon.pm,v 1.511 2007/03/02 23:17:58 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1489,7 +1489,7 @@
     my %library_servers;
     foreach my $hostid (keys(%Apache::lonnet::libserv)) {
         if ($Apache::lonnet::hostdom{$hostid} eq $domain) {
-            $library_servers{$hostid} = $Apache::lonnet::hostname{$hostid};
+            $library_servers{$hostid} = &Apache::lonnet::hostname($hostid);
         }
     }
     return %library_servers;
Index: loncom/interface/lonindexer.pm
diff -u loncom/interface/lonindexer.pm:1.156 loncom/interface/lonindexer.pm:1.157
--- loncom/interface/lonindexer.pm:1.156	Tue Jan 16 16:20:57 2007
+++ loncom/interface/lonindexer.pm	Fri Mar  2 18:17:59 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Directory Indexer
 #
-# $Id: lonindexer.pm,v 1.156 2007/01/16 21:20:57 albertel Exp $
+# $Id: lonindexer.pm,v 1.157 2007/03/02 23:17:59 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1203,7 +1203,7 @@
        $output='<img alt="'.&mt('Preview').'" src="'.$filelink.'" />';
     } elsif ($filelink=~m{^/res/($match_domain)/($match_username)/}) {
        $output='<img  alt="'.&mt('Preview').'" src="http://'.
-                 $Apache::lonnet::hostname{&Apache::lonnet::homeserver($2,$1)}.
+                 &Apache::lonnet::hostname(&Apache::lonnet::homeserver($2,$1)).
                  '/cgi-bin/thumbnail.gif?url='.$filelink.'" />';
     }
     return $output;
Index: loncom/interface/lonmsg.pm
diff -u loncom/interface/lonmsg.pm:1.197 loncom/interface/lonmsg.pm:1.198
--- loncom/interface/lonmsg.pm:1.197	Thu Feb 22 19:39:31 2007
+++ loncom/interface/lonmsg.pm	Fri Mar  2 18:17:59 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Routines for messaging
 #
-# $Id: lonmsg.pm,v 1.197 2007/02/23 00:39:31 albertel Exp $
+# $Id: lonmsg.pm,v 1.198 2007/03/02 23:17:59 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -256,7 +256,7 @@
     $text=~s/\&gt\;/\>/gs;
     $text=~s/\<\/*[^\>]+\>//gs;
     my $url='http://'.
-      $Apache::lonnet::hostname{&Apache::lonnet::homeserver($touname,$toudom)}.
+	&Apache::lonnet::hostname(&Apache::lonnet::homeserver($touname,$toudom)).
       '/adm/email?username='.$touname.'&domain='.$toudom;
     my ($sendtime,$shortsubj,$fromname,$fromdomain,$status,$fromcid,
         $symb,$error) = &Apache::lonmsg::unpackmsgid($msgid);
Index: loncom/publisher/lonpublisher.pm
diff -u loncom/publisher/lonpublisher.pm:1.220 loncom/publisher/lonpublisher.pm:1.221
--- loncom/publisher/lonpublisher.pm:1.220	Wed Feb 21 16:01:59 2007
+++ loncom/publisher/lonpublisher.pm	Fri Mar  2 18:18:19 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Publication Handler
 #
-# $Id: lonpublisher.pm,v 1.220 2007/02/21 21:01:59 albertel Exp $
+# $Id: lonpublisher.pm,v 1.221 2007/03/02 23:18:19 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -410,10 +410,11 @@
     #internal document links need no fixing
     if ($url =~ /^\#/) { return $url; } 
     my ($host)=($url=~/(?:(?:http|https|ftp)\:\/\/)*([^\/]+)/);
-    foreach (values %Apache::lonnet::hostname) {
-	if ($_ eq $host) {
+    my %all_hostnames = &Apache::lonnet::all_hostnames();
+    foreach my $hostname (values(%all_hostnames)) {
+	if ($hostname eq $host) {
 	    $url=~s/^(?:http|https|ftp)\:\/\///;
-            $url=~s/^$host//;
+            $url=~s/^\Q$host\E//;
         }
     }
     if ($url=~/^(?:http|https|ftp)\:\/\//) { return $url; }
Index: loncom/publisher/lonunauthorized.pm
diff -u loncom/publisher/lonunauthorized.pm:1.6 loncom/publisher/lonunauthorized.pm:1.7
--- loncom/publisher/lonunauthorized.pm:1.6	Wed Dec  6 17:22:39 2006
+++ loncom/publisher/lonunauthorized.pm	Fri Mar  2 18:18:19 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Unauthorized to access construction space
 #
-# $Id: lonunauthorized.pm,v 1.6 2006/12/06 22:22:39 albertel Exp $
+# $Id: lonunauthorized.pm,v 1.7 2007/03/02 23:18:19 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -60,7 +60,7 @@
         my $ownerhome=&Apache::lonnet::homeserver($ownername,$ownerdomain);
         unless ($ownerhome eq 'no_host') {
 	    $r->print(
- "<p>".&mt('Please log into')." <tt>".$Apache::lonnet::hostname{$ownerhome}.
+ "<p>".&mt('Please log into')." <tt>".&Apache::lonnet::hostname($ownerhome).
  "</tt> ".&mt('to edit.')."</p>");
         }
     } else {

--albertel1172877499--