-}
-
-/* Received REKEY packet. The sender of the packet wants to regenerate
- its session keys. This starts the REKEY protocol. */
-
-void silc_server_rekey(SilcServer server,
- SilcSocketConnection sock,
- SilcPacketContext *packet)
-{
- SilcProtocol protocol;
- SilcServerRekeyInternalContext *proto_ctx;
- SilcIDListData idata = (SilcIDListData)sock->user_data;
-
- SILC_LOG_DEBUG(("Received rekey request"));
-
- /* If we have other protocol executing we have no other choice but to
- not execute rekey. XXX This is very bad thing. Let's hope this
- doesn't happen often. */
- if (sock->protocol) {
- SILC_LOG_WARNING(("Cannot execute REKEY protocol because other protocol "
- "is executing at the same time"));
- return;
- }
-
- /* Allocate internal protocol context. This is sent as context
- to the protocol. */
- proto_ctx = silc_calloc(1, sizeof(*proto_ctx));
- proto_ctx->server = (void *)server;
- proto_ctx->sock = silc_socket_dup(sock);
- proto_ctx->responder = TRUE;
- proto_ctx->pfs = idata->rekey->pfs;
-
- /* Perform rekey protocol. Will call the final callback after the
- protocol is over. */
- silc_protocol_alloc(SILC_PROTOCOL_SERVER_REKEY,
- &protocol, proto_ctx, silc_server_rekey_final);
- sock->protocol = protocol;
-
- if (proto_ctx->pfs == FALSE)
- /* Run the protocol */
- silc_protocol_execute(protocol, server->schedule, 0, 0);