/* If we are normal server, send the command to router, since we
want to know all channels in the network. */
- if (!cmd->pending && server->server_type == SILC_SERVER &&
+ if (!cmd->pending && server->server_type != SILC_ROUTER &&
!server->standalone) {
SilcBuffer tmpbuf;
SilcUInt16 old_ident;
/* Send command reply */
tmp = silc_argument_get_arg_type(cmd->args, 1, &len);
- if (add || del)
- packet =
- silc_command_reply_payload_encode_va(SILC_COMMAND_INVITE,
- SILC_STATUS_OK, 0, ident, 2,
- 2, tmp, len,
- 3, channel->invite_list,
- channel->invite_list ?
- strlen(channel->invite_list) : 0);
- else
- packet =
- silc_command_reply_payload_encode_va(SILC_COMMAND_INVITE,
- SILC_STATUS_OK, 0, ident, 1,
- 2, tmp, len);
+ packet =
+ silc_command_reply_payload_encode_va(SILC_COMMAND_INVITE,
+ SILC_STATUS_OK, 0, ident, 2,
+ 2, tmp, len,
+ 3, channel->invite_list,
+ channel->invite_list ?
+ strlen(channel->invite_list) : 0);
silc_server_packet_send(server, cmd->sock, SILC_PACKET_COMMAND_REPLY, 0,
packet->data, packet->len, FALSE);
silc_buffer_free(packet);
bool resolve;
unsigned char *fkey = NULL;
SilcUInt32 fkey_len = 0;
+ const char *cipher;
SILC_LOG_DEBUG(("Joining client to channel"));
if (!(channel->mode & SILC_CHANNEL_MODE_PRIVKEY)) {
tmp = silc_id_id2str(channel->id, SILC_ID_CHANNEL);
+ cipher = silc_cipher_get_name(channel->channel_key);
keyp = silc_channel_key_payload_encode(silc_id_get_len(channel->id,
SILC_ID_CHANNEL),
tmp,
- strlen(channel->channel_key->
- cipher->name),
- channel->channel_key->cipher->name,
+ strlen(cipher), cipher,
channel->key_len / 8, channel->key);
silc_free(tmp);
}
}
if (!entry) {
- silc_server_command_send_status_reply(cmd, SILC_COMMAND_INFO,
+ silc_server_command_send_status_reply(cmd, SILC_COMMAND_MOTD,
SILC_STATUS_ERR_NO_SUCH_SERVER, 0);
goto out;
}
silc_server_send_channel_key(server, NULL, channel,
server->server_type == SILC_ROUTER ?
FALSE : !server->standalone);
-
- cipher = channel->channel_key->cipher->name;
+
+ cipher = (char *)silc_cipher_get_name(channel->channel_key);
hmac = (char *)silc_hmac_get_name(channel->hmac);
}
}
SilcServer server = cmd->server;
SilcClientEntry client = (SilcClientEntry)cmd->sock->user_data;
SilcIDListData idata = (SilcIDListData)client;
- SilcChannelID *channel_id;
- SilcClientID *client_id;
+ SilcChannelID *channel_id = NULL;
+ SilcClientID *client_id = NULL;
SilcChannelEntry channel;
SilcClientEntry target_client;
SilcChannelClientEntry chl;
packet->data, packet->len, FALSE);
silc_buffer_free(packet);
- silc_free(channel_id);
- silc_free(client_id);
silc_buffer_free(idp);
out:
+ silc_free(channel_id);
+ silc_free(client_id);
silc_free(fkey);
silc_server_command_free(cmd);
}
silc_server_command_send_status_reply(cmd, SILC_COMMAND_OPER,
SILC_STATUS_ERR_AUTH_FAILED,
0);
- SILC_LOG_INFO(("OPER authentication failed for username '%s' by"
+ SILC_LOG_INFO(("OPER authentication failed for username '%s' by "
"nickname '%s' from %s", username,
client->nickname, cmd->sock->hostname));
goto out;
SILC_SERVER_COMMAND_CHECK(SILC_COMMAND_WATCH, cmd, 1, 3);
- if (server->server_type == SILC_SERVER && !server->standalone) {
+ if (server->server_type != SILC_ROUTER && !server->standalone) {
if (!cmd->pending) {
/* Send the command to router */
SilcBuffer tmpbuf;
SilcUInt16 old_ident;
+ SILC_LOG_DEBUG(("Forwarding WATCH to router"));
+
old_ident = silc_command_get_ident(cmd->payload);
silc_command_set_ident(cmd->payload, ++server->cmd_ident);
tmpbuf = silc_command_payload_encode_payload(cmd->payload);
/* Received reply from router, just send same data to the client. */
SilcServerCommandReplyContext reply = context2;
SilcStatus status;
+
+ SILC_LOG_DEBUG(("Received reply to WATCH from router"));
silc_command_get_status(reply->payload, &status, NULL);
silc_server_command_send_status_reply(cmd, SILC_COMMAND_WATCH, status,
0);
if (!admin) {
silc_server_command_send_status_reply(cmd, SILC_COMMAND_SILCOPER,
SILC_STATUS_ERR_AUTH_FAILED, 0);
- SILC_LOG_INFO(("SILCOPER authentication failed for username '%s' by"
+ SILC_LOG_INFO(("SILCOPER authentication failed for username '%s' by "
"nickname '%s' from %s", username,
client->nickname, cmd->sock->hostname));
goto out;
goto out;
}
- if (server->server_type == SILC_ROUTER &&
+ if (server->server_type == SILC_ROUTER && !server->backup_router &&
client->mode & SILC_UMODE_SERVER_OPERATOR) {
silc_server_command_send_status_reply(cmd, SILC_COMMAND_PRIV_CONNECT,
SILC_STATUS_ERR_NO_ROUTER_PRIV, 0);