From: Sam Hartman Date: Sat, 21 Sep 1996 09:27:45 +0000 (+0000) Subject: Check in all of jik's patches besides the forward command X-Git-Tag: krb5-1.0-freeze1~320 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=3b2ff8b6e6733d9f4bb0ef17e2a7ee05c5549431;p=krb5.git Check in all of jik's patches besides the forward command and init stanza. I think that as a low-priority fix, someone should rewrite the posix_signals stuff in sys_bsd.c to be more consistent with the rest of the code; it is correct but in a different style. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@9102 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/appl/telnet/telnet/ChangeLog b/src/appl/telnet/telnet/ChangeLog index 78a4d41bb..91cbb7d57 100644 --- a/src/appl/telnet/telnet/ChangeLog +++ b/src/appl/telnet/telnet/ChangeLog @@ -1,3 +1,15 @@ +Sat Sep 21 03:47:46 1996 Sam Hartman + + * telnet.c (telnet): Only support XDISPLOC if DISPLAY is supported, thanks to jik. + + * commands.c (tn): Save away arguments before memory used by other + functions. Patch thanks to jik. + (env_init): Cannonify DISPLAY; patch thanks to jik. + + * sys_bsd.c: Use POSIX_SIGNALS when available. This patch is + contribued by jik. It could be cleaned up a bit to be more + consistent with Kerberos style, but is functionally correct. + Tue Sep 10 14:09:49 1996 Tom Yu * telnet.1: remove ".so man1/header.doc" diff --git a/src/appl/telnet/telnet/commands.c b/src/appl/telnet/telnet/commands.c index dd00a7498..52209d319 100644 --- a/src/appl/telnet/telnet/commands.c +++ b/src/appl/telnet/telnet/commands.c @@ -1872,6 +1872,17 @@ env_getvalue(var) return(NULL); } + int +env_is_exported(var) + unsigned char *var; +{ + register struct env_lst *ep; + + if ((ep = env_find(var))) + return ep->export; + return 0; +} + #if defined(OLD_ENVIRON) && defined(ENV_HACK) void env_varval(what) @@ -2436,7 +2447,13 @@ tn(argc, argv) auth_encrypt_connect(connected); #endif /* defined(AUTHENTICATION) || defined(ENCRYPTION) */ } while (connected == 0); + if (user) + user = strdup(user); + if (hostp) + hostp = strdup(hostp); cmdrc(hostp, hostname); + if (hostp) + free(hostp); if (autologin && user == NULL) { struct passwd *pw; @@ -2448,6 +2465,8 @@ tn(argc, argv) else user = NULL; } + if (user) + user = strdup(user); } if (user) { env_define((unsigned char *)"USER", (unsigned char *)user); @@ -2456,6 +2475,8 @@ tn(argc, argv) (void) call(status, "status", "notmuch", 0); if (setjmp(peerdied) == 0) telnet(user); + if (user) + free(user); (void) NetClose(net); ExitString("Connection closed by foreign host.\r\n",1); /*NOTREACHED*/ diff --git a/src/appl/telnet/telnet/externs.h b/src/appl/telnet/telnet/externs.h index fae1d5d2e..40f5e4935 100644 --- a/src/appl/telnet/telnet/externs.h +++ b/src/appl/telnet/telnet/externs.h @@ -313,6 +313,9 @@ extern unsigned char *env_default P((int, int)), *env_getvalue P((unsigned char *)); +extern int + env_is_exported P((unsigned char *)); + extern int get_status P((void)), dosynch P((void)); diff --git a/src/appl/telnet/telnet/sys_bsd.c b/src/appl/telnet/telnet/sys_bsd.c index 2e52986f0..dbbb9078e 100644 --- a/src/appl/telnet/telnet/sys_bsd.c +++ b/src/appl/telnet/telnet/sys_bsd.c @@ -47,6 +47,9 @@ #include #endif #include +#ifdef POSIX_SIGNALS +#include +#endif /* POSIX_SIGNALS */ #include #include @@ -68,6 +71,30 @@ extern SIG_FUNC_RET ayt_status(); #endif +#ifdef POSIX_SIGNALS +static struct sigaction new_sa_rec, old_sa_rec; + +#ifdef SA_INTERRUPT +#define SIGACTION_INTERRUPT SA_INTERRUPT +#else +#define SIGACTION_INTERRUPT 0 +#endif + +#ifdef SA_NOMASK +#define SIGACTION_NOMASK SA_NOMASK +#else +#define SIGACTION_NOMASK 0 +#endif + +#define signal(sig, func) ((new_sa_rec.sa_handler = func), \ + sigemptyset(&new_sa_rec.sa_mask), \ + (new_sa_rec.sa_flags = SIGACTION_INTERRUPT | \ + SIGACTION_NOMASK), \ + sigaction(sig, &new_sa_rec, &old_sa_rec), \ + old_sa_rec.sa_handler) + +#endif /* POSIX_SIGNALS */ + int tout, /* Output file descriptor */ tin, /* Input file descriptor */ diff --git a/src/appl/telnet/telnet/telnet.c b/src/appl/telnet/telnet/telnet.c index bb26be604..e89f50629 100644 --- a/src/appl/telnet/telnet/telnet.c +++ b/src/appl/telnet/telnet/telnet.c @@ -521,7 +521,8 @@ dooption(option) #endif case TELOPT_XDISPLOC: /* X Display location */ - if (env_getvalue((unsigned char *)"DISPLAY")) + if (env_getvalue((unsigned char *)"DISPLAY") && + env_is_exported((unsigned char *)"DISPLAY")) new_state_ok = 1; break; @@ -954,7 +955,8 @@ suboption() unsigned char temp[50], *dp; int len; - if ((dp = env_getvalue((unsigned char *)"DISPLAY")) == NULL) { + if (((dp = env_getvalue((unsigned char *)"DISPLAY")) == NULL) || + (! env_is_exported((unsigned char *)"DISPLAY"))) { /* * Something happened, we no longer have a DISPLAY * variable. So, turn off the option. @@ -2286,7 +2288,8 @@ telnet(user) send_will(TELOPT_LINEMODE, 1); send_will(TELOPT_NEW_ENVIRON, 1); send_do(TELOPT_STATUS, 1); - if (env_getvalue((unsigned char *)"DISPLAY")) + if (env_getvalue((unsigned char *)"DISPLAY") && + env_is_exported((unsigned char *)"DISPLAY")) send_will(TELOPT_XDISPLOC, 1); if (eight) tel_enter_binary(eight); diff --git a/src/appl/telnet/telnetd/ChangeLog b/src/appl/telnet/telnetd/ChangeLog index 98f5ceb8b..f18486b2f 100644 --- a/src/appl/telnet/telnetd/ChangeLog +++ b/src/appl/telnet/telnetd/ChangeLog @@ -1,3 +1,7 @@ +Sat Sep 21 03:38:31 1996 Sam Hartman + + * utility.c (ttloop): Continue on eintr. + Tue Sep 10 14:10:41 1996 Tom Yu * telnetd.8: remove ".so man1/header.doc" diff --git a/src/appl/telnet/telnetd/utility.c b/src/appl/telnet/telnetd/utility.c index 54d42d296..7b72e80a5 100644 --- a/src/appl/telnet/telnetd/utility.c +++ b/src/appl/telnet/telnetd/utility.c @@ -59,8 +59,11 @@ ttloop() if (nfrontp-nbackp) { netflush(); } +read_again: ncc = read(net, netibuf, sizeof netibuf); if (ncc < 0) { + if (errno == EINTR) + goto read_again; syslog(LOG_INFO, "ttloop: read: %m"); exit(1); } else if (ncc == 0) {