From 0cdc5a3eb6fb383569a4da2a30705d9b90428d6b Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Thu, 15 Jan 2015 02:35:33 +1100 Subject: unbreak across API change --- openbsd-compat/port-tun.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'openbsd-compat/port-tun.c') diff --git a/openbsd-compat/port-tun.c b/openbsd-compat/port-tun.c index 0d756f74f..7b58ea678 100644 --- a/openbsd-compat/port-tun.c +++ b/openbsd-compat/port-tun.c @@ -32,8 +32,9 @@ #include "openbsd-compat/sys-queue.h" #include "log.h" #include "misc.h" -#include "buffer.h" +#include "sshbuf.h" #include "channels.h" +#include "ssherr.h" /* * This is the portable version of the SSH tunnel forwarding, it @@ -210,6 +211,7 @@ sys_tun_infilter(struct Channel *c, char *buf, int len) #endif u_int32_t *af; char *ptr = buf; + int r; #if defined(SSH_TUN_PREPEND_AF) if (len <= 0 || len > (int)(sizeof(rbuf) - sizeof(*af))) @@ -242,17 +244,20 @@ sys_tun_infilter(struct Channel *c, char *buf, int len) *af = htonl(OPENBSD_AF_INET); #endif - buffer_put_string(&c->input, ptr, len); + if ((r = sshbuf_put_string(&c->input, ptr, len)) != 0) + fatal("%s: buffer error: %s", __func__, ssh_err(r)); return (0); } u_char * -sys_tun_outfilter(struct Channel *c, u_char **data, u_int *dlen) +sys_tun_outfilter(struct Channel *c, u_char **data, size_t *dlen) { u_char *buf; u_int32_t *af; + int r; - *data = buffer_get_string(&c->output, dlen); + if ((r = sshbuf_get_string(&c->output, data, dlen)) != 0) + fatal("%s: buffer error: %s", __func__, ssh_err(r)); if (*dlen < sizeof(*af)) return (NULL); buf = *data; -- cgit v1.2.3 From bc42cc6fe784f36df225c44c93b74830027cb5a2 Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Thu, 15 Jan 2015 03:08:29 +1100 Subject: kludge around tun API mismatch betterer --- openbsd-compat/port-tun.c | 8 ++++++-- openbsd-compat/port-tun.h | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'openbsd-compat/port-tun.c') diff --git a/openbsd-compat/port-tun.c b/openbsd-compat/port-tun.c index 7b58ea678..49e7b4d99 100644 --- a/openbsd-compat/port-tun.c +++ b/openbsd-compat/port-tun.c @@ -250,14 +250,18 @@ sys_tun_infilter(struct Channel *c, char *buf, int len) } u_char * -sys_tun_outfilter(struct Channel *c, u_char **data, size_t *dlen) +sys_tun_outfilter(struct Channel *c, u_char **data, u_int *dlen) { u_char *buf; u_int32_t *af; int r; + size_t xxx_dlen; - if ((r = sshbuf_get_string(&c->output, data, dlen)) != 0) + /* XXX new API is incompatible with this signature. */ + if ((r = sshbuf_get_string(&c->output, data, &xxx_dlen)) != 0) fatal("%s: buffer error: %s", __func__, ssh_err(r)); + if (dlen != NULL) + *dlen = xxx_dlen; if (*dlen < sizeof(*af)) return (NULL); buf = *data; diff --git a/openbsd-compat/port-tun.h b/openbsd-compat/port-tun.h index e608a454d..c53df01fc 100644 --- a/openbsd-compat/port-tun.h +++ b/openbsd-compat/port-tun.h @@ -27,7 +27,7 @@ int sys_tun_open(int, int); #if defined(SSH_TUN_COMPAT_AF) || defined(SSH_TUN_PREPEND_AF) # define SSH_TUN_FILTER int sys_tun_infilter(struct Channel *, char *, int); -u_char *sys_tun_outfilter(struct Channel *, u_char **, size_t *); +u_char *sys_tun_outfilter(struct Channel *, u_char **, u_int *); #endif #endif -- cgit v1.2.3