From owner-ports-jp@jp.freebsd.org  Wed Jun 10 16:52:03 1998
Received: (from daemon@localhost)
	by jaz.jp.freebsd.org (8.8.8+3.0Wbeta13/8.7.3) id QAA21120;
	Wed, 10 Jun 1998 16:52:03 +0900 (JST)
	(envelope-from owner-ports-jp@jp.FreeBSD.org)
Received: from spa.kuis.kyoto-u.ac.jp (root@lab4imgw.kuis.kyoto-u.ac.jp [130.54.23.230])
	by jaz.jp.freebsd.org (8.8.8+3.0Wbeta13/8.7.3) with ESMTP id QAA21111
	for <ports-jp@jp.freebsd.org>; Wed, 10 Jun 1998 16:52:01 +0900 (JST)
	(envelope-from shige@kuis.kyoto-u.ac.jp)
Received: from localhost (unaduki.kuis.kyoto-u.ac.jp [130.54.22.157])
	by spa.kuis.kyoto-u.ac.jp (8.8.8/3.6Wspa) with ESMTP id QAA01527;
	Wed, 10 Jun 1998 16:51:36 +0900 (JST)
To: ports-jp@jp.freebsd.org
Cc: shige@kuis.kyoto-u.ac.jp
In-Reply-To: Your message of "Wed, 10 Jun 1998 16:26:11 +0900"
	<22898.897463571@coconut.itojun.org>
References: <22898.897463571@coconut.itojun.org>
X-Mailer: Mew version 1.92 on Emacs 20.2 / Mule 3.0 (=?iso-2022-jp?B?GyRCOUhNVTJsGyhC?=)
X-Prom-Mew: Prom-Mew 1.92 (procmail reader for Mew)
X-URL: http://www.yuasa.kuis.kyoto-u.ac.jp/~shige/
X-fingerprint: C8 BD 6A A7 CF FF 74 88  A4 B2 CC 5F C7 61 5C 9A
X-Pgp-Public-Key-URL: http://pgp5.ai.mit.edu:11371/pks/lookup?op=get&search=0x56B99BF9
Mime-Version: 1.0
X-Face: 34/1@t8]M!wP}sAw$~XQMzl5'O=lCIM]8=_8CE,|S)Vs4Wy@tU~A'wRi\lgWh-o&'|:zg<S
 g%%4BRt%M~>>Gc?0?{^jo8(|5'Tg`yBH81.:!N9tSq*Sp6>C0q@{|&+FaM;R;KkoW1jA?QIWQ3:gNq
 {O%`:ww
Content-Type: Text/Plain; charset=iso-2022-jp
Content-Transfer-Encoding: 7bit
Message-Id: <19980610165158K.shige@kuis.kyoto-u.ac.jp>
Date: Wed, 10 Jun 1998 16:51:58 +0900 (JST)
From: Shigeyuki FUKUSHIMA <shige@kuis.kyoto-u.ac.jp>
X-Dispatcher: imput version 971024
Lines: 91
Reply-To: ports-jp@jp.freebsd.org
Precedence: bulk
X-Distribute: distribute [version 2.1 (Alpha) patchlevel=24]
X-Sequence: ports-jp 3473
Subject: [ports-jp 3473] Re: ssh-1.2.23 port 
Errors-To: owner-ports-jp@jp.freebsd.org
Sender: owner-ports-jp@jp.freebsd.org

 From: Jun-ichiro itojun Itoh <itojun@iijlab.net>
 Date: Wed, 10 Jun 1998 16:26:11 +0900
 Title: [ports-jp 3472] Re: ssh-1.2.23 port 
 Message-ID: <22898.897463571@coconut.itojun.org>

$BJ!Eg!w5~Bg>pJs(B $B$G$9!#(B

FreeBSD $B$N>l9g!"(B/etc/rc.conf $B$G(B FQDN $B$r=q$$$F(B hostname $B$r@_Dj(B
$B$7$F$$$k$N$G$9$,!"$3$N>l9g!"(B/usr/include/utmp.h $B$G5,Dj$5$l$F$$$k(B
HOSTNAME $B$ND9$5(B 16 $BJ8;z$r1[$($F$7$^$$!"F1$8(B LAN $BFb$N(B host $BF1;N$N(B
login $B$G$b(B utmp $B$K$O(B IP Address $B$GJ]B8$5$l$F$7$^$$$^$9$M!#(B> $B8=:_$N(B ssh-1.2.23

$B$s$G!";d$O$3$l$,7y$@$C$?$N$G!"F1$8(B LAN $BFb$G$O(B IP Address $B$G$O$J$/$F(B
hostname -s $B$7$?7k2L$r(B utmp $B$K;D$7$?$$$H;W$C$F!"0J2<$N(B patch $B$r:n$C(B
$B$?$s$G$9$,!"$3$&$$$&$3$H$r$9$k$N$C$F(B Invalid $B$J$s$G$7$g$&$+!)(B

Invalid $B$G$J$1$l$P!"(Bports $B$K2C$($F$[$7$$$J$H;W$$$^$9$,!"(B
$B$$$+$,$J$b$s$G$7$g$&!)(B

---------
$BJ!Eg(B $BLPG7(B (Shigeyuki FUKUSHIMA) <shige@kuis.kyoto-u.ac.jp>
  $B5~ETBg3XBg3X1!9)3X8&5f2J>pJs9)3X@l96(B $BEr^I8&5f<<(B
PGP Public Key:
http://pgp5.ai.mit.edu:11371/pks/lookup?op=get&search=0x56B99BF9


----- $B0J2<$,(B patch

--- canohost.c.orig	Sun Jun  7 23:51:30 1998
+++ canohost.c	Mon Jun  8 01:02:21 1998
@@ -46,6 +46,8 @@
 #include "xmalloc.h"
 #include "ssh.h"
 
+static void delete_domainname(char *);
+
 /* Return the canonical name of the host at the other end of the socket. 
    The caller should free the returned string with xfree. */
 
@@ -154,6 +156,8 @@
   }
 #endif
 
+  delete_domainname(name);
+
   return xstrdup(name);
 }
 
@@ -324,4 +328,41 @@
 
   /* Get and return the peer port number. */
   return get_peer_port(socket);
+}
+
+static void delete_domainname(char *name)
+{
+  int i, j = 0;
+  char hostname[255];
+  char domain[255];
+  
+  gethostname(hostname, 255);
+  for(i = 0 ; hostname[i] != '.' && hostname != '\0' ; i++);
+  if (hostname[i] != '\0') {
+    i++;
+    while(hostname[i] != '\0')
+      domain[j++] = hostname[i++];
+  }
+  domain[j] = '\0';
+  
+  if(strlen(domain) == 0)
+    return;
+
+  /*
+   * Check domainname of remotehost
+   *   If domainname of remotehost is identical with sshd-server's
+   *   local domain, domainname is deleted from hostname.
+   */
+  i = strlen(domain);
+  j = strlen(name);
+  while (i >= 0 && domain[i] == name[j]) {
+    i--;
+    j--;
+  }
+
+  if (i == -1) {
+    name[j] = '\0';
+  }
+
+  return;
 }

