- /* Initialize the crypto library. If application has done this already
- this has no effect. Also, we will not be overriding something
- application might have registered earlier. */
- silc_cipher_register_default();
- silc_pkcs_register_default();
- silc_hash_register_default();
- silc_hmac_register_default();
+ /* Validate essential strings */
+ if (client->nickname)
+ if (!silc_identifier_verify(client->nickname, strlen(client->nickname),
+ SILC_STRING_UTF8, 128)) {
+ SILC_LOG_ERROR(("Malformed nickname '%s'", client->nickname));
+ return FALSE;
+ }
+ if (!silc_identifier_verify(client->username, strlen(client->username),
+ SILC_STRING_UTF8, 128)) {
+ SILC_LOG_ERROR(("Malformed username '%s'", client->username));
+ return FALSE;
+ }
+ if (!silc_identifier_verify(client->hostname, strlen(client->hostname),
+ SILC_STRING_UTF8, 256)) {
+ SILC_LOG_ERROR(("Malformed hostname '%s'", client->hostname));
+ return FALSE;
+ }
+ if (!silc_utf8_valid(client->realname, strlen(client->realname))) {
+ SILC_LOG_ERROR(("Malformed realname '%s'", client->realname));
+ return FALSE;
+ }
+
+ if (!client->internal->params->dont_register_crypto_library) {
+ /* Initialize the crypto library. If application has done this already
+ this has no effect. Also, we will not be overriding something
+ application might have registered earlier. */
+ silc_cipher_register_default();
+ silc_pkcs_register_default();
+ silc_hash_register_default();
+ silc_hmac_register_default();
+ }