Merged silc_1_0_branch to trunk.
[silc.git] / apps / silcd / server_util.c
index 46cf87aa619cf6f9e4d5bb7a77d0b722dc1d1d7e..05197afcf13eeed65a0a360372def2b7bdfbc8c4 100644 (file)
@@ -1093,66 +1093,6 @@ bool silc_server_client_on_channel(SilcClientEntry client,
                              (void *)chl);
 }
 
-/* Checks string for bad characters and returns TRUE if they are found. */
-
-bool silc_server_name_bad_chars(const char *name, SilcUInt32 name_len)
-{
-  int i;
-
-  for (i = 0; i < name_len; i++) {
-    if (!isascii(name[i]))
-      return TRUE;
-    if (name[i] <= 32) return TRUE;
-    if (name[i] == ' ') return TRUE;
-    if (name[i] == '*') return TRUE;
-    if (name[i] == '?') return TRUE;
-    if (name[i] == ',') return TRUE;
-    if (name[i] == '@') return TRUE;
-    if (name[i] == '!') return TRUE;
-  }
-
-  return FALSE;
-}
-
-/* Same as silc_server_name_bad_chars but check for channel names. */
-
-bool silc_server_name_bad_chchars(const char *name, SilcUInt32 name_len)
-{
-  int i;
-
-  for (i = 0; i < name_len; i++) {
-    if (!isascii(name[i]))
-      return TRUE;
-    if (name[i] <= 32) return TRUE;
-    if (name[i] == ' ') return TRUE;
-    if (name[i] == '*') return TRUE;
-    if (name[i] == '?') return TRUE;
-    if (name[i] == ',') return TRUE;
-  }
-
-  return FALSE;
-}
-
-/* Modifies the `name' if it includes bad characters and returns new
-   allocated name that does not include bad characters. */
-
-char *silc_server_name_modify_bad(const char *name, SilcUInt32 name_len)
-{
-  int i;
-  char *newname = strdup(name);
-
-  for (i = 0; i < name_len; i++) {
-    if (!isascii(newname[i])) newname[i] = '_';
-    if (newname[i] <= 32) newname[i] = '_';
-    if (newname[i] == ' ') newname[i] = '_';
-    if (newname[i] == '*') newname[i] = '_';
-    if (newname[i] == '?') newname[i] = '_';
-    if (newname[i] == ',') newname[i] = '_';
-  }
-
-  return newname;
-}
-
 /* Find number of sockets by IP address indicated by `ip'. Returns 0 if
    socket connections with the IP address does not exist. */
 
@@ -1953,11 +1893,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);
@@ -2038,11 +1983,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);
@@ -2157,8 +2107,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) {