SilcClientEntry client = NULL, client2 = NULL;
SilcServerEntry server_entry = NULL;
SilcChannelClientEntry chl;
- SilcIDCacheEntry cache;
+ SilcIDCacheEntry cache = NULL;
SilcHashTableList htl;
SilcUInt32 mode;
unsigned char *tmp;
entry for the client. */
client = silc_idlist_find_client_by_id(server->global_list,
client_id, server->server_type,
- NULL);
+ &cache);
if (!client) {
client = silc_idlist_find_client_by_id(server->local_list,
client_id, server->server_type,
- NULL);
+ &cache);
if (!client) {
/* If router did not find the client the it is bogus */
- if (server->server_type != SILC_SERVER)
+ if (server->server_type != SILC_SERVER) {
+ silc_free(client_id);
goto out;
+ }
client =
silc_idlist_add_client(server->global_list, NULL, NULL, NULL,
client->data.status |= SILC_IDLIST_STATUS_REGISTERED;
}
}
+ silc_free(client_id);
/* Do not process the notify if the client is not registered */
if (!(client->data.status & SILC_IDLIST_STATUS_REGISTERED))
silc_hash_table_add(channel->user_list, client, chl);
silc_hash_table_add(client->channels, channel, chl);
- silc_free(client_id);
channel->user_count++;
channel->disabled = FALSE;
+ /* Make sure we don't expire clients that are on channel */
+ if (cache)
+ cache->expire = 0;
+
/* Update statistics */
if (server->server_type == SILC_ROUTER) {
if (sock->type != SILC_SOCKET_TYPE_ROUTER)
goto out;
}
}
+ silc_free(channel_id);
if (channel->topic && !strcmp(channel->topic, tmp)) {
SILC_LOG_DEBUG(("Topic is already set and same"));
silc_server_packet_send_to_channel(server, NULL, channel, packet->type,
FALSE, packet->buffer->data,
packet->buffer->len, FALSE);
- silc_free(channel_id);
break;
case SILC_NOTIFY_TYPE_NICK_CHANGE:
if (!id2)
goto out;
client_id2 = silc_id_payload_parse_id(id2, tmp_len, NULL);
- if (!client_id2)
+ if (!client_id2) {
+ silc_free(client_id);
goto out;
+ }
SILC_LOG_DEBUG(("Old Client ID id(%s)",
silc_id_render(client_id, SILC_ID_CLIENT)));
silc_server_del_from_watcher_list(server, client);
/* Remove the client */
+ silc_idlist_del_data(client);
silc_idlist_del_client(local ? server->local_list :
server->global_list, client);
}
server->stat.detached--;
}
}
+ SILC_UMODE_STATS_UPDATE(server, SILC_UMODE_SERVER_OPERATOR);
+ SILC_UMODE_STATS_UPDATE(router, SILC_UMODE_ROUTER_OPERATOR);
/* Change the mode */
client->mode = mode;
if (client) {
silc_server_remove_from_channels(server, NULL, client, TRUE,
NULL, TRUE);
+ silc_idlist_del_data(client);
silc_idlist_del_client(server->global_list, client);
}
silc_free(client_id);
snprintf(&nickname[strlen(nickname) - 1], 1, "%d", nickfail);
}
+ /* If client marked as anonymous, scramble the username and hostname */
+ if (client->mode & SILC_UMODE_ANONYMOUS) {
+ char *scramble;
+
+ if (strlen(username) >= 2) {
+ username[0] = silc_rng_get_byte_fast(server->rng);
+ username[1] = silc_rng_get_byte_fast(server->rng);
+ }
+
+ scramble = silc_hash_babbleprint(server->sha1hash, username,
+ strlen(username));
+ scramble[5] = '@';
+ scramble[11] = '.';
+ memcpy(&scramble[16], ".silc", 5);
+ scramble[21] = '\0';
+ silc_free(username);
+ username = scramble;
+ }
+
/* Update client entry */
idata->status |= SILC_IDLIST_STATUS_REGISTERED;
client->nickname = nickname;