Also, do not remove the client entry when giving the KILL
command but when the KILLED notify is received.
+ * Removed silc_idlist_find_client_by_nickname from the server.
+ Not needed anymore. Affected files silcd/idlist.[ch].
+
+ * Implemented the CHANNEL_CHANGE notify type handling to the
+ server. Affected file silcd/server.c.
+
+ * Updated TODO.
+
Mon Mar 26 12:11:14 EEST 2001 Pekka Riikonen <priikone@poseidon.pspt.fi>
* Added silc_server_send_notify_invite to send the INVITE
o TODO in commands (command.c and command_reply.c):
- o WHOIS <count> argument is probably ignored
- o IDENTIFY <count> argument is probably ignored
o RESTART is not implemented
o CMODE should be rewritten as it uses a lot duplicated code.
Some of the modes may still not be implemented or is implemented
o TODO in notify types (packet_receive.c):
- o CHANNEL_CHANGE notify type is not implemented
o SERVER_SIGNOFF notify type is not implemented
+ o TODO in authentication protocol (protocol.c):
+
+ o Public key authentication is missing in initiator side. It must
+ be implemented by creating the authentication data.
+
+ o TODO in general server (server.c)
+
+ o SILC_PACKET_CONNECTION_AUTH_REQUEST packet type is not
+ implemented.
+
+ o silc_server_connect_to_router_second checks the authentication
+ method to be used in the connection. However, if it does not
+ find it it must resolve it from the responder by sending the
+ SILC_PACKET_CONNECTION_AUTH_REQUEST packet.
+
o Packet processing can be made faster. All packet function in the
packet_receive.c has same prototypes. Instead of calling those from
huge switch() make a table of callback functions that can be called
o Connection classes should be actually implemented in serverconfig.c.
They can be defined but they are totally ignored currently.
+ o Connection redirect, if server is full, is not implemented. I also
+ don't know how to do it currently. Maybe it shouldn't be done at all.
+
TODO In SILC Libraries
======================
SilcClientEntry entry;
SilcCommandStatus status;
unsigned short ident = silc_command_get_ident(cmd->payload);
+ char nh[256], uh[256];
+ SilcSocketConnection hsock;
status = SILC_STATUS_OK;
if (clients_count > 1)
idp = silc_id_payload_encode(entry->id, SILC_ID_CLIENT);
tmp = silc_argument_get_first_arg(cmd->args, NULL);
- /* XXX */
- {
- char nh[256], uh[256];
- SilcSocketConnection hsock;
-
- memset(uh, 0, sizeof(uh));
- memset(nh, 0, sizeof(nh));
-
- strncat(nh, entry->nickname, strlen(entry->nickname));
- if (!strchr(entry->nickname, '@')) {
- strncat(nh, "@", 1);
- len = entry->router ? strlen(entry->router->server_name) :
- strlen(server->server_name);
- strncat(nh, entry->router ? entry->router->server_name :
- server->server_name, len);
- }
+ memset(uh, 0, sizeof(uh));
+ memset(nh, 0, sizeof(nh));
- if (!entry->username) {
- packet = silc_command_reply_payload_encode_va(SILC_COMMAND_IDENTIFY,
- status, ident, 2,
- 2, idp->data, idp->len,
- 3, nh, strlen(nh));
- } else {
- strncat(uh, entry->username, strlen(entry->username));
- if (!strchr(entry->username, '@')) {
- strncat(uh, "@", 1);
- hsock = (SilcSocketConnection)entry->connection;
- len = strlen(hsock->hostname);
- strncat(uh, hsock->hostname, len);
- }
+ strncat(nh, entry->nickname, strlen(entry->nickname));
+ if (!strchr(entry->nickname, '@')) {
+ strncat(nh, "@", 1);
+ len = entry->router ? strlen(entry->router->server_name) :
+ strlen(server->server_name);
+ strncat(nh, entry->router ? entry->router->server_name :
+ server->server_name, len);
+ }
- packet = silc_command_reply_payload_encode_va(SILC_COMMAND_IDENTIFY,
- status, ident, 3,
- 2, idp->data, idp->len,
- 3, nh, strlen(nh),
- 4, uh, strlen(uh));
+ if (!entry->username) {
+ packet = silc_command_reply_payload_encode_va(SILC_COMMAND_IDENTIFY,
+ status, ident, 2,
+ 2, idp->data, idp->len,
+ 3, nh, strlen(nh));
+ } else {
+ strncat(uh, entry->username, strlen(entry->username));
+ if (!strchr(entry->username, '@')) {
+ strncat(uh, "@", 1);
+ hsock = (SilcSocketConnection)entry->connection;
+ len = strlen(hsock->hostname);
+ strncat(uh, hsock->hostname, len);
}
- silc_server_packet_send(server, cmd->sock, SILC_PACKET_COMMAND_REPLY,
- 0, packet->data, packet->len, FALSE);
-
- silc_buffer_free(packet);
- silc_buffer_free(idp);
+ packet = silc_command_reply_payload_encode_va(SILC_COMMAND_IDENTIFY,
+ status, ident, 3,
+ 2, idp->data, idp->len,
+ 3, nh, strlen(nh),
+ 4, uh, strlen(uh));
}
+
+ silc_server_packet_send(server, cmd->sock, SILC_PACKET_COMMAND_REPLY,
+ 0, packet->data, packet->len, FALSE);
+
+ silc_buffer_free(packet);
+ silc_buffer_free(idp);
}
}
}
}
-/* Caches the received WHOIS information. If we are normal server currently
- we cache global information only for short period of time. */
-/* XXX cache expirying not implemented yet! */
+/* Caches the received WHOIS information. */
static char
silc_server_command_reply_whois_save(SilcServerCommandReplyContext cmd)
return clients;
}
-/* Finds client entry by nickname. */
-
-SilcClientEntry
-silc_idlist_find_client_by_nickname(SilcIDList id_list, char *nickname,
- char *server, SilcIDCacheEntry *ret_entry)
-{
- SilcIDCacheList list = NULL;
- SilcIDCacheEntry id_cache = NULL;
- SilcClientEntry client = NULL;
-
- SILC_LOG_DEBUG(("Client by nickname"));
-
- if (server) {
- if (!silc_idcache_find_by_data(id_list->clients, nickname, &list))
- return NULL;
-
-#if 0
- while (silc_idcache_list_next(list, &id_cache)) {
- client = (SilcClientEntry)id_cache->context;
-
- if (!strcmp(server, XXX, strlen(server)))
- break;
-
- client = NULL;
- }
-#endif
-
- silc_idcache_list_free(list);
-
- if (!client)
- return NULL;
- } else {
- if (!silc_idcache_find_by_data_one(id_list->clients, nickname, &id_cache))
- return NULL;
-
- client = (SilcClientEntry)id_cache->context;
-
- if (ret_entry)
- *ret_entry = id_cache;
- }
-
- SILC_LOG_DEBUG(("Found"));
-
- return client;
-}
-
/* Finds client by nickname hash. */
SilcClientEntry
SilcHash md5hash,
unsigned int *clients_count);
SilcClientEntry
-silc_idlist_find_client_by_nickname(SilcIDList id_list, char *nickname,
- char *server,
- SilcIDCacheEntry *ret_entry);
-SilcClientEntry
silc_idlist_find_client_by_hash(SilcIDList id_list, char *nickname,
SilcHash md5hash, SilcIDCacheEntry *ret_entry);
SilcClientEntry
SilcNotifyPayload payload;
SilcNotifyType type;
SilcArgumentPayload args;
- SilcChannelID *channel_id;
+ SilcChannelID *channel_id, *channel_id2;
SilcClientID *client_id, *client_id2;
SilcChannelEntry channel;
SilcClientEntry client;
break;
case SILC_NOTIFY_TYPE_CHANNEL_CHANGE:
- SILC_LOG_DEBUG(("CHANNEL CHANGE notify (not-impl XXX)"));
+ /*
+ * Distribute to the local clients on the channel and change the
+ * channel ID.
+ */
+
+ SILC_LOG_DEBUG(("CHANNEL CHANGE"));
+
+ /* Get the old Channel ID */
+ tmp = silc_argument_get_arg_type(args, 1, &tmp_len);
+ if (!tmp)
+ goto out;
+ channel_id = silc_id_payload_parse_id(tmp, tmp_len);
+ if (!channel_id)
+ goto out;
+
+ /* Get the channel entry */
+ channel = silc_idlist_find_channel_by_id(server->global_list,
+ channel_id, NULL);
+ if (!channel) {
+ channel = silc_idlist_find_channel_by_id(server->local_list,
+ channel_id, NULL);
+ if (!channel) {
+ silc_free(channel_id);
+ goto out;
+ }
+ }
+
+ /* Send the notify to the channel */
+ silc_server_packet_send_to_channel(server, sock, channel, packet->type,
+ FALSE, packet->buffer->data,
+ packet->buffer->len, FALSE);
+
+ /* Get the new Channel ID */
+ tmp = silc_argument_get_arg_type(args, 2, &tmp_len);
+ if (!tmp)
+ goto out;
+ channel_id2 = silc_id_payload_parse_id(tmp, tmp_len);
+ if (!channel_id2)
+ goto out;
+
+ /* Replace the Channel ID */
+ if (!silc_idlist_replace_channel_id(server->global_list, channel_id,
+ channel_id2))
+ silc_idlist_replace_channel_id(server->local_list, channel_id,
+ channel_id2);
+
+ silc_free(channel_id);
+ silc_free(channel_id2);
+
break;
case SILC_NOTIFY_TYPE_SERVER_SIGNOFF:
if (sock->type == SILC_SOCKET_TYPE_SERVER)
server->stat.cell_clients++;
server->stat.clients++;
-
-#if 0
- /* XXX Adding two ID's with same IP number replaces the old entry thus
- gives wrong route. Thus, now disabled until figured out a better way
- to do this or when removed the whole thing. This could be removed
- because entry->router->connection gives always the most optimal route
- for the ID anyway (unless new routes (faster perhaps) are established
- after receiving this ID, this we don't know however). */
- /* Add route cache for this ID */
- silc_server_route_add(silc_server_route_hash(
- ((SilcClientID *)id)->ip.s_addr,
- server->id->port), ((SilcClientID *)id)->ip.s_addr,
- router);
-#endif
}
break;
if (sock->type == SILC_SOCKET_TYPE_SERVER)
server->stat.cell_servers++;
server->stat.servers++;
-
-#if 0
- /* Add route cache for this ID */
- silc_server_route_add(silc_server_route_hash(
- ((SilcServerID *)id)->ip.s_addr,
- ((SilcServerID *)id)->port),
- ((SilcServerID *)id)->ip.s_addr,
- router);
-#endif
break;
case SILC_ID_CHANNEL:
idata->receive_key->set_iv(idata->receive_key, keymat->receive_iv);
}
- /* Allocate PKCS to be used */
-#if 0
- /* XXX Do we ever need to allocate PKCS for the connection??
- If yes, we need to change KE protocol to get the initiators
- public key. */
- silc_pkcs_alloc(pkcs->pkcs->name, &idata->pkcs);
- idata->public_key = silc_pkcs_public_key_alloc(XXX);
- silc_pkcs_set_public_key(idata->pkcs, ske->ke2_payload->pk_data,
- ske->ke2_payload->pk_len);
-#endif
-
/* Save the hash */
if (!silc_hash_alloc(hash->hash->name, &idata->hash)) {
silc_cipher_free(idata->send_key);
* Connection Authentication protocol functions
*/
-/* XXX move these to somehwere else */
-
int silc_server_password_authentication(SilcServer server, char *auth1,
char *auth2)
{
auth_data,
payload_len,
ctx->ske);
-
+
if (ret) {
memset(auth_data, 0, payload_len);
silc_free(auth_data);
auth_data_len = ctx->auth_data_len;
break;
}
-
- /* No authentication data exits. Ask interactively from user. */
- /* XXX */
-
break;
case SILC_AUTH_PUBLIC_KEY:
* routes. If route entry doesn't exist for a specific destination, server
* uses primary route (default route).
*/
+/* XXX Adding two ID's with same IP number replaces the old entry thus
+ gives wrong route. Thus, now disabled until figured out a better way
+ to do this or when removed the whole thing. This could be removed
+ because entry->router->connection gives always the most optimal route
+ for the ID anyway (unless new routes (faster perhaps) are established
+ after receiving this ID, this we don't know however). */
/* $Id$ */
#include "serverincludes.h"
}
pc = pc->next;
- /* XXXX */
- // silc_free(pc->prev);
- // pc->prev = NULL;
}
if (check == FALSE)
return FALSE;
}
- if (!(checkmask & (1L << SILC_CONFIG_SERVER_SECTION_TYPE_CLIENT_CONNECTION))) {
+ if (!(checkmask &
+ (1L << SILC_CONFIG_SERVER_SECTION_TYPE_CLIENT_CONNECTION))) {
return FALSE;
}
10 SILC_NOTIFY_TYPE_CHANNEL_CHANGE
Sent when channel's ID has changed for a reason or another. This
- is sent by normal server to the client. Client must change the
- old Channel ID to the new one. This type must be sent only to the
- clients who is joined on the channel.
+ is sent by normal server to the client. This can also be sent by
+ router to other server to force the Channel ID change. The Channel
+ ID must be changed to use the new one. When sent to clients, this
+ type must be sent only to the clients who is joined on the channel.
Max Arguments: 2
Arguments: (1) <Old Channel ID> (2) <New Channel ID>