]> git.ipfire.org Git - thirdparty/openssh-portable.git/commitdiff
upstream: begin landing remaining refactoring of packet parsing
authordjm@openbsd.org <djm@openbsd.org>
Sat, 19 Jan 2019 21:31:32 +0000 (21:31 +0000)
committerDamien Miller <djm@mindrot.org>
Sat, 19 Jan 2019 22:02:10 +0000 (09:02 +1100)
API, started almost exactly six years ago.

This change stops including the old packet_* API by default and makes
each file that requires the old API include it explicitly. We will
commit file-by-file refactoring to remove the old API in consistent
steps.

with & ok markus@

OpenBSD-Commit-ID: 93c98a6b38f6911fd1ae025a1ec57807fb4d4ef4

17 files changed:
auth.c
auth2-hostbased.c
auth2.c
channels.c
clientloop.c
monitor.c
monitor_wrap.c
mux.c
opacket.c
packet.h
servconf.c
serverloop.c
session.c
ssh.c
sshconnect.c
sshconnect2.c
sshd.c

diff --git a/auth.c b/auth.c
index 7d48d07a81bda9d2640d2a682af2615ec5942b2f..94f43a6c2a66ee0d92074701c09b14a693b00c7b 100644 (file)
--- a/auth.c
+++ b/auth.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: auth.c,v 1.135 2019/01/17 04:20:53 djm Exp $ */
+/* $OpenBSD: auth.c,v 1.136 2019/01/19 21:31:32 djm Exp $ */
 /*
  * Copyright (c) 2000 Markus Friedl.  All rights reserved.
  *
@@ -77,6 +77,9 @@
 #include "compat.h"
 #include "channels.h"
 
+#include "opacket.h" /* XXX */
+extern struct ssh *active_state; /* XXX */
+
 /* import */
 extern ServerOptions options;
 extern int use_privsep;
index 764ceff74ee6aa1b72274e555c24d4486abd6ee7..e28a48fb3d51200e9492c7e5439aecf0a1ee85f8 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: auth2-hostbased.c,v 1.38 2018/09/20 03:28:06 djm Exp $ */
+/* $OpenBSD: auth2-hostbased.c,v 1.39 2019/01/19 21:31:32 djm Exp $ */
 /*
  * Copyright (c) 2000 Markus Friedl.  All rights reserved.
  *
@@ -51,6 +51,8 @@
 #include "ssherr.h"
 #include "match.h"
 
+extern struct ssh *active_state; /* XXX */
+
 /* import */
 extern ServerOptions options;
 extern u_char *session_id2;
diff --git a/auth2.c b/auth2.c
index 4415c11ec5a5702828ef4883051a19b1c720a1cd..3df2acf78ae81a5f7ed0587beb7cb4acbbb56ef1 100644 (file)
--- a/auth2.c
+++ b/auth2.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: auth2.c,v 1.151 2019/01/17 04:20:53 djm Exp $ */
+/* $OpenBSD: auth2.c,v 1.152 2019/01/19 21:31:32 djm Exp $ */
 /*
  * Copyright (c) 2000 Markus Friedl.  All rights reserved.
  *
@@ -61,6 +61,9 @@
 #include "ssherr.h"
 #include "digest.h"
 
+#include "opacket.h" /* XXX */
+extern struct ssh *active_state; /* XXX */
+
 /* import */
 extern ServerOptions options;
 extern u_char *session_id2;
index 6d2e1c6a6270da983c9ba7ae312f08665a2f65e9..dcda44b07970ac755b9cf8d31dde14abf6160d73 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: channels.c,v 1.387 2018/12/07 02:31:20 djm Exp $ */
+/* $OpenBSD: channels.c,v 1.388 2019/01/19 21:31:32 djm Exp $ */
 /*
  * Author: Tatu Ylonen <ylo@cs.hut.fi>
  * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -84,6 +84,9 @@
 #include "pathnames.h"
 #include "match.h"
 
+#include "opacket.h" /* XXX */
+extern struct ssh *active_state; /* XXX */
+
 /* -- agent forwarding */
 #define        NUM_SOCKS       10
 
index 8d312cdaa75586aa996852898a795fc64d4711c1..d29ec00bc7e1a2cdf427d6d241cad9c267cc7a36 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: clientloop.c,v 1.318 2018/09/21 12:46:22 djm Exp $ */
+/* $OpenBSD: clientloop.c,v 1.319 2019/01/19 21:31:32 djm Exp $ */
 /*
  * Author: Tatu Ylonen <ylo@cs.hut.fi>
  * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
 #include "ssherr.h"
 #include "hostfile.h"
 
+#include "opacket.h" /* XXX */
+extern struct ssh *active_state; /* XXX */
+
 /* import options */
 extern Options options;
 
index 09d3a27fd7bbc21bd476e1acd5ef19564a1e9117..e15a5225da909d88ec332bafdf127034d1aad0d8 100644 (file)
--- a/monitor.c
+++ b/monitor.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: monitor.c,v 1.188 2018/11/16 02:43:56 djm Exp $ */
+/* $OpenBSD: monitor.c,v 1.189 2019/01/19 21:31:32 djm Exp $ */
 /*
  * Copyright 2002 Niels Provos <provos@citi.umich.edu>
  * Copyright 2002 Markus Friedl <markus@openbsd.org>
@@ -96,6 +96,9 @@
 #include "match.h"
 #include "ssherr.h"
 
+#include "opacket.h" /* XXX */
+extern struct ssh *active_state; /* XXX */
+
 #ifdef GSSAPI
 static Gssctxt *gsscontext = NULL;
 #endif
index 732fb3476bf015563ddddf508ccddd944babc505..6ceaa3716582632374fab66acf777d157b1c8963 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: monitor_wrap.c,v 1.107 2018/07/20 03:46:34 djm Exp $ */
+/* $OpenBSD: monitor_wrap.c,v 1.108 2019/01/19 21:31:32 djm Exp $ */
 /*
  * Copyright 2002 Niels Provos <provos@citi.umich.edu>
  * Copyright 2002 Markus Friedl <markus@openbsd.org>
@@ -76,6 +76,9 @@
 
 #include "ssherr.h"
 
+#include "opacket.h" /* XXX */
+extern struct ssh *active_state; /* XXX */
+
 /* Imports */
 extern struct monitor *pmonitor;
 extern struct sshbuf *loginmsg;
diff --git a/mux.c b/mux.c
index 8e4b60827fc861715fa1ae81813a6be33b8bd3da..abc1e05ab64c0c4d670755b94a980bdf8f6b4852 100644 (file)
--- a/mux.c
+++ b/mux.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mux.c,v 1.77 2018/09/26 07:32:44 djm Exp $ */
+/* $OpenBSD: mux.c,v 1.78 2019/01/19 21:31:32 djm Exp $ */
 /*
  * Copyright (c) 2002-2008 Damien Miller <djm@openbsd.org>
  *
@@ -68,6 +68,9 @@
 #include "clientloop.h"
 #include "ssherr.h"
 
+#include "opacket.h" /* XXX */
+extern struct ssh *active_state; /* XXX */
+
 /* from ssh.c */
 extern int tty_flag;
 extern Options options;
index e637d7a71b5b25653926873914c190915817f297..56a76939e176f66bd3804bffa223cd3971bc84c6 100644 (file)
--- a/opacket.c
+++ b/opacket.c
@@ -2,11 +2,12 @@
 /* Written by Markus Friedl. Placed in the public domain.  */
 
 #include "includes.h"
-
+/* $OpenBSD: opacket.c,v 1.8 2019/01/19 21:31:32 djm Exp $ */
 #include <stdarg.h>
 
 #include "ssherr.h"
 #include "packet.h"
+#include "opacket.h" /* XXX */
 #include "log.h"
 
 struct ssh *active_state, *backup_state;
index 170203cabeb28a6f61724e43b176d804296e722d..c58b52d39d42753b4134cdfed4f8261e3653be40 100644 (file)
--- a/packet.h
+++ b/packet.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: packet.h,v 1.86 2018/07/09 21:20:26 markus Exp $ */
+/* $OpenBSD: packet.h,v 1.87 2019/01/19 21:31:32 djm Exp $ */
 
 /*
  * Author: Tatu Ylonen <ylo@cs.hut.fi>
@@ -204,10 +204,6 @@ int        sshpkt_get_end(struct ssh *ssh);
 void   sshpkt_fmt_connection_id(struct ssh *ssh, char *s, size_t l);
 const u_char   *sshpkt_ptr(struct ssh *, size_t *lenp);
 
-/* OLD API */
-extern struct ssh *active_state;
-#include "opacket.h"
-
 #if !defined(WITH_OPENSSL)
 # undef BIGNUM
 # undef EC_KEY
index 52d9be4295be6dbaf27123380b16a4965f643a98..0ec095bd0ffd288cd1cfb8168093474b335004d6 100644 (file)
@@ -1,5 +1,5 @@
 
-/* $OpenBSD: servconf.c,v 1.344 2018/11/19 04:12:32 djm Exp $ */
+/* $OpenBSD: servconf.c,v 1.345 2019/01/19 21:31:32 djm Exp $ */
 /*
  * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
  *                    All rights reserved
@@ -65,6 +65,9 @@
 #include "myproposal.h"
 #include "digest.h"
 
+#include "opacket.h" /* XXX */
+extern struct ssh *active_state; /* XXX */
+
 static void add_listen_addr(ServerOptions *, const char *,
     const char *, int);
 static void add_one_listen_addr(ServerOptions *, const char *,
index 7be83e2d338ac6824ad4468fe089b9aa145251b6..e0c26bbbc394467916096b6e19411e4c617f8da2 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: serverloop.c,v 1.209 2018/07/27 05:13:02 dtucker Exp $ */
+/* $OpenBSD: serverloop.c,v 1.210 2019/01/19 21:31:32 djm Exp $ */
 /*
  * Author: Tatu Ylonen <ylo@cs.hut.fi>
  * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -78,6 +78,9 @@
 #include "serverloop.h"
 #include "ssherr.h"
 
+#include "opacket.h" /* XXX */
+extern struct ssh *active_state; /* XXX */
+
 extern ServerOptions options;
 
 /* XXX */
index 0452f507ac19d6db8fb655ac8ddb5fb49ca5e643..f0dabe111acf50220d6b29b7618183fa7f70104c 100644 (file)
--- a/session.c
+++ b/session.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: session.c,v 1.309 2019/01/17 04:45:09 djm Exp $ */
+/* $OpenBSD: session.c,v 1.310 2019/01/19 21:31:32 djm Exp $ */
 /*
  * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
  *                    All rights reserved
 #include <selinux/selinux.h>
 #endif
 
+#include "opacket.h" /* XXX */
+extern struct ssh *active_state; /* XXX */
+
 #define IS_INTERNAL_SFTP(c) \
        (!strncmp(c, INTERNAL_SFTP_NAME, sizeof(INTERNAL_SFTP_NAME) - 1) && \
         (c[sizeof(INTERNAL_SFTP_NAME) - 1] == '\0' || \
diff --git a/ssh.c b/ssh.c
index 16536a97a7244ca3cbf13fbb919485106cf6c42b..a206a5fca1575f3e8394163b98e21b6c70744217 100644 (file)
--- a/ssh.c
+++ b/ssh.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssh.c,v 1.497 2018/12/27 03:25:25 djm Exp $ */
+/* $OpenBSD: ssh.c,v 1.498 2019/01/19 21:31:32 djm Exp $ */
 /*
  * Author: Tatu Ylonen <ylo@cs.hut.fi>
  * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
 #include "ssh-pkcs11.h"
 #endif
 
+#include "opacket.h" /* XXX */
+extern struct ssh *active_state; /* XXX move here */
+
 extern char *__progname;
 
 /* Saves a copy of argv for setproctitle emulation */
index 884e3362828c866fa5e751bf035a8544769145db..346f979d13a39997e3843d9adb378e6499400745 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: sshconnect.c,v 1.309 2018/12/27 03:25:25 djm Exp $ */
+/* $OpenBSD: sshconnect.c,v 1.310 2019/01/19 21:31:32 djm Exp $ */
 /*
  * Author: Tatu Ylonen <ylo@cs.hut.fi>
  * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -70,6 +70,9 @@
 #include "authfd.h"
 #include "kex.h"
 
+#include "opacket.h" /* XXX */
+extern struct ssh *active_state; /* XXX */
+
 struct sshkey *previous_host_key = NULL;
 
 static int matching_host_key_dns = 0;
index 0e8f323d648b9767e13f019e54ca217fd54e5b20..73ffe77a91e25674463047b6f3c558bb915ef29e 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: sshconnect2.c,v 1.292 2019/01/04 03:27:50 djm Exp $ */
+/* $OpenBSD: sshconnect2.c,v 1.293 2019/01/19 21:31:32 djm Exp $ */
 /*
  * Copyright (c) 2000 Markus Friedl.  All rights reserved.
  * Copyright (c) 2008 Damien Miller.  All rights reserved.
@@ -77,6 +77,9 @@
 #include "ssh-gss.h"
 #endif
 
+#include "opacket.h" /* XXX */
+extern struct ssh *active_state; /* XXX */
+
 /* import */
 extern char *client_version_string;
 extern char *server_version_string;
diff --git a/sshd.c b/sshd.c
index 1d25c88f3d0aad2af6adb7a920d9415f8c62df59..ad8c152a5f12dd10c58c02f364b827353526d7e6 100644 (file)
--- a/sshd.c
+++ b/sshd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sshd.c,v 1.521 2019/01/17 01:50:24 djm Exp $ */
+/* $OpenBSD: sshd.c,v 1.522 2019/01/19 21:31:32 djm Exp $ */
 /*
  * Author: Tatu Ylonen <ylo@cs.hut.fi>
  * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
 #include "version.h"
 #include "ssherr.h"
 
+#include "opacket.h" /* XXX */
+extern struct ssh *active_state; /* XXX move decl to this file */
+
 /* Re-exec fds */
 #define REEXEC_DEVCRYPTO_RESERVED_FD   (STDERR_FILENO + 1)
 #define REEXEC_STARTUP_PIPE_FD         (STDERR_FILENO + 2)