--- loncom/lonnet/perl/lonnet.pm 2004/12/22 20:34:49 1.583 +++ loncom/lonnet/perl/lonnet.pm 2004/12/30 16:07:48 1.584 @@ -1,7 +1,7 @@ # The LearningOnline Network # TCP networking package # -# $Id: lonnet.pm,v 1.583 2004/12/22 20:34:49 matthew Exp $ +# $Id: lonnet.pm,v 1.584 2004/12/30 16:07:48 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -3372,11 +3372,18 @@ sub auto_instcode_format { my $courses = ''; my $homeserver; if ($caller eq 'global') { - $homeserver = $perlvar{'lonHostID'}; + foreach my $tryserver (keys %libserv) { + if ($hostdom{$tryserver} eq $codedom) { + $homeserver = $tryserver; + last; + } + } + if (($ENV{'user.name'}) && ($ENV{'user.domain'} eq $codedom)) { + $homeserver = &homeserver($ENV{'user.name'},$codedom); + } } else { $homeserver = &homeserver($caller,$codedom); } - my $host=$hostname{$homeserver}; foreach (keys %{$instcodes}) { $courses .= &escape($_).'='.&escape($$instcodes{$_}).'&'; }