updates.
[silc.git] / apps / silcd / protocol.c
index 10e74a9d14dffe960661bfd90407f1d6809cccb1..19d521a38ee7e740a747625a908ff47076fa8bc8 100644 (file)
@@ -157,30 +157,37 @@ SilcSKEStatus silc_ske_check_version(SilcSKE ske, unsigned char *version,
 
   /* Check software version */
 
-  if (len < strlen(silc_version_string))
+  cp = version + 9;
+  if (!cp)
     status = SILC_SKE_STATUS_BAD_VERSION;
 
-  cp = version + 9;
   maj = atoi(cp);
   cp = strchr(cp, '.');
   if (cp) {
     min = atoi(cp + 1);
     cp++;
   }
-  cp = strchr(cp, '.');
-  if (cp)
-    build = atoi(cp + 1);
+  if (cp) {
+    cp = strchr(cp, '.');
+    if (cp)
+      build = atoi(cp + 1);
+  }
 
   cp = silc_version_string + 9;
+  if (!cp)
+    status = SILC_SKE_STATUS_BAD_VERSION;
+
   maj2 = atoi(cp);
   cp = strchr(cp, '.');
   if (cp) {
     min2 = atoi(cp + 1);
     cp++;
   }
-  cp = strchr(cp, '.');
-  if (cp)
-    build2 = atoi(cp + 1);
+  if (cp) {
+    cp = strchr(cp, '.');
+    if (cp)
+      build2 = atoi(cp + 1);
+  }
 
   if (maj != maj2)
     status = SILC_SKE_STATUS_BAD_VERSION;
@@ -665,7 +672,7 @@ SILC_TASK_CALLBACK(silc_server_protocol_connection_auth)
 
        /* Remote end is client */
        if (conn_type == SILC_SOCKET_TYPE_CLIENT) {
-         SilcServerConfigSectionClientConnection *client = ctx->config;
+         SilcServerConfigSectionClientConnection *client = ctx->cconfig;
          
          if (client) {
            switch(client->auth_meth) {
@@ -727,7 +734,7 @@ SILC_TASK_CALLBACK(silc_server_protocol_connection_auth)
        
        /* Remote end is server */
        if (conn_type == SILC_SOCKET_TYPE_SERVER) {
-         SilcServerConfigSectionServerConnection *serv = ctx->config;
+         SilcServerConfigSectionServerConnection *serv = ctx->sconfig;
          
          if (serv) {
            switch(serv->auth_meth) {
@@ -789,7 +796,7 @@ SILC_TASK_CALLBACK(silc_server_protocol_connection_auth)
        
        /* Remote end is router */
        if (conn_type == SILC_SOCKET_TYPE_ROUTER) {
-         SilcServerConfigSectionServerConnection *serv = ctx->config;
+         SilcServerConfigSectionServerConnection *serv = ctx->rconfig;
 
          if (serv) {
            switch(serv->auth_meth) {