Skip to content

Commit

Permalink
Send uname
Browse files Browse the repository at this point in the history
  • Loading branch information
nviennot committed Nov 10, 2019
1 parent 86ec8d1 commit 9fc6e96
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tmate-encoder.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include <sys/utsname.h>
#include "tmate.h"
#include "tmate-protocol.h"
#include "window-copy.h"
Expand All @@ -12,6 +13,23 @@ void tmate_write_header(void)
pack(string, VERSION);
}

void tmate_write_uname(void)
{
struct utsname name;
if (uname(&name) < 0) {
tmate_debug("uname() failed");
return;
}

pack(array, 6);
pack(int, TMATE_OUT_UNAME);
pack(string, name.sysname);
pack(string, name.nodename);
pack(string, name.release);
pack(string, name.version);
pack(string, name.machine);
}

void tmate_write_ready(void)
{
pack(array, 1);
Expand Down Expand Up @@ -464,6 +482,7 @@ void tmate_send_reconnection_state(struct tmate_session *session)
tmate_send_reconnection_data(session);
replay_saved_cmd(session);
/* TODO send all option variables */
tmate_write_uname();
tmate_write_ready();

tmate_sync_layout();
Expand Down
3 changes: 3 additions & 0 deletions tmate-protocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ enum tmate_daemon_out_msg_types {
TMATE_OUT_RECONNECT,
TMATE_OUT_SNAPSHOT,
TMATE_OUT_EXEC_CMD,
TMATE_OUT_UNAME,
};

/*
Expand All @@ -77,6 +78,8 @@ enum tmate_daemon_out_msg_types {
[TMATE_OUT_RECONNECT, string: reconnection_data]
[TMATE_OUT_SNAPSHOT, ...]
[TMATE_OUT_EXEC_CMD, string: cmd_name, ...string: args]
[TMATE_OUT_UNAME, string: name.sysname, string: name.nodename,
string: name.release, string: name.version, string: name.machine]
*/

enum tmate_daemon_in_msg_types {
Expand Down
1 change: 1 addition & 0 deletions tmate-session.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ void tmate_session_start(void)
}

send_authorized_keys();
tmate_write_uname();
tmate_write_ready();
lookup_and_connect();
}
Expand Down
1 change: 1 addition & 0 deletions tmate.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ extern void unpack_array(struct tmate_unpacker *uk, struct tmate_unpacker *neste
struct tmate_session;

extern void tmate_write_header(void);
extern void tmate_write_uname(void);
extern void tmate_write_ready(void);
extern void tmate_sync_layout(void);
extern void tmate_pty_data(struct window_pane *wp, const char *buf, size_t len);
Expand Down

0 comments on commit 9fc6e96

Please sign in to comment.