Initial code commit for Toolkit 1.1.
[silc.git] / apps / silcd / server_util.c
index 1f202168f5e55317be877f49083c5c4e1d1caa16..4fc8cacca2c1a4db6a4791b52885886ae57d0275 100644 (file)
@@ -1103,6 +1103,7 @@ SilcUInt32 silc_server_num_sockets_by_ip(SilcServer server, const char *ip,
 
   for (i = 0, count = 0; i < server->config->param.connections_max; i++) {
     if (server->sockets[i] && !SILC_IS_LISTENER(server->sockets[i]) &&
+       !SILC_IS_HOST_LOOKUP(server->sockets[i]) &&
        !strcmp(server->sockets[i]->ip, ip) &&
        server->sockets[i]->type == type)
       count++;
@@ -1128,6 +1129,7 @@ SilcUInt32 silc_server_num_sockets_by_remote(SilcServer server,
 
   for (i = 0, count = 0; i < server->config->param.connections_max; i++) {
     if (server->sockets[i] && !SILC_IS_LISTENER(server->sockets[i]) &&
+       !SILC_IS_HOST_LOOKUP(server->sockets[i]) &&
        ((ip && !strcmp(server->sockets[i]->ip, ip)) ||
         (hostname && !strcmp(server->sockets[i]->hostname, hostname))) &&
        server->sockets[i]->port == port &&
@@ -1802,7 +1804,7 @@ silc_server_find_socket_by_host(SilcServer server,
   int i;
 
   for (i = 0; i < server->config->param.connections_max; i++) {
-    if (!server->sockets[i])
+    if (!server->sockets[i] || SILC_IS_HOST_LOOKUP(server->sockets[i]))
       continue;
     if (!strcmp(server->sockets[i]->ip, ip) &&
        (!port || server->sockets[i]->port == port) &&
@@ -1893,11 +1895,16 @@ bool silc_server_inviteban_process(SilcServer server, SilcHashTable list,
     tmp = silc_argument_get_first_arg(args, &type, &len);
     while (tmp) {
       if (type == 1) {
-       /* Check validity of the string */
+       /* Check validity of the string.  Actually we should parse the
+          whole string and verify all components individually. */
        if (!silc_utf8_valid(tmp, len) || !len) {
          tmp = silc_argument_get_next_arg(args, &type, &len);
          continue;
        }
+       if (strchr(tmp, ',')) {
+         tmp = silc_argument_get_next_arg(args, &type, &len);
+         continue;
+       }
 
        /* Check if the string is added already */
        silc_hash_table_list(list, &htl);
@@ -1978,11 +1985,16 @@ bool silc_server_inviteban_process(SilcServer server, SilcHashTable list,
     tmp = silc_argument_get_first_arg(args, &type, &len);
     while (tmp) {
       if (type == 1) {
-       /* Check validity of the string */
+       /* Check validity of the string.  Actually we should parse the
+          whole string and verify all components individually. */
        if (!silc_utf8_valid(tmp, len)) {
          tmp = silc_argument_get_next_arg(args, &type, &len);
          continue;
        }
+       if (strchr(tmp, ',')) {
+         tmp = silc_argument_get_next_arg(args, &type, &len);
+         continue;
+       }
 
        /* Delete from the list */
        silc_hash_table_list(list, &htl);
@@ -2097,8 +2109,8 @@ silc_server_process_channel_pk(SilcServer server,
 
   if (type == 0x00) {
     /* Add new public key to channel public key list */
-    SILC_LOG_DEBUG(("Add new channel public key to channel %s",
-                   channel->channel_name));
+    SILC_LOG_DEBUG(("Add new channel public key %s to channel %s",
+                   chpk->identifier, channel->channel_name));
 
     /* Check for resource limit */
     if (silc_hash_table_count(channel->channel_pubkeys) > 64) {