projects
/
silc.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Integer type name change.
[silc.git]
/
apps
/
silcd
/
command_reply.c
diff --git
a/apps/silcd/command_reply.c
b/apps/silcd/command_reply.c
index 1f0545b35ca745729478e322e4552943aa6e2edd..3c4f490e4c46e4d9c6ead1999520079160318649 100644
(file)
--- a/
apps/silcd/command_reply.c
+++ b/
apps/silcd/command_reply.c
@@
-72,7
+72,7
@@
void silc_server_command_reply_process(SilcServer server,
SilcServerCommandReplyContext ctx;
SilcCommandPayload payload;
SilcCommand command;
SilcServerCommandReplyContext ctx;
SilcCommandPayload payload;
SilcCommand command;
-
ui
nt16 ident;
+
SilcUI
nt16 ident;
SILC_LOG_DEBUG(("Start"));
SILC_LOG_DEBUG(("Start"));
@@
-139,7
+139,7
@@
silc_server_command_reply_whois_save(SilcServerCommandReplyContext cmd)
SilcClientEntry client;
char global = FALSE;
char *nick;
SilcClientEntry client;
char global = FALSE;
char *nick;
-
ui
nt32 mode = 0, len, id_len, flen;
+
SilcUI
nt32 mode = 0, len, id_len, flen;
int expire = 0;
id_data = silc_argument_get_arg_type(cmd->args, 2, &id_len);
int expire = 0;
id_data = silc_argument_get_arg_type(cmd->args, 2, &id_len);
@@
-275,7
+275,7
@@
SILC_SERVER_CMD_REPLY_FUNC(whois)
if (status == SILC_STATUS_ERR_NO_SUCH_CLIENT_ID &&
cmd->sock->type == SILC_SOCKET_TYPE_ROUTER) {
SilcClientEntry client;
if (status == SILC_STATUS_ERR_NO_SUCH_CLIENT_ID &&
cmd->sock->type == SILC_SOCKET_TYPE_ROUTER) {
SilcClientEntry client;
-
ui
nt32 tmp_len;
+
SilcUI
nt32 tmp_len;
unsigned char *tmp = silc_argument_get_arg_type(cmd->args, 2, &tmp_len);
if (tmp) {
SilcClientID *client_id = silc_id_payload_parse_id(tmp, tmp_len);
unsigned char *tmp = silc_argument_get_arg_type(cmd->args, 2, &tmp_len);
if (tmp) {
SilcClientID *client_id = silc_id_payload_parse_id(tmp, tmp_len);
@@
-284,8
+284,11
@@
SILC_SERVER_CMD_REPLY_FUNC(whois)
"the entry from cache"));
client = silc_idlist_find_client_by_id(server->global_list,
client_id, FALSE, NULL);
"the entry from cache"));
client = silc_idlist_find_client_by_id(server->global_list,
client_id, FALSE, NULL);
- if (client)
+ if (client) {
+ silc_server_remove_from_channels(server, NULL, client, TRUE,
+ NULL, TRUE);
silc_idlist_del_client(server->global_list, client);
silc_idlist_del_client(server->global_list, client);
+ }
silc_free(client_id);
}
}
silc_free(client_id);
}
}
@@
-301,7
+304,7
@@
static char
silc_server_command_reply_whowas_save(SilcServerCommandReplyContext cmd)
{
SilcServer server = cmd->server;
silc_server_command_reply_whowas_save(SilcServerCommandReplyContext cmd)
{
SilcServer server = cmd->server;
-
ui
nt32 len, id_len;
+
SilcUI
nt32 len, id_len;
unsigned char *id_data;
char *nickname, *username, *realname, *servername = NULL;
SilcClientID *client_id;
unsigned char *id_data;
char *nickname, *username, *realname, *servername = NULL;
SilcClientID *client_id;
@@
-413,7
+416,7
@@
static char
silc_server_command_reply_identify_save(SilcServerCommandReplyContext cmd)
{
SilcServer server = cmd->server;
silc_server_command_reply_identify_save(SilcServerCommandReplyContext cmd)
{
SilcServer server = cmd->server;
-
ui
nt32 len, id_len;
+
SilcUI
nt32 len, id_len;
unsigned char *id_data;
char *name, *info;
SilcClientID *client_id = NULL;
unsigned char *id_data;
char *name, *info;
SilcClientID *client_id = NULL;
@@
-633,7
+636,7
@@
SILC_SERVER_CMD_REPLY_FUNC(identify)
if (status == SILC_STATUS_ERR_NO_SUCH_CLIENT_ID &&
cmd->sock->type == SILC_SOCKET_TYPE_ROUTER) {
SilcClientEntry client;
if (status == SILC_STATUS_ERR_NO_SUCH_CLIENT_ID &&
cmd->sock->type == SILC_SOCKET_TYPE_ROUTER) {
SilcClientEntry client;
-
ui
nt32 tmp_len;
+
SilcUI
nt32 tmp_len;
unsigned char *tmp = silc_argument_get_arg_type(cmd->args, 2, &tmp_len);
if (tmp) {
SilcClientID *client_id = silc_id_payload_parse_id(tmp, tmp_len);
unsigned char *tmp = silc_argument_get_arg_type(cmd->args, 2, &tmp_len);
if (tmp) {
SilcClientID *client_id = silc_id_payload_parse_id(tmp, tmp_len);
@@
-642,8
+645,11
@@
SILC_SERVER_CMD_REPLY_FUNC(identify)
"the entry from cache"));
client = silc_idlist_find_client_by_id(server->global_list,
client_id, FALSE, NULL);
"the entry from cache"));
client = silc_idlist_find_client_by_id(server->global_list,
client_id, FALSE, NULL);
- if (client)
+ if (client) {
+ silc_server_remove_from_channels(server, NULL, client, TRUE,
+ NULL, TRUE);
silc_idlist_del_client(server->global_list, client);
silc_idlist_del_client(server->global_list, client);
+ }
silc_free(client_id);
}
}
silc_free(client_id);
}
}
@@
-662,7
+668,7
@@
SILC_SERVER_CMD_REPLY_FUNC(info)
SilcCommandStatus status;
SilcServerEntry entry;
SilcServerID *server_id;
SilcCommandStatus status;
SilcServerEntry entry;
SilcServerID *server_id;
-
ui
nt32 tmp_len;
+
SilcUI
nt32 tmp_len;
unsigned char *tmp, *name;
COMMAND_CHECK_STATUS;
unsigned char *tmp, *name;
COMMAND_CHECK_STATUS;
@@
-719,7
+725,7
@@
SILC_SERVER_CMD_REPLY_FUNC(motd)
SilcCommandStatus status;
SilcServerEntry entry = NULL;
SilcServerID *server_id;
SilcCommandStatus status;
SilcServerEntry entry = NULL;
SilcServerID *server_id;
-
ui
nt32 tmp_len;
+
SilcUI
nt32 tmp_len;
unsigned char *tmp;
COMMAND_CHECK_STATUS;
unsigned char *tmp;
COMMAND_CHECK_STATUS;
@@
-770,10
+776,10
@@
SILC_SERVER_CMD_REPLY_FUNC(join)
SilcClientID *client_id = NULL;
SilcChannelEntry entry;
SilcHmac hmac = NULL;
SilcClientID *client_id = NULL;
SilcChannelEntry entry;
SilcHmac hmac = NULL;
-
ui
nt32 id_len, len, list_count;
+
SilcUI
nt32 id_len, len, list_count;
unsigned char *id_string;
char *channel_name, *tmp;
unsigned char *id_string;
char *channel_name, *tmp;
-
ui
nt32 mode, created;
+
SilcUI
nt32 mode, created;
SilcBuffer keyp = NULL, client_id_list = NULL, client_mode_list = NULL;
COMMAND_CHECK_STATUS;
SilcBuffer keyp = NULL, client_id_list = NULL, client_mode_list = NULL;
COMMAND_CHECK_STATUS;
@@
-818,6
+824,7
@@
SILC_SERVER_CMD_REPLY_FUNC(join)
silc_buffer_put(keyp, tmp, len);
}
silc_buffer_put(keyp, tmp, len);
}
+ /* Parse the Channel ID */
id = silc_id_payload_parse_id(id_string, id_len);
if (!id)
goto out;
id = silc_id_payload_parse_id(id_string, id_len);
if (!id)
goto out;
@@
-867,8
+874,13
@@
SILC_SERVER_CMD_REPLY_FUNC(join)
local list. */
entry = silc_idlist_find_channel_by_name(server->global_list,
channel_name, &cache);
local list. */
entry = silc_idlist_find_channel_by_name(server->global_list,
channel_name, &cache);
- if (entry)
+ if (entry) {
+ if (entry->rekey) {
+ silc_schedule_task_del_by_context(server->schedule, entry->rekey);
+ SILC_LOG_ERROR(("global_list->channels: entry->rekey != NULL, inform Pekka now!!!"));
+ }
silc_idlist_del_channel(server->global_list, entry);
silc_idlist_del_channel(server->global_list, entry);
+ }
/* Add the channel to our local list. */
entry = silc_idlist_add_channel(server->local_list, strdup(channel_name),
/* Add the channel to our local list. */
entry = silc_idlist_add_channel(server->local_list, strdup(channel_name),
@@
-881,19
+893,19
@@
SILC_SERVER_CMD_REPLY_FUNC(join)
server->stat.my_channels++;
} else {
/* The entry exists. */
server->stat.my_channels++;
} else {
/* The entry exists. */
- silc_free(cache->id);
- entry->id = id;
- cache->id = entry->id;
+
+ /* If ID has changed, then update it to the cache too. */
+ if (!SILC_ID_CHANNEL_COMPARE(entry->id, id))
+ silc_idlist_replace_channel_id(server->local_list, entry->id, id);
+
entry->disabled = FALSE;
/* Remove the founder auth data if the mode is not set but we have
them in the entry */
if (!(mode & SILC_CHANNEL_MODE_FOUNDER_AUTH) && entry->founder_key) {
silc_pkcs_public_key_free(entry->founder_key);
entry->disabled = FALSE;
/* Remove the founder auth data if the mode is not set but we have
them in the entry */
if (!(mode & SILC_CHANNEL_MODE_FOUNDER_AUTH) && entry->founder_key) {
silc_pkcs_public_key_free(entry->founder_key);
- if (entry->founder_passwd) {
- silc_free(entry->founder_passwd);
- entry->founder_passwd = NULL;
- }
+ silc_free(entry->founder_passwd);
+ entry->founder_passwd = NULL;
}
}
}
}
@@
-905,26
+917,21
@@
SILC_SERVER_CMD_REPLY_FUNC(join)
/* Get the ban list */
tmp = silc_argument_get_arg_type(cmd->args, 8, &len);
if (tmp) {
/* Get the ban list */
tmp = silc_argument_get_arg_type(cmd->args, 8, &len);
if (tmp) {
- if (entry->ban_list)
- silc_free(entry->ban_list);
- entry->ban_list = silc_calloc(len, sizeof(*entry->ban_list));
- memcpy(entry->ban_list, tmp, len);
+ silc_free(entry->ban_list);
+ entry->ban_list = silc_memdup(tmp, len);
}
/* Get the invite list */
tmp = silc_argument_get_arg_type(cmd->args, 9, &len);
if (tmp) {
}
/* Get the invite list */
tmp = silc_argument_get_arg_type(cmd->args, 9, &len);
if (tmp) {
- if (entry->invite_list)
- silc_free(entry->invite_list);
- entry->invite_list = silc_calloc(len, sizeof(*entry->invite_list));
- memcpy(entry->invite_list, tmp, len);
+ silc_free(entry->invite_list);
+ entry->invite_list = silc_memdup(tmp, len);
}
/* Get the topic */
tmp = silc_argument_get_arg_type(cmd->args, 10, &len);
if (tmp) {
}
/* Get the topic */
tmp = silc_argument_get_arg_type(cmd->args, 10, &len);
if (tmp) {
- if (entry->topic)
- silc_free(entry->topic);
+ silc_free(entry->topic);
entry->topic = strdup(tmp);
}
entry->topic = strdup(tmp);
}
@@
-943,10
+950,11
@@
SILC_SERVER_CMD_REPLY_FUNC(join)
entry->mode = mode;
/* Save channel key */
entry->mode = mode;
/* Save channel key */
- if (
!(entry->mode & SILC_CHANNEL_MODE_PRIVKEY))
- silc_server_save_channel_key(server, keyp, entry);
- if (keyp)
+ if (
keyp) {
+ if (!(entry->mode & SILC_CHANNEL_MODE_PRIVKEY))
+ silc_server_save_channel_key(server, keyp, entry);
silc_buffer_free(keyp);
silc_buffer_free(keyp);
+ }
/* Save the users to the channel */
silc_server_save_users_on_channel(server, cmd->sock, entry,
/* Save the users to the channel */
silc_server_save_users_on_channel(server, cmd->sock, entry,
@@
-974,8
+982,8
@@
SILC_SERVER_CMD_REPLY_FUNC(users)
SilcBuffer client_id_list;
SilcBuffer client_mode_list;
unsigned char *tmp;
SilcBuffer client_id_list;
SilcBuffer client_mode_list;
unsigned char *tmp;
-
ui
nt32 tmp_len;
-
ui
nt32 list_count;
+
SilcUI
nt32 tmp_len;
+
SilcUI
nt32 list_count;
COMMAND_CHECK_STATUS;
COMMAND_CHECK_STATUS;
@@
-1064,8
+1072,8
@@
SILC_SERVER_CMD_REPLY_FUNC(getkey)
SilcServerID *server_id = NULL;
SilcSKEPKType type;
unsigned char *tmp, *pk;
SilcServerID *server_id = NULL;
SilcSKEPKType type;
unsigned char *tmp, *pk;
-
ui
nt32 len;
-
ui
nt16 pk_len;
+
SilcUI
nt32 len;
+
SilcUI
nt16 pk_len;
SilcIDPayload idp = NULL;
SilcIdType id_type;
SilcPublicKey public_key = NULL;
SilcIDPayload idp = NULL;
SilcIdType id_type;
SilcPublicKey public_key = NULL;
@@
-1146,9
+1154,9
@@
SILC_SERVER_CMD_REPLY_FUNC(list)
SilcChannelID *channel_id = NULL;
SilcChannelEntry channel;
SilcIDCacheEntry cache;
SilcChannelID *channel_id = NULL;
SilcChannelEntry channel;
SilcIDCacheEntry cache;
-
ui
nt32 len;
+
SilcUI
nt32 len;
unsigned char *tmp, *name, *topic;
unsigned char *tmp, *name, *topic;
-
ui
nt32 usercount = 0;
+
SilcUI
nt32 usercount = 0;
bool global_list = FALSE;
COMMAND_CHECK_STATUS_LIST;
bool global_list = FALSE;
COMMAND_CHECK_STATUS_LIST;
@@
-1191,6
+1199,8
@@
SILC_SERVER_CMD_REPLY_FUNC(list)
cache->expire = time(NULL) + 60;
}
cache->expire = time(NULL) + 60;
}
+ channel->user_count = usercount;
+
if (topic) {
silc_free(channel->topic);
channel->topic = strdup(topic);
if (topic) {
silc_free(channel->topic);
channel->topic = strdup(topic);