summaryrefslogtreecommitdiffstats
path: root/server-msg.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicholas.marriott@gmail.com>2007-11-16 21:31:03 +0000
committerNicholas Marriott <nicholas.marriott@gmail.com>2007-11-16 21:31:03 +0000
commit6e0452459640b892e8fc2ea7435f5e847cc33967 (patch)
tree7bf5073b666d65e134df81b79d98c1bd759072c9 /server-msg.c
parentb359f9b594ccd945a245e429469d3c53fb6bf859 (diff)
switch-client command.
Diffstat (limited to 'server-msg.c')
-rw-r--r--server-msg.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/server-msg.c b/server-msg.c
index 7c132d7a..3af04de8 100644
--- a/server-msg.c
+++ b/server-msg.c
@@ -1,4 +1,4 @@
-/* $Id: server-msg.c,v 1.31 2007-11-16 21:12:31 nicm Exp $ */
+/* $Id: server-msg.c,v 1.32 2007-11-16 21:31:03 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -111,6 +111,8 @@ server_msg_fn_command(struct hdr *hdr, struct client *c)
char *name, *client, *cause;
u_int i;
+ /* XXX I hate this function. Split it? */
+
if (hdr->size < sizeof data)
fatalx("bad MSG_COMMAND size");
buffer_read(c->in, &data, sizeof data);
@@ -141,8 +143,8 @@ server_msg_fn_command(struct hdr *hdr, struct client *c)
}
} else {
if (client == NULL) {
- server_msg_fn_command_error(&ctx, "%s: must "
- "specify a client: %s", cmd->entry->name, client);
+ server_msg_fn_command_error(&ctx,
+ "%s: must specify a client: %s", cmd->entry->name);
goto out;
}
for (i = 0; i < ARRAY_LENGTH(&clients); i++) {
@@ -158,15 +160,15 @@ server_msg_fn_command(struct hdr *hdr, struct client *c)
}
}
- ctx.session = server_extract_session(&data, name, &cause);
+ ctx.session = NULL;
if (cmd->entry->flags & CMD_NOSESSION) {
- if (ctx.session != NULL) {
+ if (name != NULL) {
server_msg_fn_command_error(&ctx,
"%s: cannot specify a session", cmd->entry->name);
goto out;
- } else
- xfree(cause);
+ }
} else {
+ ctx.session = server_extract_session(&data, name, &cause);
if (ctx.session == NULL) {
server_msg_fn_command_error(
&ctx, "%s: %s", cmd->entry->name, cause);