diff --git a/tmate-decoder.c b/tmate-decoder.c index 7489d76f..a0434d79 100644 --- a/tmate-decoder.c +++ b/tmate-decoder.c @@ -49,11 +49,12 @@ static void unpack_raw(struct tmate_unpacker *uk, if (uk->argc == 0) decoder_error(); - if (uk->argv[0].type != MSGPACK_OBJECT_RAW) + if (uk->argv[0].type != MSGPACK_OBJECT_STR && + uk->argv[0].type != MSGPACK_OBJECT_BIN) decoder_error(); - *len = uk->argv[0].via.raw.size; - *buf = uk->argv[0].via.raw.ptr; + *len = uk->argv[0].via.str.size; + *buf = uk->argv[0].via.str.ptr; uk->argv++; uk->argc--; diff --git a/tmate-encoder.c b/tmate-encoder.c index 4ec59447..94dc2137 100644 --- a/tmate-encoder.c +++ b/tmate-encoder.c @@ -2,7 +2,7 @@ #define DEFAULT_ENCODER (&tmate_session.encoder) -static int msgpack_write(void *data, const char *buf, unsigned int len) +static int msgpack_write(void *data, const char *buf, size_t len) { struct tmate_encoder *encoder = data; @@ -25,8 +25,8 @@ void tmate_encoder_init(struct tmate_encoder *encoder) #define msgpack_pack_string(pk, str) do { \ int __strlen = strlen(str); \ - msgpack_pack_raw(pk, __strlen); \ - msgpack_pack_raw_body(pk, str, __strlen); \ + msgpack_pack_str(pk, __strlen); \ + msgpack_pack_str_body(pk, str, __strlen); \ } while(0) #define pack(what, ...) msgpack_pack_##what(&DEFAULT_ENCODER->pk, __VA_ARGS__) @@ -125,8 +125,8 @@ void tmate_pty_data(struct window_pane *wp, const char *buf, size_t len) pack(array, 3); pack(int, TMATE_PTY_DATA); pack(int, wp->id); - pack(raw, to_write); - pack(raw_body, buf, to_write); + pack(str, to_write); + pack(str_body, buf, to_write); buf += to_write; len -= to_write; diff --git a/tmate-ssh-client.c b/tmate-ssh-client.c index 1c346e85..8e8db6a1 100644 --- a/tmate-ssh-client.c +++ b/tmate-ssh-client.c @@ -223,7 +223,10 @@ static void on_session_event(struct tmate_ssh_client *client) } case SSH_AUTH_SERVER: - if ((hash_len = ssh_get_pubkey_hash(session, &hash)) < 0) { + if (ssh_get_publickey(session, &pubkey) < 0) + tmate_fatal("ssh_get_publickey"); + + if (ssh_get_publickey_hash(pubkey, SSH_PUBLICKEY_HASH_MD5, &hash, &hash_len) < 0) { kill_session(client, "Cannot authenticate server"); return; } @@ -232,9 +235,6 @@ static void on_session_event(struct tmate_ssh_client *client) if (!hash_str) tmate_fatal("malloc failed"); - if (ssh_get_publickey(session, &pubkey) < 0) - tmate_fatal("ssh_get_publickey"); - key_type = ssh_key_type(pubkey); switch (key_type) {