Skip Menu |
 

From jik@kamens.brookline.ma.us Tue Nov 23 16:56:25 1999
Received: from MIT.EDU (PACIFIC-CARRIER-ANNEX.MIT.EDU [18.69.0.28]) by rt-11.MIT.EDU (8.7.5/8.7.3) with SMTP id QAA02305 for <bugs@RT-11.MIT.EDU>; Tue, 23 Nov 1999 16:56:25 -0500
Received: from polaris.shore.net by MIT.EDU with SMTP
id AA06725; Tue, 23 Nov 99 16:56:57 EST
Received: from jik.shore.net [206.243.167.15]
by polaris.shore.net with esmtp (Exim)
for krb5-bugs@mit.edu
id 11qNvC-0000zo-00; Tue, 23 Nov 1999 16:56:23 -0500
Received: from jik2.kamens.brookline.ma.us (IDENT:root@jik2.kamens.brookline.ma.us [192.168.0.3])
by jik.shore.net (8.9.0/8.9.0) with ESMTP id QAA22189;
Tue, 23 Nov 1999 16:56:23 -0500
Received: (from jik@localhost)
by jik2.kamens.brookline.ma.us (8.9.3/8.9.3) id QAA21178;
Tue, 23 Nov 1999 16:57:16 -0500
Message-Id: <199911232157.QAA21178@jik2.kamens.brookline.ma.us>
Date: Tue, 23 Nov 1999 16:57:16 -0500
From: Jonathan Kamens <jik@kamens.brookline.ma.us>
Reply-To: jik@kamens.brookline.ma.us
To: krb5-bugs@MIT.EDU
Cc: jik@kamens.brookline.ma.us
Subject: Support INIT stanza in telnet config file; canonicalize DISPLAY setting
X-Send-Pr-Version: 3.99

Show quoted text
>Number: 789
>Category: telnet
>Synopsis: Support INIT stanza in telnet config file; canonicalize DISPLAY setting
>Confidential: yes
>Severity: non-critical
>Priority: medium
>Responsible: hartmans
>State: open
>Class: sw-bug
>Submitter-Id: unknown
>Arrival-Date: Tue Nov 23 16:57:00 EST 1999
>Last-Modified:
>Originator: Jonathan Kamens
>Organization:

Show quoted text
>Release: krb5-1.1
>Environment:

System: Linux jik2 2.2.12-20 #14 Thu Nov 18 20:57:02 EST 1999 i686 unknown
Architecture: i686

Show quoted text
>Description:
The patches below contain two bug fixes and one enhancement
(sorry for bundling them all together, but that's how they are
in my tree and I don't have time to split them up; it
shouldn't be difficult for you to to do if you think it's
necessary):

1) Check the return value of gethostname() when using it to
determine what to send to the remost host as the DISPLAY
environment variable setting.

2) Canonicalize the DISPLAY setting, if possible, so that it
will be correct even when someone uses telnet to connect to a
host in a different domain.

3) Support an INIT stanza in the telnet RC file

Show quoted text
>How-To-Repeat:

Show quoted text
>Fix:
Index: ./src/appl/telnet/telnet/commands.c
--- commands.c 1999/11/23 19:51:09 1.1.1.1
+++ commands.c 1999/11/23 19:51:47 1.3
@@ -1727,12 +1727,19 @@
char hbuf[256+1];
char *cp2 = strchr((char *)ep->value, ':');

- 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;
+ if (gethostname(hbuf, 256) == 0) {
+ struct hostent *host;
+
+ 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
@@ -2835,6 +2842,11 @@
return 0;
}

+void init_cmdrc()
+{
+ cmdrc("INIT", "INITIALIZE");
+}
+
static char *rcname = 0;
static char rcbuf[128];

@@ -2907,7 +2919,7 @@
continue;
}
/*
- * This should never happen...
+ * This can happen in the INIT stanza
*/
if (c->needconnect && !connected) {
printf("?Need to be connected first for %s.\r\n", margv[0]);
Index: ./src/appl/telnet/telnet/externs.h
--- externs.h 1999/11/23 19:51:09 1.1.1.1
+++ externs.h 1999/11/23 19:51:47 1.3
@@ -256,6 +256,7 @@

extern void
command P((int, char *, int)),
+ init_cmdrc P((void)),
Dump P((int, unsigned char *, int)),
init_3270 P((void)),
printoption P((char *, int, int)),
Index: ./src/appl/telnet/telnet/main.c
--- main.c 1999/11/23 19:51:09 1.1.1.1
+++ main.c 1999/11/23 19:51:47 1.3
@@ -71,6 +71,8 @@
#if defined(TN3270)
init_3270();
#endif
+
+ init_cmdrc();
}

void
Show quoted text
>Audit-Trail:
>Unformatted: