summaryrefslogtreecommitdiff
path: root/openbsd-compat
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2015-01-15 02:35:33 +1100
committerDamien Miller <djm@mindrot.org>2015-01-15 02:35:33 +1100
commit0cdc5a3eb6fb383569a4da2a30705d9b90428d6b (patch)
treec5f6bb21338ca6b99e104c70ef8387711e5c657d /openbsd-compat
parent6e2549ac2b5e7f96cbc2d83a6e0784b120444b47 (diff)
unbreak across API change
Diffstat (limited to 'openbsd-compat')
-rw-r--r--openbsd-compat/port-tun.c13
-rw-r--r--openbsd-compat/port-tun.h2
2 files changed, 10 insertions, 5 deletions
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 @@
32#include "openbsd-compat/sys-queue.h" 32#include "openbsd-compat/sys-queue.h"
33#include "log.h" 33#include "log.h"
34#include "misc.h" 34#include "misc.h"
35#include "buffer.h" 35#include "sshbuf.h"
36#include "channels.h" 36#include "channels.h"
37#include "ssherr.h"
37 38
38/* 39/*
39 * This is the portable version of the SSH tunnel forwarding, it 40 * 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)
210#endif 211#endif
211 u_int32_t *af; 212 u_int32_t *af;
212 char *ptr = buf; 213 char *ptr = buf;
214 int r;
213 215
214#if defined(SSH_TUN_PREPEND_AF) 216#if defined(SSH_TUN_PREPEND_AF)
215 if (len <= 0 || len > (int)(sizeof(rbuf) - sizeof(*af))) 217 if (len <= 0 || len > (int)(sizeof(rbuf) - sizeof(*af)))
@@ -242,17 +244,20 @@ sys_tun_infilter(struct Channel *c, char *buf, int len)
242 *af = htonl(OPENBSD_AF_INET); 244 *af = htonl(OPENBSD_AF_INET);
243#endif 245#endif
244 246
245 buffer_put_string(&c->input, ptr, len); 247 if ((r = sshbuf_put_string(&c->input, ptr, len)) != 0)
248 fatal("%s: buffer error: %s", __func__, ssh_err(r));
246 return (0); 249 return (0);
247} 250}
248 251
249u_char * 252u_char *
250sys_tun_outfilter(struct Channel *c, u_char **data, u_int *dlen) 253sys_tun_outfilter(struct Channel *c, u_char **data, size_t *dlen)
251{ 254{
252 u_char *buf; 255 u_char *buf;
253 u_int32_t *af; 256 u_int32_t *af;
257 int r;
254 258
255 *data = buffer_get_string(&c->output, dlen); 259 if ((r = sshbuf_get_string(&c->output, data, dlen)) != 0)
260 fatal("%s: buffer error: %s", __func__, ssh_err(r));
256 if (*dlen < sizeof(*af)) 261 if (*dlen < sizeof(*af))
257 return (NULL); 262 return (NULL);
258 buf = *data; 263 buf = *data;
diff --git a/openbsd-compat/port-tun.h b/openbsd-compat/port-tun.h
index c53df01fc..e608a454d 100644
--- a/openbsd-compat/port-tun.h
+++ b/openbsd-compat/port-tun.h
@@ -27,7 +27,7 @@ int sys_tun_open(int, int);
27#if defined(SSH_TUN_COMPAT_AF) || defined(SSH_TUN_PREPEND_AF) 27#if defined(SSH_TUN_COMPAT_AF) || defined(SSH_TUN_PREPEND_AF)
28# define SSH_TUN_FILTER 28# define SSH_TUN_FILTER
29int sys_tun_infilter(struct Channel *, char *, int); 29int sys_tun_infilter(struct Channel *, char *, int);
30u_char *sys_tun_outfilter(struct Channel *, u_char **, u_int *); 30u_char *sys_tun_outfilter(struct Channel *, u_char **, size_t *);
31#endif 31#endif
32 32
33#endif 33#endif