}
/* Do not send the channel key if private channel key mode is set */
- if (channel->mode & SILC_CHANNEL_MODE_PRIVKEY)
+ if (channel->mode & SILC_CHANNEL_MODE_PRIVKEY || !channel->channel_key)
continue;
silc_server_send_channel_key(server, NULL, channel,
static SilcServerEntry
silc_server_update_clients_by_real_server(SilcServer server,
SilcServerEntry from,
+ SilcServerEntry to,
SilcClientEntry client,
bool local,
SilcIDCacheEntry client_cache)
SilcServerEntry server_entry;
SilcIDCacheEntry id_cache = NULL;
SilcIDCacheList list;
+ bool tolocal = (to == server->id_entry);
if (!silc_idcache_get_all(server->local_list->servers, &list))
return NULL;
while (id_cache) {
server_entry = (SilcServerEntry)id_cache->context;
if (server_entry != from &&
+ (tolocal || server_entry != server->id_entry) &&
SILC_ID_COMPARE(server_entry->id, client->id,
client->id->ip.data_len)) {
SILC_LOG_DEBUG(("Found (local) %s",
if (silc_idcache_list_first(list, &id_cache)) {
while (id_cache) {
server_entry = (SilcServerEntry)id_cache->context;
- if (server_entry != from &&
+ if (server_entry != from && server_entry != server->id_entry &&
+ (tolocal || server_entry != server->id_entry) &&
SILC_ID_COMPARE(server_entry->id, client->id,
client->id->ip.data_len)) {
SILC_LOG_DEBUG(("Found (global) %s",
if (client->router == from) {
if (resolve_real_server) {
client->router =
- silc_server_update_clients_by_real_server(server, from, client,
- local, id_cache);
+ silc_server_update_clients_by_real_server(server, from, to,
+ client, local,
+ id_cache);
if (!client->router) {
if (server->server_type == SILC_ROUTER)
client->router = from;
if (client->router)
SILC_LOG_DEBUG(("Client changed to %s",
- silc_id_render(client->router->id, SILC_ID_CLIENT)));
+ silc_id_render(client->router->id, SILC_ID_SERVER)));
if (!silc_idcache_list_next(list, &id_cache))
break;
if (client->router == from) {
if (resolve_real_server) {
client->router =
- silc_server_update_clients_by_real_server(server, from, client,
- local, id_cache);
+ silc_server_update_clients_by_real_server(server, from, to,
+ client, local,
+ id_cache);
if (!client->router)
client->router = from;
} else {
if (client->router)
SILC_LOG_DEBUG(("Client changed to %s",
- silc_id_render(client->router->id, SILC_ID_CLIENT)));
+ silc_id_render(client->router->id, SILC_ID_SERVER)));
if (!silc_idcache_list_next(list, &id_cache))
break;
silc_hash_table_list(channel->user_list, &htl);
while (silc_hash_table_get(&htl, NULL, (void **)&chl)) {
- if (!chl->client->router) {
+ if (SILC_IS_LOCAL(chl->client)) {
silc_hash_table_list_reset(&htl);
return TRUE;
}
SILC_SERVER_SEND_NOTIFY(server, sock, SILC_NOTIFY_TYPE_NONE,
("Your connection is secured with %s cipher, "
"key length %d bits",
- idata->send_key->cipher->name,
- idata->send_key->cipher->key_len));
+ silc_cipher_get_name(idata->send_key),
+ silc_cipher_get_key_len(idata->send_key)));
SILC_SERVER_SEND_NOTIFY(server, sock, SILC_NOTIFY_TYPE_NONE,
("Your current nickname is %s",
client->nickname));
SilcClientEntry entry = context;
SilcSocketConnection sock;
+ if (!context)
+ return;
+
if (entry == notify->client)
return;