summaryrefslogtreecommitdiffstats
path: root/krb5-1.4.1-telnet-environ.patch
blob: 05da88bdff307fb34abefb5c0668adeee6d7a011 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
Port of fixes originally made to the NetKit telnet client.

Previous behavior:
  Well-defined or exported variables are sent to the server on initial connect.
  The "environ list" command prints "*" before these variable names.
  Other variables are sent to the server if it requests them.
  The "environ list" command prints " " before these variable names.
New behavior:
  Well-defined variables are sent to the server on initial connect.
  The "environ list" command prints "*" before these variable names.
  Exported variables are sent to the server on initial connect.
  The "environ list" command prints "+" before these variable names.
  Other variables are NOT sent to the server.
  The "environ list" command prints " " before these variable names.

diff -uNr krb5-1.4.1/src/appl/telnet/telnet/authenc.c krb5-1.4.1/src/appl/telnet/telnet/authenc.c
--- krb5-1.4.1/src/appl/telnet/telnet/authenc.c	2002-11-15 15:21:34.000000000 -0500
+++ krb5-1.4.1/src/appl/telnet/telnet/authenc.c	2005-06-29 21:06:39.000000000 -0400
@@ -83,13 +83,6 @@
 }
 
 	char *
-telnet_getenv(val)
-	char *val;
-{
-	return((char *)env_getvalue((unsigned char *)val));
-}
-
-	char *
 telnet_gets(tprompt, result, length, echo)
 	char *tprompt;
 	char *result;
diff -uNr krb5-1.4.1/src/appl/telnet/telnet/commands.c krb5-1.4.1/src/appl/telnet/telnet/commands.c
--- krb5-1.4.1/src/appl/telnet/telnet/commands.c	2005-04-07 17:17:26.000000000 -0400
+++ krb5-1.4.1/src/appl/telnet/telnet/commands.c	2005-06-29 21:11:34.000000000 -0400
@@ -1889,8 +1889,9 @@
 	register struct env_lst *ep;
 
 	for (ep = envlisthead.next; ep; ep = ep->next) {
-		printf("%c %-20s %s\r\n", ep->export ? '*' : ' ',
-					ep->var, ep->value);
+		printf("%c %-20s %s\r\n",
+		       " +*"[(ep->welldefined ? 2 : (ep->export > 0))],
+		       ep->var, ep->value);
 	}
 }
 
@@ -1914,13 +1915,15 @@
 }
 
 	unsigned char *
-env_getvalue(var)
+env_getvalue(var, export_only)
 	unsigned char *var;
+	int export_only;
 {
 	register struct env_lst *ep;
 
 	if ((ep = env_find(var)))
-		return(ep->value);
+		if (ep->export || !export_only)
+			return(ep->value);
 	return(NULL);
 }
 
diff -uNr krb5-1.4.1/src/appl/telnet/telnet/externs.h krb5-1.4.1/src/appl/telnet/telnet/externs.h
--- krb5-1.4.1/src/appl/telnet/telnet/externs.h	2003-04-23 23:27:56.000000000 -0400
+++ krb5-1.4.1/src/appl/telnet/telnet/externs.h	2005-06-29 21:05:16.000000000 -0400
@@ -347,7 +347,7 @@
 
 extern unsigned char
     *env_default (int, int),
-    *env_getvalue (unsigned char *);
+    *env_getvalue (unsigned char *, int);
 
 extern int
     env_is_exported (unsigned char *);
diff -uNr krb5-1.4.1/src/appl/telnet/telnet/telnet.c krb5-1.4.1/src/appl/telnet/telnet/telnet.c
--- krb5-1.4.1/src/appl/telnet/telnet/telnet.c	2005-06-29 21:13:29.000000000 -0400
+++ krb5-1.4.1/src/appl/telnet/telnet/telnet.c	2005-06-29 21:09:13.000000000 -0400
@@ -552,7 +552,7 @@
 #endif
 
 	    case TELOPT_XDISPLOC:	/* X Display location */
-		if (env_getvalue((unsigned char *)"DISPLAY") &&
+		if (env_getvalue((unsigned char *)"DISPLAY", 0) &&
 		    env_is_exported((unsigned char *)"DISPLAY"))
 		    new_state_ok = 1;
 		break;
@@ -813,7 +813,7 @@
 		resettermname = 0;
 		if (tnamep && tnamep != unknown)
 			free(tnamep);
-		if ((tname = (char *)env_getvalue((unsigned char *)"TERM")) &&
+		if ((tname = (char *)env_getvalue((unsigned char *)"TERM", 0)) &&
 				(setupterm(tname, 1, &err) == 0)) {
 			tnamep = mklist(termbuf, tname);
 		} else {
@@ -988,7 +988,7 @@
 	    unsigned char temp[50], *dp;
 	    int len;
 
-	    if (((dp = env_getvalue((unsigned char *)"DISPLAY")) == NULL) ||
+	    if (((dp = env_getvalue((unsigned char *)"DISPLAY", 0)) == NULL) ||
 		(! env_is_exported((unsigned char *)"DISPLAY"))) {
 		/*
 		 * Something happened, we no longer have a DISPLAY
@@ -1669,7 +1669,7 @@
 			env_opt_add(ep);
 		return;
 	}
-	vp = env_getvalue(ep);
+	vp = env_getvalue(ep, 1);
 	elen = 2 * (vp ? strlen((char *)vp) : 0) +
 		2 * strlen((char *)ep) + 6;
 	if ((opt_replyend - opt_replyp) < elen)
@@ -2327,7 +2327,7 @@
 	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", 0) &&
 	    env_is_exported((unsigned char *)"DISPLAY"))
 	    send_will(TELOPT_XDISPLOC, 1);
 	if (eight)
--- krb5-1.4.1/src/appl/telnet/telnetd/authenc.c	2005-06-29 21:25:09.000000000 -0400
+++ krb5-1.4.1/src/appl/telnet/telnetd/authenc.c	2005-06-29 21:25:13.000000000 -0400
@@ -67,14 +67,6 @@
 }
 
 	char *
-telnet_getenv(val)
-	char *val;
-{
-	extern char *getenv();
-	return(getenv(val));
-}
-
-	char *
 telnet_gets(prompt, result, length, echo)
 	char *prompt;
 	char *result;
--- krb5-1.4.1/src/appl/telnet/telnet/telnet.1	2005-06-29 21:26:55.000000000 -0400
+++ krb5-1.4.1/src/appl/telnet/telnet/telnet.1	2005-06-29 21:29:05.000000000 -0400
@@ -401,7 +401,7 @@
 .I variable
 to have a value of
 .IR value .
-Any variables defined by this command are automatically exported.  The
+Variables defined by this command are not automatically exported.  The
 .I value
 may be enclosed in single or double quotes so that tabs and spaces may
 be included.
@@ -423,8 +423,8 @@
 .TP
 .B list
 List the current set of environment variables.  Those marked with a \&*
-will be sent automatically; other variables will only be sent if
-explicitly requested.
+will be sent automatically; those marked with a \&+ will be sent if the
+other end requests their values, and other variables will not be sent.
 .TP
 .B \&?
 Prints out help information for the