+Sat Dec 06 21:35:14 CET 2003 Patrik Weiskircher <pat@icore.at>
+
+ * Getting the MOTD from other servers works now. Affected
+ files are silcd/command.c and silcd/command_reply.c
+
Thu Dec 04 11:33:46 CET 2003 Jochen Eisinger <jochen@penguin-breeder.org>
* Initialize the variable idletag, since it is tested in
o Check that founder key is distributed ok during backup resuming.
- o Check that getting MOTD from other servers works.
-
o invite (with @server!*@host) not working from normal server/backup
router?
packet = silc_command_reply_payload_encode_va(SILC_COMMAND_MOTD,
SILC_STATUS_OK, 0,
ident, 2,
- 2, idp, idp->len,
+ 2, idp->data, idp->len,
3, motd, motd_len);
} else {
/* No motd */
packet = silc_command_reply_payload_encode_va(SILC_COMMAND_MOTD,
SILC_STATUS_OK, 0,
ident, 1,
- 2, idp, idp->len);
+ 2, idp->data, idp->len);
}
silc_server_packet_send(server, cmd->sock, SILC_PACKET_COMMAND_REPLY, 0,
goto out;
}
- if (!entry && !cmd->pending && !server->standalone) {
+ /* Send to primary router only if we don't know the server
+ * the client requested or if the server is not locally connected */
+ if ((!entry || !(entry->data.status & SILC_IDLIST_STATUS_LOCAL))
+ && !cmd->pending && !server->standalone) {
/* Send to the primary router */
SilcBuffer tmpbuf;
SilcUInt16 old_ident;
goto out;
}
- idp = silc_id_payload_encode(server->id_entry->id, SILC_ID_SERVER);
+ idp = silc_id_payload_encode(entry->id, SILC_ID_SERVER);
packet = silc_command_reply_payload_encode_va(SILC_COMMAND_MOTD,
SILC_STATUS_OK, 0, ident, 2,
- 2, idp, idp->len,
+ 2, idp->data, idp->len,
3, entry->motd,
entry->motd ?
strlen(entry->motd) : 0);
if (!entry) {
entry = silc_idlist_find_server_by_id(server->global_list, server_id,
TRUE, NULL);
- if (!entry)
- goto out;
+ if (!entry) {
+ /* entry isn't known so we IDENTIFY it. otherwise the
+ * silc_server_command_motd won't know about it and tell
+ * the client that there is no such server */
+ SilcBuffer buffer;
+ buffer = silc_command_payload_encode_va(SILC_COMMAND_IDENTIFY,
+ ++server->cmd_ident, 5,
+ 1, NULL, 0, 2, NULL, 0,
+ 3, NULL, 0, 4, NULL, 0,
+ 5, tmp, tmp_len);
+ silc_server_packet_send(server, SILC_PRIMARY_ROUTE(server),
+ SILC_PACKET_COMMAND, 0, buffer->data,
+ buffer->len, TRUE);
+ silc_server_command_pending(server, SILC_COMMAND_IDENTIFY,
+ server->cmd_ident,
+ silc_server_command_reply_motd,
+ cmd);
+ silc_buffer_free(buffer);
+ return;
+ }
}
/* Get the motd */