SILC_LOG_DEBUG(("Moving client to local list"));
silc_idcache_add(server->local_list->clients, client_cache->name,
client_cache->id, client_cache->context,
- client_cache->expire);
+ client_cache->expire, NULL);
silc_idcache_del_by_context(server->global_list->clients, client);
}
server_entry = server_entry->router;
SILC_LOG_DEBUG(("Moving client to local list"));
silc_idcache_add(server->local_list->clients, client_cache->name,
client_cache->id, client_cache->context,
- client_cache->expire);
+ client_cache->expire, NULL);
silc_idcache_del_by_context(server->global_list->clients, client);
}
}
SILC_LOG_DEBUG(("Moving client to global list"));
silc_idcache_add(server->global_list->clients, client_cache->name,
client_cache->id, client_cache->context,
- client_cache->expire);
+ client_cache->expire, NULL);
silc_idcache_del_by_context(server->local_list->clients, client);
}
server_entry = server_entry->router;
SILC_LOG_DEBUG(("Moving client to global list"));
silc_idcache_add(server->global_list->clients, client_cache->name,
client_cache->id, client_cache->context,
- client_cache->expire);
+ client_cache->expire, NULL);
silc_idcache_del_by_context(server->local_list->clients, client);
}
}
return FALSE;
}
+
+/* Checks string for bad characters and returns TRUE if they are found. */
+
+bool silc_server_name_bad_chars(const char *name, uint32 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, uint32 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;
+}