Send uname

This commit is contained in:
Nicolas Viennot 2019-11-10 15:31:54 -05:00
parent 86ec8d1ad6
commit 9fc6e96444
4 changed files with 24 additions and 0 deletions

View File

@ -1,3 +1,4 @@
#include <sys/utsname.h>
#include "tmate.h"
#include "tmate-protocol.h"
#include "window-copy.h"
@ -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);
@ -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();

View File

@ -56,6 +56,7 @@ enum tmate_daemon_out_msg_types {
TMATE_OUT_RECONNECT,
TMATE_OUT_SNAPSHOT,
TMATE_OUT_EXEC_CMD,
TMATE_OUT_UNAME,
};
/*
@ -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 {

View File

@ -200,6 +200,7 @@ void tmate_session_start(void)
}
send_authorized_keys();
tmate_write_uname();
tmate_write_ready();
lookup_and_connect();
}

View File

@ -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);