Author: Pekka Riikonen <priikone@silcnet.org>
- Copyright (C) 1997 - 2008 Pekka Riikonen
+ Copyright (C) 1997 - 2009 Pekka Riikonen
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
SilcBuffer tmpreply;
int i;
- SILC_LOG_DEBUG(("Timeout pending command"));
+ SILC_LOG_DEBUG(("Timeout pending command %p", reply));
/* Allocate temporary and bogus command reply context */
cmdr = silc_calloc(1, sizeof(*cmdr));
char info_string[256];
memset(info_string, 0, sizeof(info_string));
- snprintf(info_string, sizeof(info_string),
- "location: %s server: %s admin: %s <%s>",
- server->config->server_info->location,
- server->config->server_info->server_type,
- server->config->server_info->admin,
- server->config->server_info->email);
+ silc_snprintf(info_string, sizeof(info_string),
+ "location: %s server: %s admin: %s <%s> version: %s",
+ server->config->server_info->location,
+ server->config->server_info->server_type,
+ server->config->server_info->admin,
+ server->config->server_info->email,
+ silc_dist_version);
server_info = info_string;
entry = server->id_entry;
SilcServer server = cmd->server;
SilcClientEntry client = silc_packet_get_context(cmd->sock);
unsigned char *tmp_mask, m[4];
- SilcUInt32 mask = 0;
+ SilcUInt32 mask = 0, tmp_len;
SilcUInt16 ident = silc_command_get_ident(cmd->payload);
SilcBool set_mask = FALSE;
SILC_SERVER_COMMAND_CHECK(SILC_COMMAND_UMODE, cmd, 1, 2);
/* Get the client's mode mask */
- tmp_mask = silc_argument_get_arg_type(cmd->args, 2, NULL);
- if (tmp_mask) {
+ tmp_mask = silc_argument_get_arg_type(cmd->args, 2, &tmp_len);
+ if (tmp_mask && tmp_len == 4) {
SILC_GET32_MSB(mask, tmp_mask);
set_mask = TRUE;
}
/* Get the channel mode mask */
tmp_mask = silc_argument_get_arg_type(cmd->args, 2, &tmp_len);
- if (tmp_mask) {
+ if (tmp_mask && tmp_len == 4) {
SILC_GET32_MSB(mode_mask, tmp_mask);
set_mask = TRUE;
}
SilcClientID *client_id = (SilcClientID *)q->sock;
SilcClientEntry client;
SilcPacketStream sock;
+ SilcIDListData idata;
+
client = silc_idlist_find_client_by_id(server->local_list, client_id,
TRUE, NULL);
if (client && client->connection) {
sock = client->connection;
+ SILC_LOG_DEBUG(("Detaching client %s",
+ silc_id_render(client->id, SILC_ID_CLIENT)));
+
+ /* Stop rekey for the client. */
+ silc_server_stop_rekey(server, client);
+
+ /* Abort any active protocol */
+ idata = silc_packet_get_context(sock);
+ if (idata && idata->sconn && idata->sconn->op) {
+ SILC_LOG_DEBUG(("Abort active protocol"));
+ silc_async_abort(idata->sconn->op, NULL, NULL);
+ idata->sconn->op = NULL;
+ }
+
/* Close the connection on our side */
client->router = NULL;
client->connection = NULL;
silc_server_close_connection(server, sock);
+
+ /* Mark the client as locally detached. */
+ client->local_detached = TRUE;
+
+ /*
+ * Decrement the user count; we'll increment it if the user resumes on our
+ * server.
+ */
+ SILC_VERIFY(&server->stat.my_clients > 0);
+ server->stat.my_clients--;
}
silc_free(client_id);