summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormarkus <markus@openbsd.org>2000-09-21 11:25:32 +0000
committermarkus <markus@openbsd.org>2000-09-21 11:25:32 +0000
commit94df6a2f3c318515523e44ebcdcaad11e0e14c0a (patch)
tree3e76da1b421d3d86a9604fa12a4d88059955e0bb
parentchange login logic in ssh2, allows plugin of other auth methods (diff)
downloadwireguard-openbsd-94df6a2f3c318515523e44ebcdcaad11e0e14c0a.tar.xz
wireguard-openbsd-94df6a2f3c318515523e44ebcdcaad11e0e14c0a.zip
add context to dispatch_run
-rw-r--r--usr.bin/ssh/auth2.c16
-rw-r--r--usr.bin/ssh/channels.c28
-rw-r--r--usr.bin/ssh/channels.h30
-rw-r--r--usr.bin/ssh/clientloop.c12
-rw-r--r--usr.bin/ssh/dispatch.c8
-rw-r--r--usr.bin/ssh/dispatch.h6
-rw-r--r--usr.bin/ssh/serverloop.c10
7 files changed, 55 insertions, 55 deletions
diff --git a/usr.bin/ssh/auth2.c b/usr.bin/ssh/auth2.c
index f2d742810af..ce67c3d3c71 100644
--- a/usr.bin/ssh/auth2.c
+++ b/usr.bin/ssh/auth2.c
@@ -23,7 +23,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: auth2.c,v 1.14 2000/09/07 20:27:49 deraadt Exp $");
+RCSID("$OpenBSD: auth2.c,v 1.15 2000/09/21 11:25:32 markus Exp $");
#include <openssl/dsa.h>
#include <openssl/rsa.h>
@@ -59,9 +59,9 @@ extern int session_id2_len;
/* protocol */
-void input_service_request(int type, int plen);
-void input_userauth_request(int type, int plen);
-void protocol_error(int type, int plen);
+void input_service_request(int type, int plen, void *ctxt);
+void input_userauth_request(int type, int plen, void *ctxt);
+void protocol_error(int type, int plen, void *ctxt);
/* auth */
int ssh2_auth_none(struct passwd *pw);
@@ -99,12 +99,12 @@ do_authentication2()
dispatch_init(&protocol_error);
dispatch_set(SSH2_MSG_SERVICE_REQUEST, &input_service_request);
- dispatch_run(DISPATCH_BLOCK, &userauth_success);
+ dispatch_run(DISPATCH_BLOCK, &userauth_success, NULL);
do_authenticated2();
}
void
-protocol_error(int type, int plen)
+protocol_error(int type, int plen, void *ctxt)
{
log("auth: protocol error: type %d plen %d", type, plen);
packet_start(SSH2_MSG_UNIMPLEMENTED);
@@ -114,7 +114,7 @@ protocol_error(int type, int plen)
}
void
-input_service_request(int type, int plen)
+input_service_request(int type, int plen, void *ctxt)
{
unsigned int len;
int accept = 0;
@@ -143,7 +143,7 @@ input_service_request(int type, int plen)
}
void
-input_userauth_request(int type, int plen)
+input_userauth_request(int type, int plen, void *ctxt)
{
static void (*authlog) (const char *fmt,...) = verbose;
static int attempt = 0;
diff --git a/usr.bin/ssh/channels.c b/usr.bin/ssh/channels.c
index e9a64d92f77..0e71433ec48 100644
--- a/usr.bin/ssh/channels.c
+++ b/usr.bin/ssh/channels.c
@@ -40,7 +40,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: channels.c,v 1.68 2000/09/07 20:40:29 markus Exp $");
+RCSID("$OpenBSD: channels.c,v 1.69 2000/09/21 11:25:33 markus Exp $");
#include "ssh.h"
#include "packet.h"
@@ -998,7 +998,7 @@ channel_output_poll()
*/
void
-channel_input_data(int type, int plen)
+channel_input_data(int type, int plen, void *ctxt)
{
int id;
char *data;
@@ -1043,7 +1043,7 @@ channel_input_data(int type, int plen)
xfree(data);
}
void
-channel_input_extended_data(int type, int plen)
+channel_input_extended_data(int type, int plen, void *ctxt)
{
int id;
int tcode;
@@ -1113,7 +1113,7 @@ channel_not_very_much_buffered_data()
}
void
-channel_input_ieof(int type, int plen)
+channel_input_ieof(int type, int plen, void *ctxt)
{
int id;
Channel *c;
@@ -1128,7 +1128,7 @@ channel_input_ieof(int type, int plen)
}
void
-channel_input_close(int type, int plen)
+channel_input_close(int type, int plen, void *ctxt)
{
int id;
Channel *c;
@@ -1167,7 +1167,7 @@ channel_input_close(int type, int plen)
/* proto version 1.5 overloads CLOSE_CONFIRMATION with OCLOSE */
void
-channel_input_oclose(int type, int plen)
+channel_input_oclose(int type, int plen, void *ctxt)
{
int id = packet_get_int();
Channel *c = channel_lookup(id);
@@ -1178,7 +1178,7 @@ channel_input_oclose(int type, int plen)
}
void
-channel_input_close_confirmation(int type, int plen)
+channel_input_close_confirmation(int type, int plen, void *ctxt)
{
int id = packet_get_int();
Channel *c = channel_lookup(id);
@@ -1194,7 +1194,7 @@ channel_input_close_confirmation(int type, int plen)
}
void
-channel_input_open_confirmation(int type, int plen)
+channel_input_open_confirmation(int type, int plen, void *ctxt)
{
int id, remote_id;
Channel *c;
@@ -1228,7 +1228,7 @@ channel_input_open_confirmation(int type, int plen)
}
void
-channel_input_open_failure(int type, int plen)
+channel_input_open_failure(int type, int plen, void *ctxt)
{
int id;
Channel *c;
@@ -1256,7 +1256,7 @@ channel_input_open_failure(int type, int plen)
}
void
-channel_input_channel_request(int type, int plen)
+channel_input_channel_request(int type, int plen, void *ctxt)
{
int id;
Channel *c;
@@ -1281,7 +1281,7 @@ debug("cb_fn %p cb_event %d", c->cb_fn , c->cb_event);
}
void
-channel_input_window_adjust(int type, int plen)
+channel_input_window_adjust(int type, int plen, void *ctxt)
{
Channel *c;
int id, adjust;
@@ -1652,7 +1652,7 @@ channel_connect_to(const char *host, u_short host_port)
*/
void
-channel_input_port_open(int type, int plen)
+channel_input_port_open(int type, int plen, void *ctxt)
{
u_short host_port;
char *host, *originator_string;
@@ -1942,7 +1942,7 @@ x11_connect_display(void)
*/
void
-x11_input_open(int type, int plen)
+x11_input_open(int type, int plen, void *ctxt)
{
int remote_channel, sock = 0, newch;
char *remote_host;
@@ -2157,7 +2157,7 @@ auth_input_request_forwarding(struct passwd * pw)
/* This is called to process an SSH_SMSG_AGENT_OPEN message. */
void
-auth_input_open_request(int type, int plen)
+auth_input_open_request(int type, int plen, void *ctxt)
{
int remch, sock, newch;
char *dummyname;
diff --git a/usr.bin/ssh/channels.h b/usr.bin/ssh/channels.h
index c0d60199c14..a74f5926178 100644
--- a/usr.bin/ssh/channels.h
+++ b/usr.bin/ssh/channels.h
@@ -32,7 +32,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-/* RCSID("$OpenBSD: channels.h,v 1.19 2000/09/07 21:13:37 markus Exp $"); */
+/* RCSID("$OpenBSD: channels.h,v 1.20 2000/09/21 11:25:33 markus Exp $"); */
#ifndef CHANNELS_H
#define CHANNELS_H
@@ -131,18 +131,18 @@ int
channel_new(char *ctype, int type, int rfd, int wfd, int efd,
int window, int maxpack, int extended_usage, char *remote_name);
-void channel_input_channel_request(int type, int plen);
-void channel_input_close(int type, int plen);
-void channel_input_close_confirmation(int type, int plen);
-void channel_input_data(int type, int plen);
-void channel_input_extended_data(int type, int plen);
-void channel_input_ieof(int type, int plen);
-void channel_input_oclose(int type, int plen);
-void channel_input_open_confirmation(int type, int plen);
-void channel_input_open_failure(int type, int plen);
-void channel_input_port_open(int type, int plen);
-void channel_input_window_adjust(int type, int plen);
-void channel_input_open(int type, int plen);
+void channel_input_channel_request(int type, int plen, void *ctxt);
+void channel_input_close(int type, int plen, void *ctxt);
+void channel_input_close_confirmation(int type, int plen, void *ctxt);
+void channel_input_data(int type, int plen, void *ctxt);
+void channel_input_extended_data(int type, int plen, void *ctxt);
+void channel_input_ieof(int type, int plen, void *ctxt);
+void channel_input_oclose(int type, int plen, void *ctxt);
+void channel_input_open_confirmation(int type, int plen, void *ctxt);
+void channel_input_open_failure(int type, int plen, void *ctxt);
+void channel_input_port_open(int type, int plen, void *ctxt);
+void channel_input_window_adjust(int type, int plen, void *ctxt);
+void channel_input_open(int type, int plen, void *ctxt);
/* Sets specific protocol options. */
void channel_set_options(int hostname_in_open);
@@ -246,7 +246,7 @@ char *x11_create_display_inet(int screen, int x11_display_offset);
* the remote channel number. We should do whatever we want, and respond
* with either SSH_MSG_OPEN_CONFIRMATION or SSH_MSG_OPEN_FAILURE.
*/
-void x11_input_open(int type, int plen);
+void x11_input_open(int type, int plen, void *ctxt);
/*
* Requests forwarding of X11 connections. This should be called on the
@@ -279,7 +279,7 @@ char *auth_get_socket_name(void);
int auth_input_request_forwarding(struct passwd * pw);
/* This is called to process an SSH_SMSG_AGENT_OPEN message. */
-void auth_input_open_request(int type, int plen);
+void auth_input_open_request(int type, int plen, void *ctxt);
/* XXX */
int channel_connect_to(const char *host, u_short host_port);
diff --git a/usr.bin/ssh/clientloop.c b/usr.bin/ssh/clientloop.c
index 7400a17a607..845307eba94 100644
--- a/usr.bin/ssh/clientloop.c
+++ b/usr.bin/ssh/clientloop.c
@@ -59,7 +59,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: clientloop.c,v 1.35 2000/09/14 20:25:14 markus Exp $");
+RCSID("$OpenBSD: clientloop.c,v 1.36 2000/09/21 11:25:33 markus Exp $");
#include "xmalloc.h"
#include "ssh.h"
@@ -771,7 +771,7 @@ client_process_output(fd_set * writeset)
void
client_process_buffered_input_packets()
{
- dispatch_run(DISPATCH_NONBLOCK, &quit_pending);
+ dispatch_run(DISPATCH_NONBLOCK, &quit_pending, NULL);
}
/* scan buf[] for '~' before sending data to the peer */
@@ -978,7 +978,7 @@ client_loop(int have_pty, int escape_char_arg, int ssh2_chan_id)
/*********/
void
-client_input_stdout_data(int type, int plen)
+client_input_stdout_data(int type, int plen, void *ctxt)
{
unsigned int data_len;
char *data = packet_get_string(&data_len);
@@ -989,7 +989,7 @@ client_input_stdout_data(int type, int plen)
xfree(data);
}
void
-client_input_stderr_data(int type, int plen)
+client_input_stderr_data(int type, int plen, void *ctxt)
{
unsigned int data_len;
char *data = packet_get_string(&data_len);
@@ -1000,7 +1000,7 @@ client_input_stderr_data(int type, int plen)
xfree(data);
}
void
-client_input_exit_status(int type, int plen)
+client_input_exit_status(int type, int plen, void *ctxt)
{
packet_integrity_check(plen, 4, type);
exit_status = packet_get_int();
@@ -1018,7 +1018,7 @@ client_input_exit_status(int type, int plen)
/* XXXX move to generic input handler */
void
-client_input_channel_open(int type, int plen)
+client_input_channel_open(int type, int plen, void *ctxt)
{
Channel *c = NULL;
char *ctype;
diff --git a/usr.bin/ssh/dispatch.c b/usr.bin/ssh/dispatch.c
index 3daac20224d..db8951c1b5e 100644
--- a/usr.bin/ssh/dispatch.c
+++ b/usr.bin/ssh/dispatch.c
@@ -22,7 +22,7 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "includes.h"
-RCSID("$OpenBSD: dispatch.c,v 1.4 2000/09/07 20:27:51 deraadt Exp $");
+RCSID("$OpenBSD: dispatch.c,v 1.5 2000/09/21 11:25:34 markus Exp $");
#include "ssh.h"
#include "dispatch.h"
#include "packet.h"
@@ -33,7 +33,7 @@ RCSID("$OpenBSD: dispatch.c,v 1.4 2000/09/07 20:27:51 deraadt Exp $");
dispatch_fn *dispatch[DISPATCH_MAX];
void
-dispatch_protocol_error(int type, int plen)
+dispatch_protocol_error(int type, int plen, void *ctxt)
{
error("Hm, dispatch protocol error: type %d plen %d", type, plen);
}
@@ -50,7 +50,7 @@ dispatch_set(int type, dispatch_fn *fn)
dispatch[type] = fn;
}
void
-dispatch_run(int mode, int *done)
+dispatch_run(int mode, int *done, void *ctxt)
{
for (;;) {
int plen;
@@ -64,7 +64,7 @@ dispatch_run(int mode, int *done)
return;
}
if (type > 0 && type < DISPATCH_MAX && dispatch[type] != NULL)
- (*dispatch[type])(type, plen);
+ (*dispatch[type])(type, plen, ctxt);
else
packet_disconnect("protocol error: rcvd type %d", type);
if (done != NULL && *done)
diff --git a/usr.bin/ssh/dispatch.h b/usr.bin/ssh/dispatch.h
index dc9d3dd4ecf..e60174c20da 100644
--- a/usr.bin/ssh/dispatch.h
+++ b/usr.bin/ssh/dispatch.h
@@ -26,9 +26,9 @@ enum {
DISPATCH_NONBLOCK
};
-typedef void dispatch_fn(int type, int plen);
+typedef void dispatch_fn(int type, int plen, void *ctxt);
void dispatch_init(dispatch_fn *dflt);
void dispatch_set(int type, dispatch_fn *fn);
-void dispatch_run(int mode, int *done);
-void dispatch_protocol_error(int type, int plen);
+void dispatch_run(int mode, int *done, void *ctxt);
+void dispatch_protocol_error(int type, int plen, void *ctxt);
diff --git a/usr.bin/ssh/serverloop.c b/usr.bin/ssh/serverloop.c
index 9acbe19bc5a..97e01754256 100644
--- a/usr.bin/ssh/serverloop.c
+++ b/usr.bin/ssh/serverloop.c
@@ -380,7 +380,7 @@ drain_output()
void
process_buffered_input_packets()
{
- dispatch_run(DISPATCH_NONBLOCK, NULL);
+ dispatch_run(DISPATCH_NONBLOCK, NULL, NULL);
}
/*
@@ -673,7 +673,7 @@ server_loop2(void)
}
void
-server_input_stdin_data(int type, int plen)
+server_input_stdin_data(int type, int plen, void *ctxt)
{
char *data;
unsigned int data_len;
@@ -690,7 +690,7 @@ server_input_stdin_data(int type, int plen)
}
void
-server_input_eof(int type, int plen)
+server_input_eof(int type, int plen, void *ctxt)
{
/*
* Eof from the client. The stdin descriptor to the
@@ -703,7 +703,7 @@ server_input_eof(int type, int plen)
}
void
-server_input_window_size(int type, int plen)
+server_input_window_size(int type, int plen, void *ctxt)
{
int row = packet_get_int();
int col = packet_get_int();
@@ -749,7 +749,7 @@ input_direct_tcpip(void)
}
void
-server_input_channel_open(int type, int plen)
+server_input_channel_open(int type, int plen, void *ctxt)
{
Channel *c = NULL;
char *ctype;