From: Pekka Riikonen Date: Sat, 3 Feb 2001 11:07:57 +0000 (+0000) Subject: updates. X-Git-Tag: SILC.0.1~264 X-Git-Url: http://git.silcnet.org/gitweb/?a=commitdiff_plain;h=a907c183ed076d65a957b4272b78a6111080e37d;p=silc.git updates. --- diff --git a/CHANGES b/CHANGES index f7d07e0d..6f17e20e 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,25 @@ +Sat Feb 3 15:44:54 EET 2001 Pekka Riikonen + + * Oops, a little mistake in server's connection authentication + protocol. The protocol is not ended with FAILURE but with + SUCCESS if the authentication is Ok. :) Affected file is + silcd/protocol.c. + + * Implemented NICK_CHANGE notify handling in server in the file + silcd/packet_receive.c The NICK_CHANGE notify is distributed to + the local clients on the channel. After the changing nickname + in router environment snhould work and the [] nickname + should appear no more. + + The silc_server_replace_id function that receives the Replace ID + payload now sends the NICK_CHANGE notify type also in the file + silcd/packet_receive.c + + * Changed WHOIS and IDENTIFY command to support the maximum amount + of arguments defined in protocol specs (3328 arguments). This + fixed a bug that caused problems when there were more than three + users on a channel. + Fri Feb 2 11:42:56 EET 2001 Pekka Riikonen * Added extra parameter, command identifier, to the @@ -16,7 +38,7 @@ Fri Feb 2 11:42:56 EET 2001 Pekka Riikonen that we are now re-sending. Ignored if NULL. Affected file silcd/packet_send.[ch]. - * Added some server statistics support in sil/server_internal.h + * Added some server statistics support in silcd/server_internal.h SilcServerStatistics structure and around the server code. Also send some nice statistics information when client is connecting to the client. diff --git a/apps/silcd/command.c b/apps/silcd/command.c index 2f748cea..44ef1f94 100644 --- a/apps/silcd/command.c +++ b/apps/silcd/command.c @@ -768,7 +768,7 @@ SILC_SERVER_CMD_FUNC(whois) SilcServerCommandContext cmd = (SilcServerCommandContext)context; int ret; - SILC_SERVER_COMMAND_CHECK_ARGC(SILC_COMMAND_WHOIS, cmd, 1, 3); + SILC_SERVER_COMMAND_CHECK_ARGC(SILC_COMMAND_WHOIS, cmd, 1, 3328); if (cmd->sock->type == SILC_SOCKET_TYPE_CLIENT) ret = silc_server_command_whois_from_client(cmd); @@ -1167,7 +1167,7 @@ SILC_SERVER_CMD_FUNC(identify) SilcServerCommandContext cmd = (SilcServerCommandContext)context; int ret; - SILC_SERVER_COMMAND_CHECK_ARGC(SILC_COMMAND_IDENTIFY, cmd, 1, 3); + SILC_SERVER_COMMAND_CHECK_ARGC(SILC_COMMAND_IDENTIFY, cmd, 1, 3328); if (cmd->sock->type == SILC_SOCKET_TYPE_CLIENT) ret = silc_server_command_identify_from_client(cmd); @@ -1225,7 +1225,7 @@ SILC_SERVER_CMD_FUNC(nick) /* Send notify about nickname change to our router. We send the new ID and ask to replace it with the old one. If we are router the packet is broadcasted. */ - if (!cmd->server->standalone) + if (!server->standalone) silc_server_send_replace_id(server, server->router->connection, server->server_type == SILC_SERVER ? FALSE : TRUE, client->id, @@ -1647,6 +1647,8 @@ void silc_server_command_send_users(SilcServer server, SilcBuffer buffer, idp; SilcPacketContext *packet = silc_packet_context_alloc(); + SILC_LOG_DEBUG(("Start")); + /* Create USERS command packet and process it. */ idp = silc_id_payload_encode(channel->id, SILC_ID_CHANNEL); buffer = silc_command_payload_encode_va(SILC_COMMAND_USERS, 0, 1, diff --git a/apps/silcd/packet_receive.c b/apps/silcd/packet_receive.c index 88f08709..ed5df4bf 100644 --- a/apps/silcd/packet_receive.c +++ b/apps/silcd/packet_receive.c @@ -336,14 +336,36 @@ void silc_server_replace_id(SilcServer server, /* Replace the old ID */ switch(old_id_type) { case SILC_ID_CLIENT: - SILC_LOG_DEBUG(("Old Client ID id(%s)", - silc_id_render(id, SILC_ID_CLIENT))); - SILC_LOG_DEBUG(("New Client ID id(%s)", - silc_id_render(id2, SILC_ID_CLIENT))); - if (silc_idlist_replace_client_id(server->local_list, id, id2) == NULL) - if (server->server_type == SILC_ROUTER) - silc_idlist_replace_client_id(server->global_list, id, id2); - break; + { + SilcBuffer nidp, oidp; + SilcClientEntry client = NULL; + + SILC_LOG_DEBUG(("Old Client ID id(%s)", + silc_id_render(id, SILC_ID_CLIENT))); + SILC_LOG_DEBUG(("New Client ID id(%s)", + silc_id_render(id2, SILC_ID_CLIENT))); + + if ((client = silc_idlist_replace_client_id(server->local_list, + id, id2)) == NULL) + if (server->server_type == SILC_ROUTER) + client = silc_idlist_replace_client_id(server->global_list, id, id2); + + if (client) { + oidp = silc_id_payload_encode(id, SILC_ID_CLIENT); + nidp = silc_id_payload_encode(id2, SILC_ID_CLIENT); + + /* Send the NICK_CHANGE notify type to local clients on the channels + this client is joined to. */ + silc_server_send_notify_on_channels(server, client, + SILC_NOTIFY_TYPE_NICK_CHANGE, 2, + oidp->data, oidp->len, + nidp->data, nidp->len); + + silc_buffer_free(nidp); + silc_buffer_free(oidp); + } + break; + } case SILC_ID_SERVER: SILC_LOG_DEBUG(("Old Server ID id(%s)", @@ -859,7 +881,7 @@ void silc_server_notify(SilcServer server, SilcNotifyType type; SilcArgumentPayload args; SilcChannelID *channel_id; - SilcClientID *client_id; + SilcClientID *client_id, *client_id2; SilcChannelEntry channel; SilcClientEntry client; unsigned char *tmp; @@ -1013,8 +1035,10 @@ void silc_server_notify(SilcServer server, if (!client) { client = silc_idlist_find_client_by_id(server->local_list, client_id, NULL); - if (!client) + if (!client) { + silc_free(client_id); goto out; + } } silc_free(client_id); @@ -1025,12 +1049,76 @@ void silc_server_notify(SilcServer server, silc_idlist_del_client(server->global_list, client); break; - /* Ignore rest notify types for now */ - case SILC_NOTIFY_TYPE_NONE: - case SILC_NOTIFY_TYPE_INVITE: + case SILC_NOTIFY_TYPE_NICK_CHANGE: + { + /* + * Distribute the notify to local clients on the channel + */ + unsigned char *id, *id2; + + SILC_LOG_DEBUG(("NICK CHANGE notify")); + + /* Get old client ID */ + id = silc_argument_get_arg_type(args, 1, &tmp_len); + if (!id) + goto out; + client_id = silc_id_payload_parse_id(id, tmp_len); + + /* Get new client ID */ + id2 = silc_argument_get_arg_type(args, 2, &tmp_len); + if (!id2) + goto out; + client_id2 = silc_id_payload_parse_id(id2, tmp_len); + + SILC_LOG_DEBUG(("Old Client ID id(%s)", + silc_id_render(client_id, SILC_ID_CLIENT))); + SILC_LOG_DEBUG(("New Client ID id(%s)", + silc_id_render(client_id2, SILC_ID_CLIENT))); + + /* Replace the Client ID */ + client = silc_idlist_replace_client_id(server->global_list, client_id, + client_id2); + if (!client) + client = silc_idlist_replace_client_id(server->local_list, client_id, + client_id2); + + if (client) + /* Send the NICK_CHANGE notify type to local clients on the channels + this client is joined to. */ + silc_server_send_notify_on_channels(server, client, + SILC_NOTIFY_TYPE_NICK_CHANGE, 2, + id, tmp_len, + id2, tmp_len); + + silc_free(client_id); + if (!client) + silc_free(client_id2); + break; + } case SILC_NOTIFY_TYPE_TOPIC_SET: + /* + * Distribute the notify to local clients on the channel + */ + SILC_LOG_DEBUG(("TOPIC SET notify (not-impl XXX)")); + break; + case SILC_NOTIFY_TYPE_CMODE_CHANGE: + /* + * Distribute the notify to local clients on the channel + */ + SILC_LOG_DEBUG(("CMODE CHANGE notify (not-impl XXX)")); + break; + case SILC_NOTIFY_TYPE_CUMODE_CHANGE: + /* + * Distribute the notify to local clients on the channel + */ + SILC_LOG_DEBUG(("CUMODE CHANGE notify (not-impl XXX)")); + break; + + /* Ignore rest notify types for now */ + case SILC_NOTIFY_TYPE_NONE: + case SILC_NOTIFY_TYPE_INVITE: case SILC_NOTIFY_TYPE_MOTD: default: break; diff --git a/apps/silcd/protocol.c b/apps/silcd/protocol.c index b7744da8..60d8b0a1 100644 --- a/apps/silcd/protocol.c +++ b/apps/silcd/protocol.c @@ -886,7 +886,7 @@ SILC_TASK_CALLBACK(silc_server_protocol_connection_auth) SILC_PUT32_MSB(SILC_CONN_AUTH_OK, ok); /* Authentication failed */ - silc_server_packet_send(server, ctx->sock, SILC_PACKET_FAILURE, + silc_server_packet_send(server, ctx->sock, SILC_PACKET_SUCCESS, 0, ok, 4, TRUE); /* Unregister the timeout task since the protocol has ended. diff --git a/apps/silcd/testi2.conf b/apps/silcd/testi2.conf index c0ffb921..fccab92f 100644 --- a/apps/silcd/testi2.conf +++ b/apps/silcd/testi2.conf @@ -1,8 +1,8 @@ [Cipher] -rc6:/home/silc/silc/lib/silcsim/modules/rc6.sim.so:16:16 -twofish:/home/silc/silc/lib/silcsim/modules/twofish.sim.so:16:16 -mars:/home/silc/silc/lib/silcsim/modules/mars.sim.so:16:16 -none:/home/silc/silc/lib/silcsim/modules/none.sim.so:0:0 +rc6:../lib/silcsim/modules/rc6.sim.so:16:16 +twofish:../lib/silcsim/modules/twofish.sim.so:16:16 +mars:../lib/silcsim/modules/mars.sim.so:16:16 +none:../lib/silcsim/modules/none.sim.so:0:0 [HashFunction] md5::64:16 @@ -16,15 +16,15 @@ sha1::64:20 Mun huone:Mun servo:Pekka Riikonen:priikone@poseidon.pspt.fi [ServerInfo] -lassi.kuo.fi.ssh.com:10.2.1.7:Kuopio, Finland:1335 +lassi.kuo.fi.ssh.com:212.146.8.246:Kuopio, Finland:1334 [ListenPort] -10.2.1.7:10.2.1.7:1335 +212.146.8.246:212.146.8.246:1334 [Logging] -infologfile:silcd3.log:10000 +infologfile:silcd2.log:10000 #warninglogfile:/var/log/silcd_warning.log:10000 -errorlogfile:silcd3.log:10000 +errorlogfile:silcd2.log:10000 #fatallogfile:/var/log/silcd_error.log: [ConnectionClass] @@ -32,18 +32,15 @@ errorlogfile:silcd3.log:10000 2:200:300:400 [ClientConnection] -10.2.1.199:passwd:priikone:333:1 :::1333:1 :::1334:1 :::1335:1 :::1336:1 [AdminConnection] -10.2.1.199:passwd:priikone:priikone:1 [ServerConnection] -10.2.1.7:passwd:priikone:1333:1:1 -10.2.1.7:passwd:priikone:1336:1:1 +212.146.8.246:passwd:priikone:1333:1:1 [RouterConnection]