Return correct command type in SILCOPER in case of error.
[silc.git] / apps / silcd / protocol.c
index 20525e58bbf27bd7e1e2e95ec7260878f241bd5d..f20f13360303053feb36925a86ee6a4a1927c884 100644 (file)
@@ -4,7 +4,7 @@
 
   Author: Pekka Riikonen <priikone@silcnet.org>
 
-  Copyright (C) 1997 - 2003 Pekka Riikonen
+  Copyright (C) 1997 - 2006 Pekka Riikonen
 
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
@@ -326,7 +326,7 @@ int silc_server_protocol_ke_set_keys(SilcServer server,
 SilcSKEStatus silc_ske_check_version(SilcSKE ske, unsigned char *version,
                                     SilcUInt32 len, void *context)
 {
-  SilcUInt32 l_protocol_version = 0, r_protocol_version = 0;
+  SilcUInt32 r_protocol_version = 0;
 
   SILC_LOG_INFO(("%s (%s) is version %s", ske->sock->hostname,
                 ske->sock->ip, version));
@@ -338,21 +338,6 @@ SilcSKEStatus silc_ske_check_version(SilcSKE ske, unsigned char *version,
     return SILC_SKE_STATUS_BAD_VERSION;
   }
 
-  if (!silc_parse_version_string(silc_version_string,
-                                &l_protocol_version, NULL, NULL,
-                                NULL, NULL)) {
-    SILC_LOG_ERROR(("%s (%s) %s is not allowed/supported version",
-                   ske->sock->hostname, ske->sock->ip, version));
-    return SILC_SKE_STATUS_BAD_VERSION;
-  }
-
-  /* If remote is too new, don't connect */
-  if (l_protocol_version < r_protocol_version) {
-    SILC_LOG_ERROR(("%s (%s) %s is not allowed/supported version",
-                   ske->sock->hostname, ske->sock->ip, version));
-    return SILC_SKE_STATUS_BAD_VERSION;
-  }
-
   ske->sock->version = r_protocol_version;
 
   return SILC_SKE_STATUS_OK;
@@ -693,7 +678,8 @@ SILC_TASK_CALLBACK(silc_server_protocol_key_exchange)
      */
 
     /* Send abort notification */
-    silc_ske_abort(ctx->ske, ctx->ske->status);
+    if (ctx->ske)
+      silc_ske_abort(ctx->ske, ctx->ske->status);
 
     /* Unregister the timeout task since the protocol has ended.
        This was the timeout task to be executed if the protocol is
@@ -1652,7 +1638,7 @@ SILC_TASK_CALLBACK(silc_server_protocol_rekey)
      * Error occured
      */
 
-    if (ctx->pfs == TRUE)
+    if (ctx->pfs == TRUE && ctx->ske)
       /* Send abort notification */
       silc_ske_abort(ctx->ske, ctx->ske->status);