summaryrefslogtreecommitdiff
path: root/usr/src/cmd/ssh/libssh/common/misc.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/misc.c
parent02b636c64ad657301ef5f5e6c2d14c6bec693fff (diff)
downloadillumos-joyent-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/misc.c')
-rw-r--r--usr/src/cmd/ssh/libssh/common/misc.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/usr/src/cmd/ssh/libssh/common/misc.c b/usr/src/cmd/ssh/libssh/common/misc.c
index 99c0778307..1b7646f4dc 100644
--- a/usr/src/cmd/ssh/libssh/common/misc.c
+++ b/usr/src/cmd/ssh/libssh/common/misc.c
@@ -376,6 +376,25 @@ freeargs(arglist *args)
}
}
+char *
+tohex(const void *vp, size_t l)
+{
+ const u_char *p = (const u_char *)vp;
+ char b[3], *r;
+ size_t i, hl;
+
+ if (l > 65536)
+ return xstrdup("tohex: length > 65536");
+
+ hl = l * 2 + 1;
+ r = xcalloc(1, hl);
+ for (i = 0; i < l; i++) {
+ snprintf(b, sizeof(b), "%02x", p[i]);
+ strlcat(r, b, hl);
+ }
+ return (r);
+}
+
mysig_t
mysignal(int sig, mysig_t act)
{