updates.
authorPekka Riikonen <priikone@silcnet.org>
Wed, 18 Jul 2001 19:19:27 +0000 (19:19 +0000)
committerPekka Riikonen <priikone@silcnet.org>
Wed, 18 Jul 2001 19:19:27 +0000 (19:19 +0000)
12 files changed:
CHANGES
CREDITS
TODO
apps/irssi/docs/help/in/silcoper.in
apps/silcd/command.c
apps/silcd/server.c
lib/silcclient/client_keyagr.c
lib/silccore/silcprotocol.c
lib/silcutil/silcnet.h
lib/silcutil/silcschedule.c
lib/silcutil/silcschedule.h
lib/silcutil/win32/silcwin32schedule.c

diff --git a/CHANGES b/CHANGES
index b47f5c58ac42733281530a92973c7d5ff0e22ea0..e5a11169a4a523a1137f7a1ddd5af4275443ec6c 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,21 @@
+Wed Jul 18 18:34:01 EEST 2001  Pekka Riikonen <priikone@silcnet.org>
+
+       * Call silc_schedule_task_del_by_context in the 
+         silc_protocol_cancel instead of silc_schedule_task_del_by_callback.
+         Affected file lib/silccore/silcprotocol.c.
+
+       * Call silc_protocol_cancel for active protocols in the
+         silc_server_close_connection if the funtion
+         silc_server_free_sock_user_data has not been called.
+         Affected file silcd/server.c.
+
+       * Generic tasks cannot be deleted using the del_by_fd
+         task deleting function since generic tasks does not match
+         any specific fd.  Affected file lib/silcutil/silcschedule.[ch].
+
+       * Added a notion to SILCOPER help file that the SILCOPER works
+         only on router server, not on normal server.
+
 Wed Jul 18 09:40:04 EEST 2001  Pekka Riikonen <priikone@silcnet.org>
 
        * Added for WIN32 support for the new scheduler as well.
diff --git a/CREDITS b/CREDITS
index 67aca48b173a5b6ada2d413b40bad527021d0bc6..b626e56875fb8dce0a2ca9776004b8d14fb177aa 100644 (file)
--- a/CREDITS
+++ b/CREDITS
@@ -24,8 +24,8 @@ E: priikone@ssh.com
 P: 1024/A924ED4F AD 82 53 2D 84 FF C7 D1  FF 63 19 0E 1A 78 9F 8A  A9 24 ED 4F
 D: Protocol architet
 D: Main developer
-S: Kasarmikatu 11 A4
-S: 70110 Kuopio
+S: Snellmanninkatu 34 A 15
+S: 70100 Kuopio
 S: Finland
 
 N: Juha Räsänen
diff --git a/TODO b/TODO
index 1bb758dc0e0c8a211d595a9a403700236307ba77..02d3d74a05e21dfade5a31485bdea2f6a9739e17 100644 (file)
--- a/TODO
+++ b/TODO
@@ -5,6 +5,9 @@ TODO/bugs in Irssi SILC client
    cipher, hash, hmac and pkcs configuration to the Irssi SILC's config
    file.
 
+ o The QUIT command should wait for servers disconnection (at least for
+   a while) before exiting the application.
+
  o Add local command to switch the channel's private key when channel has
    several private keys.  Currently sending channel messages with many
    keys is not possible because changing the key is not possible by the
index b75ef81c41b179b637f0d5a471ac55b07432693c..8f0c5056f8c5ec11851edd5c5d838a9e029c62b5 100644 (file)
@@ -1,9 +1,12 @@
 
 @SYNTAX:silcoper@
 
-Gives you router operator priviledges if thecorrect
+Gives you router operator priviledges if the correct
 username and passphrase are given. User will be prompted
 for the passphrase if the <public key> is not provided.
 
+NOTE: This command works only on router server. It has
+no effect on normal SILC server.
+
 See also: KILL, SCONNECT, CLOSE, OPER
 
index b0207cfa8d5e96c777c9a87d3d90840867ae423c..bab8ee25dfc658a3829aa50be83a0fb0792d00a6 100644 (file)
@@ -4299,11 +4299,14 @@ SILC_SERVER_CMD_FUNC(silcoper)
 
   SILC_SERVER_COMMAND_CHECK(SILC_COMMAND_SILCOPER, cmd, 1, 2);
 
-  if (server->server_type == SILC_SERVER)
+  if (!client || cmd->sock->type != SILC_SOCKET_TYPE_CLIENT)
     goto out;
 
-  if (!client || cmd->sock->type != SILC_SOCKET_TYPE_CLIENT)
+  if (server->server_type == SILC_SERVER) {
+    silc_server_command_send_status_reply(cmd, SILC_COMMAND_SILCOPER,
+                                         SILC_STATUS_ERR_AUTH_FAILED);
     goto out;
+  }
 
   /* Get the username */
   username = silc_argument_get_arg_type(cmd->args, 1, &tmp_len);
index f9aa6c9ba1f2de82229d7c6ea5fee5843d58cb84..492e6f25bdbcf30b4f1f135febd84e4a0170861e 100644 (file)
@@ -830,10 +830,10 @@ SILC_TASK_CALLBACK(silc_server_connect_to_router_final)
      server. This task remains on the queue until the end of the program. */
   if (!server->listenning) {
     silc_schedule_task_add(server->schedule, server->sock, 
-                      silc_server_accept_new_connection,
-                      (void *)server, 0, 0, 
-                      SILC_TASK_FD,
-                      SILC_TASK_PRI_NORMAL);
+                          silc_server_accept_new_connection,
+                          (void *)server, 0, 0, 
+                          SILC_TASK_FD,
+                          SILC_TASK_PRI_NORMAL);
     server->listenning = TRUE;
   }
 
@@ -1036,10 +1036,10 @@ silc_server_accept_new_connection_lookup(SilcSocketConnection sock,
      be closed if the key exchange protocol has not been started. */
   proto_ctx->timeout_task = 
     silc_schedule_task_add(server->schedule, sock->sock, 
-                      silc_server_timeout_remote,
-                      context, 60, 0,
-                      SILC_TASK_TIMEOUT,
-                      SILC_TASK_PRI_LOW);
+                          silc_server_timeout_remote,
+                          context, 60, 0,
+                          SILC_TASK_TIMEOUT,
+                          SILC_TASK_PRI_LOW);
 }
 
 /* Accepts new connections to the server. Accepting new connections are
@@ -1186,10 +1186,10 @@ SILC_TASK_CALLBACK(silc_server_accept_new_connection_second)
      this is 60 seconds and is hard coded limit (XXX). */
   proto_ctx->timeout_task = 
     silc_schedule_task_add(server->schedule, sock->sock, 
-                      silc_server_timeout_remote,
-                      (void *)server, 60, 0,
-                      SILC_TASK_TIMEOUT,
-                      SILC_TASK_PRI_LOW);
+                          silc_server_timeout_remote,
+                          (void *)server, 60, 0,
+                          SILC_TASK_TIMEOUT,
+                          SILC_TASK_PRI_LOW);
 }
 
 /* Final part of accepting new connection. The connection has now
@@ -1459,10 +1459,10 @@ SILC_TASK_CALLBACK(silc_server_packet_process)
     if (!server->standalone && sock->type == SILC_SOCKET_TYPE_ROUTER && 
        sock == server->router->connection)
       silc_schedule_task_add(server->schedule, 0, 
-                        silc_server_connect_to_router,
-                        context, 1, 0,
-                        SILC_TASK_TIMEOUT,
-                        SILC_TASK_PRI_NORMAL);
+                            silc_server_connect_to_router,
+                            context, 1, 0,
+                            SILC_TASK_TIMEOUT,
+                            SILC_TASK_PRI_NORMAL);
 
     if (sock->user_data)
       silc_server_free_sock_user_data(server, sock);
@@ -2105,6 +2105,19 @@ void silc_server_close_connection(SilcServer server,
                  sock->type == SILC_SOCKET_TYPE_SERVER ? "Server" :
                  "Router"), sock->sock));
 
+  /* If sock->user_data is NULL then we'll check for active protocols
+     here since the silc_server_free_sock_user_data has not been called
+     for this connection. */
+  if (!sock->user_data) {
+    /* If any protocol is active cancel its execution */
+    if (sock->protocol) {
+      silc_protocol_cancel(sock->protocol, server->schedule);
+      sock->protocol->state = SILC_PROTOCOL_STATE_ERROR;
+      silc_protocol_execute_final(sock->protocol, server->schedule);
+      sock->protocol = NULL;
+    }
+  }
+
   /* We won't listen for this connection anymore */
   silc_schedule_unset_listen_fd(server->schedule, sock->sock);
 
index c68a432fd3b3405f48faed5b7756ca4f001938b1..78337cfe503b416c529910f99b7bf04e819b2632 100644 (file)
@@ -343,9 +343,9 @@ void silc_client_send_key_agreement(SilcClient client,
        will not start the key exchange protocol within the specified 
        timeout. */
     ke->timeout = silc_schedule_task_add(client->schedule, 0, 
-                                    silc_client_key_agreement_timeout,
-                                    (void *)ke, timeout_secs, 0, 
-                                    SILC_TASK_TIMEOUT, SILC_TASK_PRI_LOW);
+                                        silc_client_key_agreement_timeout,
+                                        (void *)ke, timeout_secs, 0, 
+                                        SILC_TASK_TIMEOUT, SILC_TASK_PRI_LOW);
   }
 
   /* Encode the key agreement payload */
@@ -373,10 +373,10 @@ silc_client_connect_to_client_internal(SilcClientInternalConnectContext *ctx)
   /* Register task that will receive the async connect and will
      read the result. */
   ctx->task = silc_schedule_task_add(ctx->client->schedule, sock, 
-                                silc_client_perform_key_agreement_start,
-                                (void *)ctx, 0, 0, 
-                                SILC_TASK_FD,
-                                SILC_TASK_PRI_NORMAL);
+                                    silc_client_perform_key_agreement_start,
+                                    (void *)ctx, 0, 0, 
+                                    SILC_TASK_FD,
+                                    SILC_TASK_PRI_NORMAL);
   silc_schedule_set_listen_fd(ctx->client->schedule, sock, SILC_TASK_WRITE);
 
   ctx->sock = sock;
index 9c91d845bdc148002697683367c2f65e356e6e02..3703c30e0073233bc0953a0136067cc46c23db95 100644 (file)
@@ -138,5 +138,5 @@ void silc_protocol_execute_final(SilcProtocol protocol, SilcSchedule schedule)
 
 void silc_protocol_cancel(SilcProtocol protocol, SilcSchedule schedule)
 {
-  silc_schedule_task_del_by_callback(schedule, protocol->protocol->callback);
+  silc_schedule_task_del_by_context(schedule, protocol);
 }
index d5b8a6bae0d53e1d85226f56ee06614ebac4c329..949a4a60bd9c5be6da923d384e8dcdeb2885caa5 100644 (file)
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  *
+ * DESCRIPTION
+ *
+ * SILC Net API provides various network routines for applications. It
+ * can be used to create TCP/IP connections and servers. Various utility
+ * functions for resolving various information is also provided.
+ *
+ * On WIN32 systems the SILC Net API must initialized by calling the
+ * silc_net_win32_init and uninitialized when the application ends by
+ * calling the silc_net_win32_uninit function. The initializing must be
+ * done in order to assure that the SILC Net API works correctly.
+ *
  */
 
 #ifndef SILCNET_H
index 6bef700d92126327554e46ed08d6f20de84c6c73..fd53ffe237def1d36cb0e1761cbf3514a161a027 100644 (file)
@@ -745,7 +745,6 @@ void silc_schedule_task_del_by_fd(SilcSchedule schedule, uint32 fd)
 {
   silc_task_del_by_fd(schedule->timeout_queue, fd);
   silc_task_del_by_fd(schedule->fd_queue, fd);
-  silc_task_del_by_fd(schedule->generic_queue, fd);
 }
 
 /* Remove task by task callback. */
@@ -1056,7 +1055,7 @@ static int silc_schedule_task_remove(SilcTaskQueue queue, SilcTask task)
 {
   SilcTask first, old, next;
 
-  if (!queue)
+  if (!queue || !task)
     return FALSE;
 
   if (!queue->task) {
index b2597f74772971f128831212455e3c12a05882ed..2272f8e12f122b8f44ccca8a955dcf0edd338ae6 100644 (file)
@@ -463,6 +463,9 @@ void silc_schedule_task_del(SilcSchedule schedule, SilcTask task);
  *    in task callbacks (including in the task's own task callback) and
  *    in multi-threaded environment in other threads as well.
  *
+ *    Note that generic tasks cannot be deleted using this function
+ *    since generic tasks does not match any specific fd.
+ *
  ***/
 void silc_schedule_task_del_by_fd(SilcSchedule schedule, uint32 fd);
 
index 433b5ec2ddf4ca339b137e870840c76229ddf6c0..9321fecb823d33a1ac5f3378781229ff527163d4 100644 (file)
@@ -57,6 +57,9 @@ int silc_select(SilcScheduleFd fds, uint32 fds_count, struct timeval *timeout)
   int nhandles = 0, i;
   MSG msg;
 
+  if (fds_count > MAXIMUM_WAIT_OBJECTS)
+    fds_count = MAXIMUM_WAIT_OBJECTS;
+
   for (i = 0; i < fds_count; i++) {
     if (!fds[i].events)
       continue;