--- loncom/lonnet/perl/lonnet.pm	2009/03/09 03:49:17	1.989
+++ loncom/lonnet/perl/lonnet.pm	2009/03/21 21:43:46	1.992
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.989 2009/03/09 03:49:17 raeburn Exp $
+# $Id: lonnet.pm,v 1.992 2009/03/21 21:43:46 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -74,9 +74,7 @@ use strict;
 use LWP::UserAgent();
 use HTTP::Date;
 use Image::Magick;
-use IO::Socket;
 
-# use Date::Parse;
 use vars qw(%perlvar %spareid %pr %prp $memcache %packagetab $tmpdir
             $_64bit %env %protocol);
 
@@ -5951,7 +5949,7 @@ sub modifyuser {
 sub modifystudent {
     my ($udom,$uname,$uid,$umode,$upass,$first,$middle,$last,$gene,$usec,
         $end,$start,$forceid,$desiredhome,$email,$type,$locktype,$cid,
-        $selfenroll,$context)=@_;
+        $selfenroll,$context,$inststatus)=@_;
     if (!$cid) {
 	unless ($cid=$env{'request.course.id'}) {
 	    return 'not_in_class';
@@ -5960,7 +5958,7 @@ sub modifystudent {
 # --------------------------------------------------------------- Make the user
     my $reply=&modifyuser
 	($udom,$uname,$uid,$umode,$upass,$first,$middle,$last,$gene,$forceid,
-         $desiredhome,$email);
+         $desiredhome,$email,$inststatus);
     unless ($reply eq 'ok') { return $reply; }
     # This will cause &modify_student_enrollment to get the uid from the
     # students environment
@@ -9048,23 +9046,31 @@ sub get_dns {
 
 	return %iphost;
     }
-}
 
-#
-#  Given a DNS returns the loncapa host name for that DNS 
-# 
-sub host_from_dns {
-    my ($dns) = @_;
-    my @hosts;
-    my $ip;
-
-    $ip = gethostbyname($dns);	# Initial translation to IP is in net order.
-    if (length($ip) == 4) { 
-	$ip   = &IO::Socket::inet_ntoa($ip);
-	@hosts = get_hosts_from_ip($ip);
-	return $hosts[0];
+    #
+    #  Given a DNS returns the loncapa host name for that DNS 
+    # 
+    sub host_from_dns {
+        my ($dns) = @_;
+        my @hosts;
+        my $ip;
+
+        if (defined($name_to_ip{$dns})) {
+            $ip = $name_to_ip{$dns};
+        }
+        if (!$ip) {
+            $ip = gethostbyname($dns); # Initial translation to IP is in net order.
+            if (length($ip) == 4) { 
+	        $ip   = &IO::Socket::inet_ntoa($ip);
+            }
+        }
+        if ($ip) {
+	    @hosts = get_hosts_from_ip($ip);
+	    return $hosts[0];
+        }
+        return undef;
     }
-    return undef;
+
 }
 
 BEGIN {