[openssh-commits] [openssh] 01/01: adapt portable to channels API changes

git+noreply at mindrot.org git+noreply at mindrot.org
Tue Sep 12 18:01:50 AEST 2017


This is an automated email from the git hooks/post-receive script.

djm pushed a commit to branch master
in repository openssh.

commit 871f1e4374420b07550041b329627c474abc3010
Author: Damien Miller <djm at mindrot.org>
Date:   Tue Sep 12 18:01:35 2017 +1000

    adapt portable to channels API changes
---
 clientloop.c              |  2 +-
 openbsd-compat/port-tun.c | 12 +++++-------
 openbsd-compat/port-tun.h |  5 +++--
 serverloop.c              |  2 +-
 4 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/clientloop.c b/clientloop.c
index 829eae02..3b4840b1 100644
--- a/clientloop.c
+++ b/clientloop.c
@@ -1634,7 +1634,7 @@ client_request_tun_fwd(struct ssh *ssh, int tun_mode,
 
 #if defined(SSH_TUN_FILTER)
 	if (options.tun_open == SSH_TUNMODE_POINTOPOINT)
-		channel_register_filter(c->self, sys_tun_infilter,
+		channel_register_filter(ssh, c->self, sys_tun_infilter,
 		    sys_tun_outfilter, NULL, NULL);
 #endif
 
diff --git a/openbsd-compat/port-tun.c b/openbsd-compat/port-tun.c
index a7a5d949..7579c608 100644
--- a/openbsd-compat/port-tun.c
+++ b/openbsd-compat/port-tun.c
@@ -207,7 +207,7 @@ sys_tun_open(int tun, int mode)
 #define OPENBSD_AF_INET6	24
 
 int
-sys_tun_infilter(struct Channel *c, char *buf, int _len)
+sys_tun_infilter(struct ssh *ssh, struct Channel *c, char *buf, int _len)
 {
 	int r;
 	size_t len;
@@ -245,24 +245,22 @@ sys_tun_infilter(struct Channel *c, char *buf, int _len)
 	POKE_U32(buf, af == AF_INET6 ? OPENBSD_AF_INET6 : OPENBSD_AF_INET);
 #endif
 
-	if ((r = sshbuf_put_string(&c->input, ptr, len)) != 0)
+	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 ssh *ssh, struct Channel *c,
+    u_char **data, size_t *dlen)
 {
 	u_char *buf;
 	u_int32_t af;
 	int r;
-	size_t xxx_dlen;
 
 	/* XXX new API is incompatible with this signature. */
-	if ((r = sshbuf_get_string(&c->output, data, &xxx_dlen)) != 0)
+	if ((r = sshbuf_get_string(c->output, data, 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 c53df01f..10351437 100644
--- a/openbsd-compat/port-tun.h
+++ b/openbsd-compat/port-tun.h
@@ -18,6 +18,7 @@
 #define _PORT_TUN_H
 
 struct Channel;
+struct ssh;
 
 #if defined(SSH_TUN_LINUX) || defined(SSH_TUN_FREEBSD)
 # define CUSTOM_SYS_TUN_OPEN
@@ -26,8 +27,8 @@ 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 **, u_int *);
+int	 sys_tun_infilter(struct ssh *, struct Channel *, char *, int);
+u_char	*sys_tun_outfilter(struct ssh *, struct Channel *, u_char **, size_t *);
 #endif
 
 #endif
diff --git a/serverloop.c b/serverloop.c
index ae75fc2e..24bbae32 100644
--- a/serverloop.c
+++ b/serverloop.c
@@ -549,7 +549,7 @@ server_request_tun(struct ssh *ssh)
 	c->datagram = 1;
 #if defined(SSH_TUN_FILTER)
 	if (mode == SSH_TUNMODE_POINTOPOINT)
-		channel_register_filter(c->self, sys_tun_infilter,
+		channel_register_filter(ssh, c->self, sys_tun_infilter,
 		    sys_tun_outfilter, NULL, NULL);
 #endif
 

-- 
To stop receiving notification emails like this one, please contact
djm at mindrot.org.


More information about the openssh-commits mailing list