Merge branch 'obsd-master' into mtemp

This commit is contained in:
Thomas
2013-10-11 14:33:29 +01:00
93 changed files with 1001 additions and 895 deletions

View File

@ -56,8 +56,8 @@ server_write_ready(struct client *c)
}
int
server_write_client(
struct client *c, enum msgtype type, const void *buf, size_t len)
server_write_client(struct client *c, enum msgtype type, const void *buf,
size_t len)
{
struct imsgbuf *ibuf = &c->ibuf;
int error;
@ -73,8 +73,8 @@ server_write_client(
}
void
server_write_session(
struct session *s, enum msgtype type, const void *buf, size_t len)
server_write_session(struct session *s, enum msgtype type, const void *buf,
size_t len)
{
struct client *c;
u_int i;
@ -235,9 +235,7 @@ server_lock_session(struct session *s)
void
server_lock_client(struct client *c)
{
const char *cmd;
size_t cmdlen;
struct msg_lock_data lockdata;
const char *cmd;
if (c->flags & CLIENT_CONTROL)
return;
@ -246,8 +244,7 @@ server_lock_client(struct client *c)
return;
cmd = options_get_string(&c->session->options, "lock-command");
cmdlen = strlcpy(lockdata.cmd, cmd, sizeof lockdata.cmd);
if (cmdlen >= sizeof lockdata.cmd)
if (strlen(cmd) + 1 > MAX_IMSGSIZE - IMSG_HEADER_SIZE)
return;
tty_stop_tty(&c->tty);
@ -256,7 +253,7 @@ server_lock_client(struct client *c)
tty_raw(&c->tty, tty_term_string(c->tty.term, TTYC_E3));
c->flags |= CLIENT_SUSPENDED;
server_write_client(c, MSG_LOCK, &lockdata, sizeof lockdata);
server_write_client(c, MSG_LOCK, cmd, strlen(cmd) + 1);
}
void
@ -398,14 +395,15 @@ void
server_destroy_session_group(struct session *s)
{
struct session_group *sg;
struct session *s1;
if ((sg = session_group_find(s)) == NULL)
server_destroy_session(s);
else {
TAILQ_FOREACH(s, &sg->sessions, gentry)
TAILQ_FOREACH_SAFE(s, &sg->sessions, gentry, s1) {
server_destroy_session(s);
TAILQ_REMOVE(&session_groups, sg, entry);
free(sg);
session_destroy(s);
}
}
}