diff options
author | Nicholas Marriott <nicholas.marriott@gmail.com> | 2007-10-23 10:48:23 +0000 |
---|---|---|
committer | Nicholas Marriott <nicholas.marriott@gmail.com> | 2007-10-23 10:48:23 +0000 |
commit | 688a487570e39312c39d7a46e0a7ed6e61392ee8 (patch) | |
tree | ed01d3073c1decf05b67adc25a19b0901d16d1e9 /server-msg.c | |
parent | 21c17da7e6f4631dc418a7b1768d217ce1ccae2f (diff) |
Lift last MAXNAMELEN limit on -s argument.
Diffstat (limited to 'server-msg.c')
-rw-r--r-- | server-msg.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/server-msg.c b/server-msg.c index 7b696ff5..15be6f88 100644 --- a/server-msg.c +++ b/server-msg.c @@ -1,4 +1,4 @@ -/* $Id: server-msg.c,v 1.28 2007-10-23 09:36:19 nicm Exp $ */ +/* $Id: server-msg.c,v 1.29 2007-10-23 10:48:23 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -108,11 +108,12 @@ server_msg_fn_command(struct hdr *hdr, struct client *c) struct msg_command_data data; struct cmd_ctx ctx; struct cmd *cmd; - char *cause; + char *name, *cause; if (hdr->size < sizeof data) fatalx("bad MSG_COMMAND size"); buffer_read(c->in, &data, sizeof data); + name = cmd_recv_string(c->in); cmd = cmd_recv(c->in); log_debug("got command %s from client %d", cmd->entry->name, c->fd); @@ -123,26 +124,29 @@ server_msg_fn_command(struct hdr *hdr, struct client *c) ctx.client = c; ctx.flags = 0; - if (data.sid.pid != -1 && (cmd->entry->flags & CMD_CANTNEST)) { + if (data.pid != -1 && (cmd->entry->flags & CMD_CANTNEST)) { server_msg_fn_command_error(&ctx, "sessions should be nested " "with care. unset $TMUX to force"); - return (0); + goto out; } if (cmd->entry->flags & CMD_NOSESSION) ctx.session = NULL; else { - ctx.session = server_find_sessid(&data.sid, &cause); + ctx.session = server_extract_session(&data, name, &cause); if (ctx.session == NULL) { server_msg_fn_command_error(&ctx, "%s", cause); xfree(cause); - return (0); + goto out; } } cmd_exec(cmd, &ctx); cmd_free(cmd); +out: + if (name != NULL) + xfree(name); return (0); } |