summaryrefslogtreecommitdiff
path: root/usr/src/cmd/ssh/libssh/common/channels.c
diff options
context:
space:
mode:
authorjp161948 <none@none>2007-08-20 13:43:28 -0700
committerjp161948 <none@none>2007-08-20 13:43:28 -0700
commit383a1232abf6ee8c176a61ee5268f51bb9840224 (patch)
treeb3c05da23ff3f0c1dfdd40b4e52a4835e1efb03c /usr/src/cmd/ssh/libssh/common/channels.c
parent02b636c64ad657301ef5f5e6c2d14c6bec693fff (diff)
downloadillumos-gate-383a1232abf6ee8c176a61ee5268f51bb9840224.tar.gz
PSARC/2007/034 ssh/sshd resync with OpenSSH
6472998 implement untrusted X11 forwarding in ssh(1)
Diffstat (limited to 'usr/src/cmd/ssh/libssh/common/channels.c')
-rw-r--r--usr/src/cmd/ssh/libssh/common/channels.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/usr/src/cmd/ssh/libssh/common/channels.c b/usr/src/cmd/ssh/libssh/common/channels.c
index 5980c6ca89..78c5a72f1f 100644
--- a/usr/src/cmd/ssh/libssh/common/channels.c
+++ b/usr/src/cmd/ssh/libssh/common/channels.c
@@ -127,7 +127,7 @@ static u_int x11_saved_data_len = 0;
* Fake X11 authentication data. This is what the server will be sending us;
* we should replace any occurrences of this by the real data.
*/
-static char *x11_fake_data = NULL;
+static u_char *x11_fake_data = NULL;
static u_int x11_fake_data_len;
@@ -2791,19 +2791,19 @@ deny_input_open(int type, u_int32_t seq, void *ctxt)
* This should be called in the client only.
*/
void
-x11_request_forwarding_with_spoofing(int client_session_id,
+x11_request_forwarding_with_spoofing(int client_session_id, const char *disp,
const char *proto, const char *data)
{
u_int data_len = (u_int) strlen(data) / 2;
- u_int i, value, len;
+ u_int i, value;
char *new_data;
int screen_number;
const char *cp;
u_int32_t rand = 0;
- cp = getenv("DISPLAY");
- if (cp)
- cp = strchr(cp, ':');
+ cp = disp;
+ if (disp)
+ cp = strchr(disp, ':');
if (cp)
cp = strchr(cp, '.');
if (cp)
@@ -2833,11 +2833,7 @@ x11_request_forwarding_with_spoofing(int client_session_id,
x11_fake_data_len = data_len;
/* Convert the fake data into hex. */
- len = 2 * data_len + 1;
- new_data = xmalloc(len);
- for (i = 0; i < data_len; i++)
- snprintf(new_data + 2 * i, len - 2 * i,
- "%02x", (u_char) x11_fake_data[i]);
+ new_data = tohex(x11_fake_data, data_len);
/* Send the request packet. */
if (compat20) {