summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordjm@openbsd.org <djm@openbsd.org>2019-01-19 21:31:32 +0000
committerDamien Miller <djm@mindrot.org>2019-01-20 09:02:10 +1100
commit0fa174ebe129f3d0aeaf4e2d1dd8de745870d0ff (patch)
tree8ce7eacecf1200d6cb95cd01e87416cc6a3b1af7
parent4ae7f80dfd02f2bde912a67c9f338f61e90fa79f (diff)
upstream: begin landing remaining refactoring of packet parsing
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
-rw-r--r--auth.c5
-rw-r--r--auth2-hostbased.c4
-rw-r--r--auth2.c5
-rw-r--r--channels.c5
-rw-r--r--clientloop.c5
-rw-r--r--monitor.c5
-rw-r--r--monitor_wrap.c5
-rw-r--r--mux.c5
-rw-r--r--opacket.c3
-rw-r--r--packet.h6
-rw-r--r--servconf.c5
-rw-r--r--serverloop.c5
-rw-r--r--session.c5
-rw-r--r--ssh.c5
-rw-r--r--sshconnect.c5
-rw-r--r--sshconnect2.c5
-rw-r--r--sshd.c5
17 files changed, 62 insertions, 21 deletions
diff --git a/auth.c b/auth.c
index 7d48d07a8..94f43a6c2 100644
--- a/auth.c
+++ b/auth.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: auth.c,v 1.135 2019/01/17 04:20:53 djm Exp $ */ 1/* $OpenBSD: auth.c,v 1.136 2019/01/19 21:31:32 djm Exp $ */
2/* 2/*
3 * Copyright (c) 2000 Markus Friedl. All rights reserved. 3 * Copyright (c) 2000 Markus Friedl. All rights reserved.
4 * 4 *
@@ -77,6 +77,9 @@
77#include "compat.h" 77#include "compat.h"
78#include "channels.h" 78#include "channels.h"
79 79
80#include "opacket.h" /* XXX */
81extern struct ssh *active_state; /* XXX */
82
80/* import */ 83/* import */
81extern ServerOptions options; 84extern ServerOptions options;
82extern int use_privsep; 85extern int use_privsep;
diff --git a/auth2-hostbased.c b/auth2-hostbased.c
index 764ceff74..e28a48fb3 100644
--- a/auth2-hostbased.c
+++ b/auth2-hostbased.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: auth2-hostbased.c,v 1.38 2018/09/20 03:28:06 djm Exp $ */ 1/* $OpenBSD: auth2-hostbased.c,v 1.39 2019/01/19 21:31:32 djm Exp $ */
2/* 2/*
3 * Copyright (c) 2000 Markus Friedl. All rights reserved. 3 * Copyright (c) 2000 Markus Friedl. All rights reserved.
4 * 4 *
@@ -51,6 +51,8 @@
51#include "ssherr.h" 51#include "ssherr.h"
52#include "match.h" 52#include "match.h"
53 53
54extern struct ssh *active_state; /* XXX */
55
54/* import */ 56/* import */
55extern ServerOptions options; 57extern ServerOptions options;
56extern u_char *session_id2; 58extern u_char *session_id2;
diff --git a/auth2.c b/auth2.c
index 4415c11ec..3df2acf78 100644
--- a/auth2.c
+++ b/auth2.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: auth2.c,v 1.151 2019/01/17 04:20:53 djm Exp $ */ 1/* $OpenBSD: auth2.c,v 1.152 2019/01/19 21:31:32 djm Exp $ */
2/* 2/*
3 * Copyright (c) 2000 Markus Friedl. All rights reserved. 3 * Copyright (c) 2000 Markus Friedl. All rights reserved.
4 * 4 *
@@ -61,6 +61,9 @@
61#include "ssherr.h" 61#include "ssherr.h"
62#include "digest.h" 62#include "digest.h"
63 63
64#include "opacket.h" /* XXX */
65extern struct ssh *active_state; /* XXX */
66
64/* import */ 67/* import */
65extern ServerOptions options; 68extern ServerOptions options;
66extern u_char *session_id2; 69extern u_char *session_id2;
diff --git a/channels.c b/channels.c
index 6d2e1c6a6..dcda44b07 100644
--- a/channels.c
+++ b/channels.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: channels.c,v 1.387 2018/12/07 02:31:20 djm Exp $ */ 1/* $OpenBSD: channels.c,v 1.388 2019/01/19 21:31:32 djm Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -84,6 +84,9 @@
84#include "pathnames.h" 84#include "pathnames.h"
85#include "match.h" 85#include "match.h"
86 86
87#include "opacket.h" /* XXX */
88extern struct ssh *active_state; /* XXX */
89
87/* -- agent forwarding */ 90/* -- agent forwarding */
88#define NUM_SOCKS 10 91#define NUM_SOCKS 10
89 92
diff --git a/clientloop.c b/clientloop.c
index 8d312cdaa..d29ec00bc 100644
--- a/clientloop.c
+++ b/clientloop.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: clientloop.c,v 1.318 2018/09/21 12:46:22 djm Exp $ */ 1/* $OpenBSD: clientloop.c,v 1.319 2019/01/19 21:31:32 djm Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -112,6 +112,9 @@
112#include "ssherr.h" 112#include "ssherr.h"
113#include "hostfile.h" 113#include "hostfile.h"
114 114
115#include "opacket.h" /* XXX */
116extern struct ssh *active_state; /* XXX */
117
115/* import options */ 118/* import options */
116extern Options options; 119extern Options options;
117 120
diff --git a/monitor.c b/monitor.c
index 09d3a27fd..e15a5225d 100644
--- a/monitor.c
+++ b/monitor.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: monitor.c,v 1.188 2018/11/16 02:43:56 djm Exp $ */ 1/* $OpenBSD: monitor.c,v 1.189 2019/01/19 21:31:32 djm Exp $ */
2/* 2/*
3 * Copyright 2002 Niels Provos <provos@citi.umich.edu> 3 * Copyright 2002 Niels Provos <provos@citi.umich.edu>
4 * Copyright 2002 Markus Friedl <markus@openbsd.org> 4 * Copyright 2002 Markus Friedl <markus@openbsd.org>
@@ -96,6 +96,9 @@
96#include "match.h" 96#include "match.h"
97#include "ssherr.h" 97#include "ssherr.h"
98 98
99#include "opacket.h" /* XXX */
100extern struct ssh *active_state; /* XXX */
101
99#ifdef GSSAPI 102#ifdef GSSAPI
100static Gssctxt *gsscontext = NULL; 103static Gssctxt *gsscontext = NULL;
101#endif 104#endif
diff --git a/monitor_wrap.c b/monitor_wrap.c
index 732fb3476..6ceaa3716 100644
--- a/monitor_wrap.c
+++ b/monitor_wrap.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: monitor_wrap.c,v 1.107 2018/07/20 03:46:34 djm Exp $ */ 1/* $OpenBSD: monitor_wrap.c,v 1.108 2019/01/19 21:31:32 djm Exp $ */
2/* 2/*
3 * Copyright 2002 Niels Provos <provos@citi.umich.edu> 3 * Copyright 2002 Niels Provos <provos@citi.umich.edu>
4 * Copyright 2002 Markus Friedl <markus@openbsd.org> 4 * Copyright 2002 Markus Friedl <markus@openbsd.org>
@@ -76,6 +76,9 @@
76 76
77#include "ssherr.h" 77#include "ssherr.h"
78 78
79#include "opacket.h" /* XXX */
80extern struct ssh *active_state; /* XXX */
81
79/* Imports */ 82/* Imports */
80extern struct monitor *pmonitor; 83extern struct monitor *pmonitor;
81extern struct sshbuf *loginmsg; 84extern struct sshbuf *loginmsg;
diff --git a/mux.c b/mux.c
index 8e4b60827..abc1e05ab 100644
--- a/mux.c
+++ b/mux.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: mux.c,v 1.77 2018/09/26 07:32:44 djm Exp $ */ 1/* $OpenBSD: mux.c,v 1.78 2019/01/19 21:31:32 djm Exp $ */
2/* 2/*
3 * Copyright (c) 2002-2008 Damien Miller <djm@openbsd.org> 3 * Copyright (c) 2002-2008 Damien Miller <djm@openbsd.org>
4 * 4 *
@@ -68,6 +68,9 @@
68#include "clientloop.h" 68#include "clientloop.h"
69#include "ssherr.h" 69#include "ssherr.h"
70 70
71#include "opacket.h" /* XXX */
72extern struct ssh *active_state; /* XXX */
73
71/* from ssh.c */ 74/* from ssh.c */
72extern int tty_flag; 75extern int tty_flag;
73extern Options options; 76extern Options options;
diff --git a/opacket.c b/opacket.c
index e637d7a71..56a76939e 100644
--- a/opacket.c
+++ b/opacket.c
@@ -2,11 +2,12 @@
2/* Written by Markus Friedl. Placed in the public domain. */ 2/* Written by Markus Friedl. Placed in the public domain. */
3 3
4#include "includes.h" 4#include "includes.h"
5 5/* $OpenBSD: opacket.c,v 1.8 2019/01/19 21:31:32 djm Exp $ */
6#include <stdarg.h> 6#include <stdarg.h>
7 7
8#include "ssherr.h" 8#include "ssherr.h"
9#include "packet.h" 9#include "packet.h"
10#include "opacket.h" /* XXX */
10#include "log.h" 11#include "log.h"
11 12
12struct ssh *active_state, *backup_state; 13struct ssh *active_state, *backup_state;
diff --git a/packet.h b/packet.h
index 170203cab..c58b52d39 100644
--- a/packet.h
+++ b/packet.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: packet.h,v 1.86 2018/07/09 21:20:26 markus Exp $ */ 1/* $OpenBSD: packet.h,v 1.87 2019/01/19 21:31:32 djm Exp $ */
2 2
3/* 3/*
4 * Author: Tatu Ylonen <ylo@cs.hut.fi> 4 * Author: Tatu Ylonen <ylo@cs.hut.fi>
@@ -204,10 +204,6 @@ int sshpkt_get_end(struct ssh *ssh);
204void sshpkt_fmt_connection_id(struct ssh *ssh, char *s, size_t l); 204void sshpkt_fmt_connection_id(struct ssh *ssh, char *s, size_t l);
205const u_char *sshpkt_ptr(struct ssh *, size_t *lenp); 205const u_char *sshpkt_ptr(struct ssh *, size_t *lenp);
206 206
207/* OLD API */
208extern struct ssh *active_state;
209#include "opacket.h"
210
211#if !defined(WITH_OPENSSL) 207#if !defined(WITH_OPENSSL)
212# undef BIGNUM 208# undef BIGNUM
213# undef EC_KEY 209# undef EC_KEY
diff --git a/servconf.c b/servconf.c
index 52d9be429..0ec095bd0 100644
--- a/servconf.c
+++ b/servconf.c
@@ -1,5 +1,5 @@
1 1
2/* $OpenBSD: servconf.c,v 1.344 2018/11/19 04:12:32 djm Exp $ */ 2/* $OpenBSD: servconf.c,v 1.345 2019/01/19 21:31:32 djm Exp $ */
3/* 3/*
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
5 * All rights reserved 5 * All rights reserved
@@ -65,6 +65,9 @@
65#include "myproposal.h" 65#include "myproposal.h"
66#include "digest.h" 66#include "digest.h"
67 67
68#include "opacket.h" /* XXX */
69extern struct ssh *active_state; /* XXX */
70
68static void add_listen_addr(ServerOptions *, const char *, 71static void add_listen_addr(ServerOptions *, const char *,
69 const char *, int); 72 const char *, int);
70static void add_one_listen_addr(ServerOptions *, const char *, 73static void add_one_listen_addr(ServerOptions *, const char *,
diff --git a/serverloop.c b/serverloop.c
index 7be83e2d3..e0c26bbbc 100644
--- a/serverloop.c
+++ b/serverloop.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: serverloop.c,v 1.209 2018/07/27 05:13:02 dtucker Exp $ */ 1/* $OpenBSD: serverloop.c,v 1.210 2019/01/19 21:31:32 djm Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -78,6 +78,9 @@
78#include "serverloop.h" 78#include "serverloop.h"
79#include "ssherr.h" 79#include "ssherr.h"
80 80
81#include "opacket.h" /* XXX */
82extern struct ssh *active_state; /* XXX */
83
81extern ServerOptions options; 84extern ServerOptions options;
82 85
83/* XXX */ 86/* XXX */
diff --git a/session.c b/session.c
index 0452f507a..f0dabe111 100644
--- a/session.c
+++ b/session.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: session.c,v 1.309 2019/01/17 04:45:09 djm Exp $ */ 1/* $OpenBSD: session.c,v 1.310 2019/01/19 21:31:32 djm Exp $ */
2/* 2/*
3 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 3 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
4 * All rights reserved 4 * All rights reserved
@@ -105,6 +105,9 @@
105#include <selinux/selinux.h> 105#include <selinux/selinux.h>
106#endif 106#endif
107 107
108#include "opacket.h" /* XXX */
109extern struct ssh *active_state; /* XXX */
110
108#define IS_INTERNAL_SFTP(c) \ 111#define IS_INTERNAL_SFTP(c) \
109 (!strncmp(c, INTERNAL_SFTP_NAME, sizeof(INTERNAL_SFTP_NAME) - 1) && \ 112 (!strncmp(c, INTERNAL_SFTP_NAME, sizeof(INTERNAL_SFTP_NAME) - 1) && \
110 (c[sizeof(INTERNAL_SFTP_NAME) - 1] == '\0' || \ 113 (c[sizeof(INTERNAL_SFTP_NAME) - 1] == '\0' || \
diff --git a/ssh.c b/ssh.c
index 16536a97a..a206a5fca 100644
--- a/ssh.c
+++ b/ssh.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssh.c,v 1.497 2018/12/27 03:25:25 djm Exp $ */ 1/* $OpenBSD: ssh.c,v 1.498 2019/01/19 21:31:32 djm Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -113,6 +113,9 @@
113#include "ssh-pkcs11.h" 113#include "ssh-pkcs11.h"
114#endif 114#endif
115 115
116#include "opacket.h" /* XXX */
117extern struct ssh *active_state; /* XXX move here */
118
116extern char *__progname; 119extern char *__progname;
117 120
118/* Saves a copy of argv for setproctitle emulation */ 121/* Saves a copy of argv for setproctitle emulation */
diff --git a/sshconnect.c b/sshconnect.c
index 884e33628..346f979d1 100644
--- a/sshconnect.c
+++ b/sshconnect.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: sshconnect.c,v 1.309 2018/12/27 03:25:25 djm Exp $ */ 1/* $OpenBSD: sshconnect.c,v 1.310 2019/01/19 21:31:32 djm Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -70,6 +70,9 @@
70#include "authfd.h" 70#include "authfd.h"
71#include "kex.h" 71#include "kex.h"
72 72
73#include "opacket.h" /* XXX */
74extern struct ssh *active_state; /* XXX */
75
73struct sshkey *previous_host_key = NULL; 76struct sshkey *previous_host_key = NULL;
74 77
75static int matching_host_key_dns = 0; 78static int matching_host_key_dns = 0;
diff --git a/sshconnect2.c b/sshconnect2.c
index 0e8f323d6..73ffe77a9 100644
--- a/sshconnect2.c
+++ b/sshconnect2.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: sshconnect2.c,v 1.292 2019/01/04 03:27:50 djm Exp $ */ 1/* $OpenBSD: sshconnect2.c,v 1.293 2019/01/19 21:31:32 djm Exp $ */
2/* 2/*
3 * Copyright (c) 2000 Markus Friedl. All rights reserved. 3 * Copyright (c) 2000 Markus Friedl. All rights reserved.
4 * Copyright (c) 2008 Damien Miller. All rights reserved. 4 * Copyright (c) 2008 Damien Miller. All rights reserved.
@@ -77,6 +77,9 @@
77#include "ssh-gss.h" 77#include "ssh-gss.h"
78#endif 78#endif
79 79
80#include "opacket.h" /* XXX */
81extern struct ssh *active_state; /* XXX */
82
80/* import */ 83/* import */
81extern char *client_version_string; 84extern char *client_version_string;
82extern char *server_version_string; 85extern char *server_version_string;
diff --git a/sshd.c b/sshd.c
index 1d25c88f3..ad8c152a5 100644
--- a/sshd.c
+++ b/sshd.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: sshd.c,v 1.521 2019/01/17 01:50:24 djm Exp $ */ 1/* $OpenBSD: sshd.c,v 1.522 2019/01/19 21:31:32 djm Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -123,6 +123,9 @@
123#include "version.h" 123#include "version.h"
124#include "ssherr.h" 124#include "ssherr.h"
125 125
126#include "opacket.h" /* XXX */
127extern struct ssh *active_state; /* XXX move decl to this file */
128
126/* Re-exec fds */ 129/* Re-exec fds */
127#define REEXEC_DEVCRYPTO_RESERVED_FD (STDERR_FILENO + 1) 130#define REEXEC_DEVCRYPTO_RESERVED_FD (STDERR_FILENO + 1)
128#define REEXEC_STARTUP_PIPE_FD (STDERR_FILENO + 2) 131#define REEXEC_STARTUP_PIPE_FD (STDERR_FILENO + 2)