updates.
authorPekka Riikonen <priikone@silcnet.org>
Wed, 17 Oct 2001 20:51:57 +0000 (20:51 +0000)
committerPekka Riikonen <priikone@silcnet.org>
Wed, 17 Oct 2001 20:51:57 +0000 (20:51 +0000)
TODO
apps/silcd/packet_send.c
apps/silcd/server_backup.c
apps/silcd/server_util.c
distributions
lib/silccore/silcpacket.c
lib/silccrypt/silcrng.c

diff --git a/TODO b/TODO
index 56c3ab5101ff55ef5f480410d2240a2685c21044..ca95f2e1b3b051e1666f304a6c664b9d2aa41da4 100644 (file)
--- 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
index 81305e729b37ca5e12618ee4a8e2b1614343fcec..b18da81a77c42749f3b19bb015d5fcd5ecd9dd8e 100644 (file)
@@ -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,
index f997ef2fbca684968bc802a0d8fd54be261f9b59..e406431978852ca93872f7e2640f25ebf889387d 100644 (file)
@@ -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,
index 8184b2e728162d45bb95597144b88a3c93516830..b86abec99395c8b45fca87da86db8975b2567214 100644 (file)
@@ -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;
index 9591ef24a431972ec95c2601589cf198f66c1c60..e55e5e0f35f761b713569d8c4fbf79f0bb473f72 100644 (file)
@@ -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=#
index ddf54e00df805012f3d72d1947a4526bdd573cc3..2e7b9cbf006b1929687356a2d6a001e1ee591f60 100644 (file)
@@ -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;
     }
     
index 485a60aae4dccaafd25b7368a966b805fd9eefba..67ee08fe47d9277da047bb2f16830a98cb5ca5fb 100644 (file)
@@ -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;