mirror of
https://github.com/tmate-io/tmate-ssh-server.git
synced 2020-11-18 19:53:51 -08:00
parent
be2e8c7c2a
commit
aebbf047d2
@ -99,7 +99,6 @@ static void unpack_array(struct tmate_unpacker *uk,
|
|||||||
static void tmate_header(struct tmate_decoder *decoder,
|
static void tmate_header(struct tmate_decoder *decoder,
|
||||||
struct tmate_unpacker *uk)
|
struct tmate_unpacker *uk)
|
||||||
{
|
{
|
||||||
char hostname[128];
|
|
||||||
char port_arg[16] = {0};
|
char port_arg[16] = {0};
|
||||||
char *client_version = xstrdup("< 1.8.6");
|
char *client_version = xstrdup("< 1.8.6");
|
||||||
|
|
||||||
@ -117,17 +116,14 @@ static void tmate_header(struct tmate_decoder *decoder,
|
|||||||
|
|
||||||
free(client_version);
|
free(client_version);
|
||||||
|
|
||||||
if (gethostname(hostname, sizeof(hostname)) < 0)
|
|
||||||
tmate_fatal("cannot get hostname");
|
|
||||||
|
|
||||||
if (tmate_port != 22)
|
if (tmate_port != 22)
|
||||||
sprintf(port_arg, " -p%d", tmate_port);
|
sprintf(port_arg, " -p%d", tmate_port);
|
||||||
|
|
||||||
tmate_notify("Remote session read only: ssh%s ro-%s@%s.%s (clear your screen if you share this)",
|
tmate_notify("Remote session read only: ssh%s ro-%s@%s (clear your screen if you share this)",
|
||||||
port_arg, tmate_session_token_ro, hostname, TMATE_DOMAIN);
|
port_arg, tmate_session_token_ro, tmate_host);
|
||||||
|
|
||||||
tmate_notify("Remote session: ssh%s %s@%s.%s",
|
tmate_notify("Remote session: ssh%s %s@%s",
|
||||||
port_arg, tmate_session_token, hostname, TMATE_DOMAIN);
|
port_arg, tmate_session_token, tmate_host);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern u_int next_window_pane_id;
|
extern u_int next_window_pane_id;
|
||||||
|
@ -18,6 +18,8 @@
|
|||||||
#include "tmate.h"
|
#include "tmate.h"
|
||||||
|
|
||||||
int tmate_port = TMATE_DEFAULT_PORT;
|
int tmate_port = TMATE_DEFAULT_PORT;
|
||||||
|
char *tmate_host;
|
||||||
|
|
||||||
struct tmate_encoder *tmate_encoder;
|
struct tmate_encoder *tmate_encoder;
|
||||||
int tmux_socket_fd;
|
int tmux_socket_fd;
|
||||||
const char *tmate_session_token = "main";
|
const char *tmate_session_token = "main";
|
||||||
@ -39,7 +41,7 @@ extern int client_connect(char *path, int start_server);
|
|||||||
|
|
||||||
static void usage(void)
|
static void usage(void)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "usage: tmate-slave [-k keys_dir] [-l logfile] [-p PORT] [-r logfile] [-v]\n");
|
fprintf(stderr, "usage: tmate-slave [-k keys_dir] [-l logfile] [-p port] [-r logfile] [-h host] [-v]\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
void tmate_reopen_logfile(void)
|
void tmate_reopen_logfile(void)
|
||||||
@ -68,7 +70,7 @@ int main(int argc, char **argv, char **envp)
|
|||||||
const char *replay_file = NULL;
|
const char *replay_file = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
while ((opt = getopt(argc, argv, "p:l:vk:r:")) != -1) {
|
while ((opt = getopt(argc, argv, "p:l:vk:r:h:")) != -1) {
|
||||||
switch (opt) {
|
switch (opt) {
|
||||||
case 'p':
|
case 'p':
|
||||||
tmate_port = atoi(optarg);
|
tmate_port = atoi(optarg);
|
||||||
@ -89,12 +91,22 @@ int main(int argc, char **argv, char **envp)
|
|||||||
fprintf(stderr, "Record/Replay not enabled\n");
|
fprintf(stderr, "Record/Replay not enabled\n");
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
case 'h':
|
||||||
|
tmate_host = xstrdup(optarg);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
usage();
|
usage();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!tmate_host) {
|
||||||
|
char hostname[255];
|
||||||
|
if (gethostname(hostname, sizeof(hostname)) < 0)
|
||||||
|
tmate_fatal("cannot get hostname");
|
||||||
|
tmate_host = xstrdup(hostname);
|
||||||
|
}
|
||||||
|
|
||||||
cmdline = *argv;
|
cmdline = *argv;
|
||||||
cmdline_end = *envp;
|
cmdline_end = *envp;
|
||||||
|
|
||||||
|
2
tmate.h
2
tmate.h
@ -21,7 +21,6 @@ do { \
|
|||||||
/* tmate-encoder.c */
|
/* tmate-encoder.c */
|
||||||
|
|
||||||
#define TMATE_LATEST_VERSION "1.8.9"
|
#define TMATE_LATEST_VERSION "1.8.9"
|
||||||
#define TMATE_DOMAIN "tmate.io"
|
|
||||||
|
|
||||||
enum tmate_client_commands {
|
enum tmate_client_commands {
|
||||||
TMATE_NOTIFY,
|
TMATE_NOTIFY,
|
||||||
@ -163,6 +162,7 @@ extern void tmate_ssh_server_main(const char *keys_dir, int port);
|
|||||||
extern int tmate_port;
|
extern int tmate_port;
|
||||||
extern struct tmate_encoder *tmate_encoder;
|
extern struct tmate_encoder *tmate_encoder;
|
||||||
extern int tmux_socket_fd;
|
extern int tmux_socket_fd;
|
||||||
|
extern char *tmate_host;
|
||||||
extern const char *tmate_session_token;
|
extern const char *tmate_session_token;
|
||||||
extern const char *tmate_session_token_ro;
|
extern const char *tmate_session_token_ro;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user