if (channel->topic)
silc_free(channel->topic);
- channel->topic = silc_calloc(tmp_len, sizeof(*channel->topic));
+ channel->topic = silc_calloc(tmp_len + 1, sizeof(*channel->topic));
memcpy(channel->topic, tmp, tmp_len);
/* Send the same notify to the channel */
return NULL;
}
+ if (strlen(username) > 128)
+ username[127] = '\0';
+
nickname = strdup(username);
/* Make sanity checks for the hostname of the client. If the hostname
hostname = silc_calloc((strlen(username) - tlen) + 1, sizeof(char));
memcpy(hostname, username + tlen + 1, strlen(username) - tlen - 1);
- pident = silc_pkcs_decode_identifier(client->data.public_key->identifier);
- if (pident) {
- phostname = strdup(pident->host);
- silc_pkcs_free_identifier(pident);
- }
-
if (strcmp(sock->hostname, sock->ip) &&
strcmp(sock->hostname, hostname)) {
silc_free(username);
- silc_free(phostname);
silc_free(hostname);
if (realname)
silc_free(realname);
return NULL;
}
+ pident = silc_pkcs_decode_identifier(client->data.public_key->identifier);
+ if (pident) {
+ phostname = strdup(pident->host);
+ silc_pkcs_free_identifier(pident);
+ }
+
if (!strcmp(sock->hostname, sock->ip) &&
phostname && strcmp(phostname, hostname)) {
silc_free(username);
- silc_free(phostname);
silc_free(hostname);
+ if (phostname)
+ silc_free(phostname);
if (realname)
silc_free(realname);
silc_server_disconnect_remote(server, sock,
} else {
/* The hostname is not present, add it. */
char *newusername;
-
+ /* XXX For now we cannot take the host name from the public key since
+ they are not trusted or we cannot verify them as trusted. Just take
+ what the resolved name or address is. */
+#if 0
if (strcmp(sock->hostname, sock->ip)) {
+#endif
newusername = silc_calloc(strlen(username) +
strlen(sock->hostname) + 2,
sizeof(*newusername));
strncat(newusername, sock->hostname, strlen(sock->hostname));
silc_free(username);
username = newusername;
+#if 0
} else {
SilcPublicKeyIdentifier pident =
silc_pkcs_decode_identifier(client->data.public_key->identifier);
silc_pkcs_free_identifier(pident);
}
}
+#endif
}
/* Create Client ID */
silc_id_create_client_id(server->id, server->rng, server->md5hash,
username, &client_id);
- if (strlen(username) > 128)
- username[127] = '\0';
-
/* Update client entry */
idata->registered = TRUE;
client->nickname = nickname;
/* Send some nice info to the client */
SILC_SERVER_SEND_NOTIFY(server, sock, SILC_NOTIFY_TYPE_NONE,
- ("Welcome to the SILC Network %s@%s",
- username, sock->hostname));
+ ("Welcome to the SILC Network %s",
+ username));
SILC_SERVER_SEND_NOTIFY(server, sock, SILC_NOTIFY_TYPE_NONE,
("Your host is %s, running version %s",
server->config->server_info->server_name,
return;
}
+ /* Get the mode and set it to the channel */
+ channel->mode = silc_channel_get_mode(payload);
+
/* Send the new channel key to the server */
chk = silc_channel_key_payload_encode(id_len, id,
strlen(channel->channel_key->