diff options
author | Damien Miller <djm@cvs.openbsd.org> | 2018-09-26 01:48:58 +0000 |
---|---|---|
committer | Damien Miller <djm@cvs.openbsd.org> | 2018-09-26 01:48:58 +0000 |
commit | 9ebd8b44a861d3bc2504df5f72edaaf1af757bac (patch) | |
tree | 936dce3501acd3f175cbfca460113004dec3c7e3 | |
parent | 3a2d8883a1cdbb2f174f667c53a3ae2cc5f0534b (diff) |
s/process_mux_master/mux_master_process/ in mux master function names,
Gives better symmetry with the existing mux_client_*() names and makes
it more obvious when a message comes from the master vs client (they
are interleved in ControlMaster=auto mode).
no functional change beyond prefixing a could of log messages with
__func__ where they were previously lacking.
-rw-r--r-- | usr.bin/ssh/mux.c | 74 |
1 files changed, 38 insertions, 36 deletions
diff --git a/usr.bin/ssh/mux.c b/usr.bin/ssh/mux.c index 512cc6e496a..77823359de9 100644 --- a/usr.bin/ssh/mux.c +++ b/usr.bin/ssh/mux.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mux.c,v 1.75 2018/07/31 03:07:24 djm Exp $ */ +/* $OpenBSD: mux.c,v 1.76 2018/09/26 01:48:57 djm Exp $ */ /* * Copyright (c) 2002-2008 Damien Miller <djm@openbsd.org> * @@ -151,23 +151,23 @@ struct mux_master_state { static void mux_session_confirm(struct ssh *, int, int, void *); static void mux_stdio_confirm(struct ssh *, int, int, void *); -static int process_mux_master_hello(struct ssh *, u_int, +static int mux_master_process_hello(struct ssh *, u_int, Channel *, struct sshbuf *, struct sshbuf *); -static int process_mux_new_session(struct ssh *, u_int, +static int mux_master_process_new_session(struct ssh *, u_int, Channel *, struct sshbuf *, struct sshbuf *); -static int process_mux_alive_check(struct ssh *, u_int, +static int mux_master_process_alive_check(struct ssh *, u_int, Channel *, struct sshbuf *, struct sshbuf *); -static int process_mux_terminate(struct ssh *, u_int, +static int mux_master_process_terminate(struct ssh *, u_int, Channel *, struct sshbuf *, struct sshbuf *); -static int process_mux_open_fwd(struct ssh *, u_int, +static int mux_master_process_open_fwd(struct ssh *, u_int, Channel *, struct sshbuf *, struct sshbuf *); -static int process_mux_close_fwd(struct ssh *, u_int, +static int mux_master_process_close_fwd(struct ssh *, u_int, Channel *, struct sshbuf *, struct sshbuf *); -static int process_mux_stdio_fwd(struct ssh *, u_int, +static int mux_master_process_stdio_fwd(struct ssh *, u_int, Channel *, struct sshbuf *, struct sshbuf *); -static int process_mux_stop_listening(struct ssh *, u_int, +static int mux_master_process_stop_listening(struct ssh *, u_int, Channel *, struct sshbuf *, struct sshbuf *); -static int process_mux_proxy(struct ssh *, u_int, +static int mux_master_process_proxy(struct ssh *, u_int, Channel *, struct sshbuf *, struct sshbuf *); static const struct { @@ -175,15 +175,15 @@ static const struct { int (*handler)(struct ssh *, u_int, Channel *, struct sshbuf *, struct sshbuf *); } mux_master_handlers[] = { - { MUX_MSG_HELLO, process_mux_master_hello }, - { MUX_C_NEW_SESSION, process_mux_new_session }, - { MUX_C_ALIVE_CHECK, process_mux_alive_check }, - { MUX_C_TERMINATE, process_mux_terminate }, - { MUX_C_OPEN_FWD, process_mux_open_fwd }, - { MUX_C_CLOSE_FWD, process_mux_close_fwd }, - { MUX_C_NEW_STDIO_FWD, process_mux_stdio_fwd }, - { MUX_C_STOP_LISTENING, process_mux_stop_listening }, - { MUX_C_PROXY, process_mux_proxy }, + { MUX_MSG_HELLO, mux_master_process_hello }, + { MUX_C_NEW_SESSION, mux_master_process_new_session }, + { MUX_C_ALIVE_CHECK, mux_master_process_alive_check }, + { MUX_C_TERMINATE, mux_master_process_terminate }, + { MUX_C_OPEN_FWD, mux_master_process_open_fwd }, + { MUX_C_CLOSE_FWD, mux_master_process_close_fwd }, + { MUX_C_NEW_STDIO_FWD, mux_master_process_stdio_fwd }, + { MUX_C_STOP_LISTENING, mux_master_process_stop_listening }, + { MUX_C_PROXY, mux_master_process_proxy }, { 0, NULL } }; @@ -251,7 +251,7 @@ env_permitted(char *env) return 0; ret = snprintf(name, sizeof(name), "%.*s", (int)(cp - env), env); if (ret <= 0 || (size_t)ret >= sizeof(name)) { - error("env_permitted: name '%.100s...' too long", env); + error("%s: name '%.100s...' too long", __func__, env); return 0; } @@ -265,7 +265,7 @@ env_permitted(char *env) /* Mux master protocol message handlers */ static int -process_mux_master_hello(struct ssh *ssh, u_int rid, +mux_master_process_hello(struct ssh *ssh, u_int rid, Channel *c, struct sshbuf *m, struct sshbuf *reply) { u_int ver; @@ -283,8 +283,8 @@ process_mux_master_hello(struct ssh *ssh, u_int rid, return -1; } if (ver != SSHMUX_VER) { - error("Unsupported multiplexing protocol version %d " - "(expected %d)", ver, SSHMUX_VER); + error("%s: unsupported multiplexing protocol version %u " + "(expected %u)", __func__, ver, SSHMUX_VER); return -1; } debug2("%s: channel %d slave version %u", __func__, c->self, ver); @@ -292,14 +292,16 @@ process_mux_master_hello(struct ssh *ssh, u_int rid, /* No extensions are presently defined */ while (sshbuf_len(m) > 0) { char *name = NULL; + size_t value_len = 0; if ((r = sshbuf_get_cstring(m, &name, NULL)) != 0 || - (r = sshbuf_skip_string(m)) != 0) { /* value */ + (r = sshbuf_get_string_direct(m, NULL, &value_len)) != 0) { error("%s: malformed extension: %s", __func__, ssh_err(r)); return -1; } - debug2("Unrecognised slave extension \"%s\"", name); + debug2("%s: Unrecognised extension \"%s\" length %zu", + __func__, name, value_len); free(name); } state->hello_rcvd = 1; @@ -330,7 +332,7 @@ reply_error(struct sshbuf *reply, u_int type, u_int rid, const char *msg) } static int -process_mux_new_session(struct ssh *ssh, u_int rid, +mux_master_process_new_session(struct ssh *ssh, u_int rid, Channel *c, struct sshbuf *m, struct sshbuf *reply) { Channel *nc; @@ -378,8 +380,8 @@ process_mux_new_session(struct ssh *ssh, u_int rid, cctx->env[env_len++] = cp; cctx->env[env_len] = NULL; if (env_len > MUX_MAX_ENV_VARS) { - error(">%d environment variables received, ignoring " - "additional", MUX_MAX_ENV_VARS); + error("%s: >%d environment variables received, " + "ignoring additional", __func__, MUX_MAX_ENV_VARS); break; } } @@ -496,7 +498,7 @@ process_mux_new_session(struct ssh *ssh, u_int rid, } static int -process_mux_alive_check(struct ssh *ssh, u_int rid, +mux_master_process_alive_check(struct ssh *ssh, u_int rid, Channel *c, struct sshbuf *m, struct sshbuf *reply) { int r; @@ -513,7 +515,7 @@ process_mux_alive_check(struct ssh *ssh, u_int rid, } static int -process_mux_terminate(struct ssh *ssh, u_int rid, +mux_master_process_terminate(struct ssh *ssh, u_int rid, Channel *c, struct sshbuf *m, struct sshbuf *reply) { debug2("%s: channel %d: terminate request", __func__, c->self); @@ -681,7 +683,7 @@ mux_confirm_remote_forward(struct ssh *ssh, int type, u_int32_t seq, void *ctxt) } static int -process_mux_open_fwd(struct ssh *ssh, u_int rid, +mux_master_process_open_fwd(struct ssh *ssh, u_int rid, Channel *c, struct sshbuf *m, struct sshbuf *reply) { struct Forward fwd; @@ -810,7 +812,7 @@ process_mux_open_fwd(struct ssh *ssh, u_int rid, if (!channel_setup_local_fwd_listener(ssh, &fwd, &options.fwd_opts)) { fail: - logit("slave-requested %s failed", fwd_desc); + logit("%s: requested %s failed", __func__, fwd_desc); reply_error(reply, MUX_S_FAILURE, rid, "Port forwarding failed"); goto out; @@ -848,7 +850,7 @@ process_mux_open_fwd(struct ssh *ssh, u_int rid, } static int -process_mux_close_fwd(struct ssh *ssh, u_int rid, +mux_master_process_close_fwd(struct ssh *ssh, u_int rid, Channel *c, struct sshbuf *m, struct sshbuf *reply) { struct Forward fwd, *found_fwd; @@ -960,7 +962,7 @@ process_mux_close_fwd(struct ssh *ssh, u_int rid, } static int -process_mux_stdio_fwd(struct ssh *ssh, u_int rid, +mux_master_process_stdio_fwd(struct ssh *ssh, u_int rid, Channel *c, struct sshbuf *m, struct sshbuf *reply) { Channel *nc; @@ -1098,7 +1100,7 @@ mux_stdio_confirm(struct ssh *ssh, int id, int success, void *arg) } static int -process_mux_stop_listening(struct ssh *ssh, u_int rid, +mux_master_process_stop_listening(struct ssh *ssh, u_int rid, Channel *c, struct sshbuf *m, struct sshbuf *reply) { debug("%s: channel %d: stop listening", __func__, c->self); @@ -1128,7 +1130,7 @@ process_mux_stop_listening(struct ssh *ssh, u_int rid, } static int -process_mux_proxy(struct ssh *ssh, u_int rid, +mux_master_process_proxy(struct ssh *ssh, u_int rid, Channel *c, struct sshbuf *m, struct sshbuf *reply) { int r; |