From: Pekka Riikonen Date: Wed, 17 Oct 2001 20:51:57 +0000 (+0000) Subject: updates. X-Git-Tag: silcertest~79 X-Git-Url: http://git.silcnet.org/gitweb/?p=silc.git;a=commitdiff_plain;h=62cb7719f63ea3d3b7620533f5797dc7546b215a updates. --- diff --git a/TODO b/TODO index 56c3ab51..ca95f2e1 100644 --- a/TODO +++ b/TODO @@ -46,6 +46,12 @@ TODO/bugs In SILC Client Library TODO/bugs In SILC Server ======================== + o After backup resuming protocol some of the server's SilcIDListData + on primary that came back online are NULL. Seems actually that the + udpate_client_by_server does not work since the client->router, and + the client->router->connection->user_data are not same, and they + should be. + o Server signoff notifys does not go to normal servers from routers. o Channel user mode changes are notified unnecessarely when switching diff --git a/apps/silcd/packet_send.c b/apps/silcd/packet_send.c index 81305e72..b18da81a 100644 --- a/apps/silcd/packet_send.c +++ b/apps/silcd/packet_send.c @@ -403,20 +403,17 @@ silc_server_packet_send_to_channel_real(SilcServer server, bool channel_message, bool force_send) { - int block_len = 0; + int block_len; packet->truelen = data_len + SILC_PACKET_HEADER_LEN + packet->src_id_len + packet->dst_id_len; - if (cipher) { - block_len = silc_cipher_get_block_len(cipher); - - if (channel_message) - packet->padlen = SILC_PACKET_PADLEN((SILC_PACKET_HEADER_LEN + - packet->src_id_len + - packet->dst_id_len), block_len); - else - packet->padlen = SILC_PACKET_PADLEN(packet->truelen, block_len); - } + block_len = cipher ? silc_cipher_get_block_len(cipher) : 0; + if (channel_message) + packet->padlen = SILC_PACKET_PADLEN((SILC_PACKET_HEADER_LEN + + packet->src_id_len + + packet->dst_id_len), block_len); + else + packet->padlen = SILC_PACKET_PADLEN(packet->truelen, block_len); /* Prepare outgoing data buffer for packet sending */ silc_packet_send_prepare(sock, @@ -578,7 +575,7 @@ void silc_server_packet_send_to_channel(SilcServer server, if (sender && sock == sender) continue; - /* Send the packet */ + /* Send the packet */ silc_server_packet_send_to_channel_real(server, sock, &packetdata, idata->send_key, idata->hmac_send, @@ -1419,7 +1416,6 @@ void silc_server_send_notify_on_channels(SilcServer server, uint32 data_len; bool force_send = FALSE; va_list ap; - int block_len; SILC_LOG_DEBUG(("Start")); @@ -1471,15 +1467,18 @@ void silc_server_send_notify_on_channels(SilcServer server, /* Get data used in packet header encryption, keys and stuff. */ sock = (SilcSocketConnection)c->router->connection; idata = (SilcIDListData)c->router; - block_len = idata->send_key ? - silc_cipher_get_block_len(idata->send_key) : 0; + + { + SILC_LOG_DEBUG(("*****************")); + SILC_LOG_DEBUG(("client->router->id %s", + silc_id_render(c->router->id, SILC_ID_SERVER))); + SILC_LOG_DEBUG(("client->router->connection->user_data->id %s", + silc_id_render(((SilcServerEntry)sock->user_data)->id, SILC_ID_SERVER))); + } packetdata.dst_id = silc_id_id2str(c->router->id, SILC_ID_SERVER); packetdata.dst_id_len = silc_id_get_len(c->router->id, SILC_ID_SERVER); packetdata.dst_id_type = SILC_ID_SERVER; - packetdata.truelen = data_len + SILC_PACKET_HEADER_LEN + - packetdata.src_id_len + packetdata.dst_id_len; - packetdata.padlen = SILC_PACKET_PADLEN(packetdata.truelen, block_len); /* Send the packet */ silc_server_packet_send_to_channel_real(server, sock, &packetdata, @@ -1507,15 +1506,10 @@ void silc_server_send_notify_on_channels(SilcServer server, /* Get data used in packet header encryption, keys and stuff. */ sock = (SilcSocketConnection)c->connection; idata = (SilcIDListData)c; - block_len = idata->send_key ? - silc_cipher_get_block_len(idata->send_key) : 0; packetdata.dst_id = silc_id_id2str(c->id, SILC_ID_CLIENT); packetdata.dst_id_len = silc_id_get_len(c->id, SILC_ID_CLIENT); packetdata.dst_id_type = SILC_ID_CLIENT; - packetdata.truelen = data_len + SILC_PACKET_HEADER_LEN + - packetdata.src_id_len + packetdata.dst_id_len; - packetdata.padlen = SILC_PACKET_PADLEN(packetdata.truelen, block_len); /* Send the packet */ silc_server_packet_send_to_channel_real(server, sock, &packetdata, diff --git a/apps/silcd/server_backup.c b/apps/silcd/server_backup.c index f997ef2f..e4064319 100644 --- a/apps/silcd/server_backup.c +++ b/apps/silcd/server_backup.c @@ -1120,9 +1120,9 @@ SILC_TASK_CALLBACK_GLOBAL(silc_server_protocol_backup) /* Update the client entries of the backup router to the new router */ + silc_server_update_servers_by_server(server, backup_router, router); silc_server_update_clients_by_server(server, backup_router, router, TRUE, FALSE); - silc_server_update_servers_by_server(server, backup_router, router); silc_server_backup_replaced_del(server, backup_router); silc_server_backup_add(server, backup_router, ctx->sock->ip, ctx->sock->port, diff --git a/apps/silcd/server_util.c b/apps/silcd/server_util.c index 8184b2e7..b86abec9 100644 --- a/apps/silcd/server_util.c +++ b/apps/silcd/server_util.c @@ -353,15 +353,33 @@ silc_server_update_clients_by_real_server(SilcServer server, SILC_LOG_DEBUG(("Found (local) %s", silc_id_render(server_entry->id, SILC_ID_SERVER))); - /* If the client is not marked as local then move it to local list - since the server is local. */ - if (server_entry->server_type != SILC_BACKUP_ROUTER && !local) { - SILC_LOG_DEBUG(("Moving client to local list")); - silc_idcache_add(server->local_list->clients, client_cache->name, - client_cache->id, client_cache->context, - client_cache->expire); - silc_idcache_del_by_context(server->global_list->clients, client); +#if 0 + if (!server_entry->data.send_key && server_entry->router) { + SILC_LOG_DEBUG(("Server not locally connected, use its router")); + /* If the client is not marked as local then move it to local list + since the server is local. */ + if (!local) { + SILC_LOG_DEBUG(("Moving client to local list")); + silc_idcache_add(server->local_list->clients, client_cache->name, + client_cache->id, client_cache->context, + client_cache->expire); + silc_idcache_del_by_context(server->global_list->clients, client); + } + server_entry = server_entry->router; + } else { +#endif + /* If the client is not marked as local then move it to local list + since the server is local. */ + if (server_entry->server_type != SILC_BACKUP_ROUTER && !local) { + SILC_LOG_DEBUG(("Moving client to local list")); + silc_idcache_add(server->local_list->clients, client_cache->name, + client_cache->id, client_cache->context, + client_cache->expire); + silc_idcache_del_by_context(server->global_list->clients, client); + } +#if 0 } +#endif silc_idcache_list_free(list); return server_entry; @@ -386,15 +404,33 @@ silc_server_update_clients_by_real_server(SilcServer server, SILC_LOG_DEBUG(("Found (global) %s", silc_id_render(server_entry->id, SILC_ID_SERVER))); - /* If the client is marked as local then move it to global list - since the server is global. */ - if (server_entry->server_type != SILC_BACKUP_ROUTER && local) { - SILC_LOG_DEBUG(("Moving client to global list")); - silc_idcache_add(server->global_list->clients, client_cache->name, - client_cache->id, client_cache->context, - client_cache->expire); - silc_idcache_del_by_context(server->local_list->clients, client); +#if 0 + if (!server_entry->data.send_key && server_entry->router) { + SILC_LOG_DEBUG(("Server not locally connected, use its router")); + /* If the client is marked as local then move it to global list + since the server is global. */ + if (local) { + SILC_LOG_DEBUG(("Moving client to global list")); + silc_idcache_add(server->global_list->clients, client_cache->name, + client_cache->id, client_cache->context, + client_cache->expire); + silc_idcache_del_by_context(server->local_list->clients, client); + } + server_entry = server_entry->router; + } else { +#endif + /* If the client is marked as local then move it to global list + since the server is global. */ + if (server_entry->server_type != SILC_BACKUP_ROUTER && local) { + SILC_LOG_DEBUG(("Moving client to global list")); + silc_idcache_add(server->global_list->clients, client_cache->name, + client_cache->id, client_cache->context, + client_cache->expire); + silc_idcache_del_by_context(server->local_list->clients, client); + } +#if 0 } +#endif silc_idcache_list_free(list); return server_entry; diff --git a/distributions b/distributions index 9591ef24..e55e5e0f 100644 --- a/distributions +++ b/distributions @@ -57,14 +57,14 @@ toolkit_EXTRA_DIST=README.CVS README.WIN32 # Irssi SILC Client distribution client_SUBDIRS=lib irssi doc includes -client_SUBDIRS_lib=contrib silccore silccrypt silcsim silcmath silcske silcutil trq silcclient +client_SUBDIRS_lib=contrib silccore silccrypt silcsim silcmath silcske silcutil trq silcclient silcsftp client_SUBDIRS_doc=$(COMMONDIRS) client_DISTLABEL=SILC_DIST_CLIENT client_EXTRA_DIST=# # SILC Server distribution server_SUBDIRS=lib silcd doc includes -server_SUBDIRS_lib=contrib silccore silccrypt silcsim silcmath silcske silcutil trq dotconf +server_SUBDIRS_lib=contrib silccore silccrypt silcsim silcmath silcske silcutil trq dotconf silcsftp server_SUBDIRS_doc=$(COMMONDIRS) server_DISTLABEL=SILC_DIST_SERVER server_EXTRA_DIST=# diff --git a/lib/silccore/silcpacket.c b/lib/silccore/silcpacket.c index ddf54e00..2e7b9cbf 100644 --- a/lib/silccore/silcpacket.c +++ b/lib/silccore/silcpacket.c @@ -442,7 +442,6 @@ static int silc_packet_check_mac(SilcHmac hmac, SilcBuffer buffer, /* Compare the HMAC's (buffer->tail has the packet's HMAC) */ if (memcmp(mac, buffer->tail, mac_len)) { SILC_LOG_ERROR(("MAC failed")); - assert(FALSE); return FALSE; } diff --git a/lib/silccrypt/silcrng.c b/lib/silccrypt/silcrng.c index 485a60aa..67ee08fe 100644 --- a/lib/silccrypt/silcrng.c +++ b/lib/silccrypt/silcrng.c @@ -146,7 +146,7 @@ void silc_rng_free(SilcRng rng) memset(rng->pool, 0, sizeof(rng->pool)); memset(rng->key, 0, sizeof(rng->key)); silc_hash_free(rng->sha1); - silc_free(new->devrandom); + silc_free(rng->devrandom); silc_free(rng); } } @@ -282,7 +282,7 @@ static void silc_rng_get_hard_noise(SilcRng rng) int fd, len, i; /* Get noise from /dev/[u]random if available */ - fd = open(rnd->devrandom, O_RDONLY); + fd = open(rng->devrandom, O_RDONLY); if (fd < 0) return;