if (idata->hash)
silc_hash_free(idata->hash);
- if (idata->public_key)
- silc_pkcs_public_key_free(idata->public_key);
idata->hash = NULL;
idata->public_key = NULL;
int ret;
ret = silc_parse_userfqdn(username, u, sizeof(u), h, sizeof(h));
- if (!u)
+ if (!ret)
return NULL;
if (!silc_identifier_verify(u, strlen(u), SILC_STRING_UTF8, 128))
return NULL;
}
client = silc_calloc(1, sizeof(*client));
+ if (!client)
+ return NULL;
client->nickname = nickname;
client->username = username ? strdup(username) : NULL;
client->userinfo = userinfo;
client = (SilcClientEntry)id_cache->context;
- /* Remove the old entry and add a new one */
-
- if (!silc_idcache_del_by_context(id_list->clients, client, server))
- return NULL;
-
/* Check if anyone is watching old nickname */
if (server->server_type == SILC_ROUTER)
silc_server_check_watcher_list(server, client, nickname,
SILC_NOTIFY_TYPE_NICK_CHANGE);
+ /* Replace */
+ if (!silc_idcache_update(id_list->clients, id_cache, new_id, nicknamec,
+ TRUE))
+ return NULL;
+
silc_free(client->nickname);
- *client->id = *new_id;
client->nickname = nickname ? strdup(nickname) : NULL;
/* Check if anyone is watching new nickname */
silc_server_check_watcher_list(server, client, nickname,
SILC_NOTIFY_TYPE_NICK_CHANGE);
- if (!silc_idcache_add(id_list->clients, nicknamec, client->id,
- client))
- return NULL;
-
SILC_LOG_DEBUG(("Replaced"));
return client;