aboutsummaryrefslogtreecommitdiff
path: root/src/jail.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/jail.c')
-rw-r--r--src/jail.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/jail.c b/src/jail.c
index 564e611..3f77dfd 100644
--- a/src/jail.c
+++ b/src/jail.c
@@ -29,6 +29,8 @@ typedef struct server_event {
typedef struct client_event {
psocket *client_sock;
+ char *host_buf;
+ char *service_buf;
int tty_fd;
int signal_fd;
char tty_logbuf[BUFSIZ];
@@ -399,7 +401,7 @@ finalise:
static int jail_socket_tty(prisoner_process *ctx, int tty_fd)
{
- static client_event ev_cli = {NULL, -1, -1, {0}, 0, 0, 0};
+ static client_event ev_cli = {NULL, NULL, NULL, -1, -1, {0}, 0, 0, 0};
int s, rc = 1;
event_ctx *ev_ctx = NULL;
sigset_t mask;
@@ -448,6 +450,8 @@ static int jail_socket_tty(prisoner_process *ctx, int tty_fd)
}
ev_cli.client_sock = &ctx->client_psock;
+ ev_cli.host_buf = &ctx->host_buf[0];
+ ev_cli.service_buf = &ctx->service_buf[0];
rc = event_loop(ev_ctx, jail_socket_tty_io, &ev_cli);
finish:
close(ev_cli.signal_fd);
@@ -508,7 +512,8 @@ static int jail_log_input(event_ctx *ev_ctx, int src_fd, int dst_fd,
if (slen == 0) {
escape_ascii_string(ev_cli->tty_logbuf, ev_cli->off_logbuf,
&ev_cli->tty_logbuf_escaped, &ev_cli->tty_logbuf_size);
- C("%s", ev_cli->tty_logbuf_escaped);
+ C("[%s:%s] %s", ev_cli->host_buf, ev_cli->service_buf,
+ ev_cli->tty_logbuf_escaped);
ev_cli->off_logbuf = 0;
ev_cli->tty_logbuf[0] = 0;
continue;
@@ -521,7 +526,8 @@ static int jail_log_input(event_ctx *ev_ctx, int src_fd, int dst_fd,
if (buf[siz-1] == '\r' || buf[siz-1] == '\n') {
escape_ascii_string(ev_cli->tty_logbuf, ev_cli->off_logbuf,
&ev_cli->tty_logbuf_escaped, &ev_cli->tty_logbuf_size);
- C("%s", ev_cli->tty_logbuf_escaped);
+ C("[%s:%s] %s", ev_cli->host_buf, ev_cli->service_buf,
+ ev_cli->tty_logbuf_escaped);
ev_cli->off_logbuf = 0;
ev_cli->tty_logbuf[0] = 0;
}