#include "server_internal.h"
#include "command_reply.h"
-/* All functions that call the COMMAND_CHECK_STATUS or the
- COMMAND_CHECK_STATUS_LIST macros must have out: goto label. */
-
-#define COMMAND_CHECK_STATUS \
-do { \
- SILC_LOG_DEBUG(("Start")); \
- SILC_GET16_MSB(status, silc_argument_get_arg_type(cmd->args, 1, NULL)); \
- if (status != SILC_STATUS_OK) \
- goto out; \
-} while(0)
-
-#define COMMAND_CHECK_STATUS_LIST \
-do { \
- SILC_LOG_DEBUG(("Start")); \
- SILC_GET16_MSB(status, silc_argument_get_arg_type(cmd->args, 1, NULL)); \
- if (status != SILC_STATUS_OK && \
- status != SILC_STATUS_LIST_START && \
- status != SILC_STATUS_LIST_ITEM && \
- status != SILC_STATUS_LIST_END) \
- goto out; \
+/* All functions that call the COMMAND_CHECK_STATUS macros must have
+ out: goto label. */
+
+#define COMMAND_CHECK_STATUS \
+do { \
+ SILC_LOG_DEBUG(("Start")); \
+ if (!silc_command_get_status(cmd->payload, &status, &error)) \
+ goto out; \
} while(0)
/* Server command reply list. Not all commands have reply function as
{
SilcServerCommandReplyContext cmd = (SilcServerCommandReplyContext)context;
SilcServer server = cmd->server;
- SilcCommandStatus status;
+ SilcCommandStatus status, error;
- COMMAND_CHECK_STATUS_LIST;
+ COMMAND_CHECK_STATUS;
if (!silc_server_command_reply_whois_save(cmd))
goto out;
out:
/* If we received notify for invalid ID we'll remove the ID if we
have it cached. */
- if (status == SILC_STATUS_ERR_NO_SUCH_CLIENT_ID &&
+ if (error == SILC_STATUS_ERR_NO_SUCH_CLIENT_ID &&
cmd->sock->type == SILC_SOCKET_TYPE_ROUTER) {
SilcClientEntry client;
SilcUInt32 tmp_len;
SILC_SERVER_CMD_REPLY_FUNC(whowas)
{
SilcServerCommandReplyContext cmd = (SilcServerCommandReplyContext)context;
- SilcCommandStatus status;
+ SilcCommandStatus status, error;
- COMMAND_CHECK_STATUS_LIST;
+ COMMAND_CHECK_STATUS;
if (!silc_server_command_reply_whowas_save(cmd))
goto out;
{
SilcServerCommandReplyContext cmd = (SilcServerCommandReplyContext)context;
SilcServer server = cmd->server;
- SilcCommandStatus status;
+ SilcCommandStatus status, error;
- COMMAND_CHECK_STATUS_LIST;
+ COMMAND_CHECK_STATUS;
if (!silc_server_command_reply_identify_save(cmd))
goto out;
out:
/* If we received notify for invalid ID we'll remove the ID if we
have it cached. */
- if (status == SILC_STATUS_ERR_NO_SUCH_CLIENT_ID &&
+ if (error == SILC_STATUS_ERR_NO_SUCH_CLIENT_ID &&
cmd->sock->type == SILC_SOCKET_TYPE_ROUTER) {
SilcClientEntry client;
SilcUInt32 tmp_len;
{
SilcServerCommandReplyContext cmd = (SilcServerCommandReplyContext)context;
SilcServer server = cmd->server;
- SilcCommandStatus status;
+ SilcCommandStatus status, error;
SilcServerEntry entry;
SilcServerID *server_id;
SilcUInt32 tmp_len;
{
SilcServerCommandReplyContext cmd = (SilcServerCommandReplyContext)context;
SilcServer server = cmd->server;
- SilcCommandStatus status;
+ SilcCommandStatus status, error;
SilcServerEntry entry = NULL;
SilcServerID *server_id;
SilcUInt32 tmp_len;
SilcServerCommandReplyContext cmd = (SilcServerCommandReplyContext)context;
SilcServer server = cmd->server;
SilcIDCacheEntry cache = NULL;
- SilcCommandStatus status;
+ SilcCommandStatus status, error;
SilcChannelID *id;
SilcClientID *client_id = NULL;
SilcChannelEntry entry;
{
SilcServerCommandReplyContext cmd = (SilcServerCommandReplyContext)context;
SilcServer server = cmd->server;
- SilcCommandStatus status;
+ SilcCommandStatus status, error;
unsigned char *tmp;
SilcUInt32 tmp_len;
SilcBufferStruct buf;
{
SilcServerCommandReplyContext cmd = (SilcServerCommandReplyContext)context;
SilcServer server = cmd->server;
- SilcCommandStatus status;
+ SilcCommandStatus status, error;
SilcChannelEntry channel;
SilcChannelID *channel_id = NULL;
SilcBuffer client_id_list;
{
SilcServerCommandReplyContext cmd = (SilcServerCommandReplyContext)context;
SilcServer server = cmd->server;
- SilcCommandStatus status;
+ SilcCommandStatus status, error;
SilcClientEntry client = NULL;
SilcServerEntry server_entry = NULL;
SilcClientID *client_id = NULL;
{
SilcServerCommandReplyContext cmd = (SilcServerCommandReplyContext)context;
SilcServer server = cmd->server;
- SilcCommandStatus status;
+ SilcCommandStatus status, error;
SilcChannelID *channel_id = NULL;
SilcChannelEntry channel;
SilcIDCacheEntry cache;
SilcUInt32 usercount = 0;
bool global_list = FALSE;
- COMMAND_CHECK_STATUS_LIST;
+ COMMAND_CHECK_STATUS;
tmp = silc_argument_get_arg_type(cmd->args, 2, &len);
channel_id = silc_id_payload_parse_id(tmp, len, NULL);