Skip Menu |
 

Download (untitled) / with headers
text/plain 2.6KiB
From tlyu@MIT.EDU Thu Oct 10 12:56:32 1996
Received: from MIT.EDU (SOUTH-STATION-ANNEX.MIT.EDU [18.72.1.2]) by rt-11.MIT.EDU (8.7.5/8.7.3) with SMTP id MAA28977 for <bugs@RT-11.MIT.EDU>; Thu, 10 Oct 1996 12:56:32 -0400
Received: from TESLA-COIL.MIT.EDU by MIT.EDU with SMTP
id AA25052; Thu, 10 Oct 96 12:56:30 EDT
Received: by tesla-coil.MIT.EDU (5.x/4.7) id AA12300; Thu, 10 Oct 1996 12:56:28 -0400
Message-Id: <199609172112.RAA25652@jik.tiac.net>
Date: Tue, 17 Sep 1996 17:12:17 -0400
From: "Jonathan I. Kamens" <jik@jik.tiac.net>
To: krb5-bugs@MIT.EDU, kerberos@MIT.EDU
Subject: krb5b7: telnet: canonify host name when doing XDISPLOC

Show quoted text
>Number: 97
>Category: telnet
>Synopsis: krb5b7: telnet: canonify host name when doing XDISPLOC
>Confidential: yes
>Severity: serious
>Priority: medium
>Responsible: hartmans
>State: closed
>Class: sw-bug
>Submitter-Id: unknown
>Arrival-Date: Thu Oct e 12:57:04 EDT 1996
>Last-Modified: Fri Oct e 19:59:07 EDT 1996
>Originator:
>Organization:
>Release:
>Environment:
>Description:
>How-To-Repeat:
>Fix:
>Audit-Trail:

Responsible-Changed-From-To: gnats-admin->hartmans
Responsible-Changed-By: tlyu
Responsible-Changed-When: Thu Oct 10 13:04:53 1996
Responsible-Changed-Why:
refiled

State-Changed-From-To: open-closed
State-Changed-By: hartmans
State-Changed-When: Fri Oct 11 19:58:46 1996
State-Changed-Why:
Integrated before Gnats deplyment.

Show quoted text
>Unformatted:
When changing DISPLAY values of the form ":x.x" or "unix:x.x" to
"hostname:x.x" in order to send them to the remote host using the
XDISPLOC option, telnet should call gethostbyname() to fully qualify
the host name, so that it'll be valid even when connecting to a host
in a different domain.

Also, telnet should check the return value of gethostname().

Here's a diff:

--- telnet/commands.c 1996/09/17 19:56:23 1.4
+++ telnet/commands.c 1996/09/17 19:57:31 1.5
@@ -1719,13 +1719,21 @@
|| (strncmp((char *)ep->value, "unix:", 5) == 0))) {
char hbuf[256+1];
char *cp2 = strchr((char *)ep->value, ':');
+
+ if (gethostname(hbuf, 256) == 0) {
+ struct hostent *host;

- gethostname(hbuf, 256);
- hbuf[256] = '\0';
- cp = (char *)malloc(strlen(hbuf) + strlen(cp2) + 1);
- sprintf((char *)cp, "%s%s", hbuf, cp2);
- free(ep->value);
- ep->value = (unsigned char *)cp;
+ hbuf[256] = '\0';
+ host = gethostbyname(hbuf);
+ if (host) {
+ strncpy(hbuf, host->h_name, sizeof(hbuf));
+ hbuf[256] = '\0';
+ }
+ cp = (char *)malloc(strlen(hbuf) + strlen(cp2) + 1);
+ sprintf((char *)cp, "%s%s", hbuf, cp2);
+ free(ep->value);
+ ep->value = (unsigned char *)cp;
+ }
}
/*
* If USER is not defined, but LOGNAME is, then add