projects
/
silc.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
New silcconfig library and server parser. Merged silc-newconfig-final.patch.
[silc.git]
/
apps
/
silcd
/
packet_receive.c
diff --git
a/apps/silcd/packet_receive.c
b/apps/silcd/packet_receive.c
index 85b1a1b20444afc59ec5584ba53d8aa24a87b245..2f3aa2f7206a5153be05e38422658f1fcd04fba5 100644
(file)
--- a/
apps/silcd/packet_receive.c
+++ b/
apps/silcd/packet_receive.c
@@
-49,6
+49,7
@@
void silc_server_notify(SilcServer server,
uint32 mode;
unsigned char *tmp;
uint32 tmp_len;
uint32 mode;
unsigned char *tmp;
uint32 tmp_len;
+ bool local;
SILC_LOG_DEBUG(("Start"));
SILC_LOG_DEBUG(("Start"));
@@
-211,6
+212,8
@@
void silc_server_notify(SilcServer server,
/* The channel is global now */
channel->global_users = TRUE;
/* The channel is global now */
channel->global_users = TRUE;
+ SILC_LOG_DEBUG(("Joining to channel %s", channel->channel_name));
+
/* JOIN the global client to the channel (local clients (if router
created the channel) is joined in the pending JOIN command). */
chl = silc_calloc(1, sizeof(*chl));
/* JOIN the global client to the channel (local clients (if router
created the channel) is joined in the pending JOIN command). */
chl = silc_calloc(1, sizeof(*chl));
@@
-627,6
+630,7
@@
void silc_server_notify(SilcServer server,
if (chl2) {
chl2->mode = mode;
silc_free(channel_id);
if (chl2) {
chl2->mode = mode;
silc_free(channel_id);
+ silc_hash_table_list_reset(&htl);
goto out;
}
}
goto out;
}
}
@@
-637,6
+641,8
@@
void silc_server_notify(SilcServer server,
break;
}
break;
}
+ SILC_LOG_DEBUG(("Changing the channel user mode"));
+
/* Change the mode */
chl->mode = mode;
if (!(mode & SILC_CHANNEL_UMODE_CHANFO))
/* Change the mode */
chl->mode = mode;
if (!(mode & SILC_CHANNEL_UMODE_CHANFO))
@@
-645,6
+651,7
@@
void silc_server_notify(SilcServer server,
chl2 = chl;
}
}
chl2 = chl;
}
}
+ silc_hash_table_list_reset(&htl);
/* Send the same notify to the channel */
if (!notify_sent)
/* Send the same notify to the channel */
if (!notify_sent)
@@
-749,10
+756,10
@@
void silc_server_notify(SilcServer server,
goto out;
/* Get the channel entry */
goto out;
/* Get the channel entry */
- channel = silc_idlist_find_channel_by_id(server->
glob
al_list,
+ channel = silc_idlist_find_channel_by_id(server->
loc
al_list,
channel_id, NULL);
if (!channel) {
channel_id, NULL);
if (!channel) {
- channel = silc_idlist_find_channel_by_id(server->
loc
al_list,
+ channel = silc_idlist_find_channel_by_id(server->
glob
al_list,
channel_id, NULL);
if (!channel) {
silc_free(channel_id);
channel_id, NULL);
if (!channel) {
silc_free(channel_id);
@@
-779,9
+786,9
@@
void silc_server_notify(SilcServer server,
silc_id_render(channel_id2, SILC_ID_CHANNEL)));
/* Replace the Channel ID */
silc_id_render(channel_id2, SILC_ID_CHANNEL)));
/* Replace the Channel ID */
- if (!silc_idlist_replace_channel_id(server->
glob
al_list, channel_id,
+ if (!silc_idlist_replace_channel_id(server->
loc
al_list, channel_id,
channel_id2))
channel_id2))
- if (!silc_idlist_replace_channel_id(server->
loc
al_list, channel_id,
+ if (!silc_idlist_replace_channel_id(server->
glob
al_list, channel_id,
channel_id2)) {
silc_free(channel_id2);
channel_id2 = NULL;
channel_id2)) {
silc_free(channel_id2);
channel_id2 = NULL;
@@
-789,7
+796,14
@@
void silc_server_notify(SilcServer server,
if (channel_id2) {
SilcBuffer users = NULL, users_modes = NULL;
if (channel_id2) {
SilcBuffer users = NULL, users_modes = NULL;
-
+
+ /* Re-announce this channel which ID was changed. */
+ silc_server_send_new_channel(server, sock, FALSE, channel->channel_name,
+ channel->id,
+ silc_id_get_len(channel->id,
+ SILC_ID_CHANNEL),
+ channel->mode);
+
/* Re-announce our clients on the channel as the ID has changed now */
silc_server_announce_get_channel_users(server, channel, &users,
&users_modes);
/* Re-announce our clients on the channel as the ID has changed now */
silc_server_announce_get_channel_users(server, channel, &users,
&users_modes);
@@
-842,9
+856,11
@@
void silc_server_notify(SilcServer server,
/* Get server entry */
server_entry = silc_idlist_find_server_by_id(server->global_list,
server_id, TRUE, NULL);
/* Get server entry */
server_entry = silc_idlist_find_server_by_id(server->global_list,
server_id, TRUE, NULL);
+ local = TRUE;
if (!server_entry) {
server_entry = silc_idlist_find_server_by_id(server->local_list,
server_id, TRUE, NULL);
if (!server_entry) {
server_entry = silc_idlist_find_server_by_id(server->local_list,
server_id, TRUE, NULL);
+ local = TRUE;
if (!server_entry) {
/* If we are normal server then we might not have the server. Check
whether router was kind enough to send the list of all clients
if (!server_entry) {
/* If we are normal server then we might not have the server. Check
whether router was kind enough to send the list of all clients
@@
-853,7
+869,6
@@
void silc_server_notify(SilcServer server,
if (server->server_type != SILC_ROUTER &&
silc_argument_get_arg_num(args) > 1) {
int i;
if (server->server_type != SILC_ROUTER &&
silc_argument_get_arg_num(args) > 1) {
int i;
- bool local;
for (i = 1; i < silc_argument_get_arg_num(args); i++) {
/* Get Client ID */
for (i = 1; i < silc_argument_get_arg_num(args); i++) {
/* Get Client ID */
@@
-907,8
+922,8
@@
void silc_server_notify(SilcServer server,
silc_server_remove_clients_by_server(server, server_entry, TRUE);
/* Remove the server entry */
silc_server_remove_clients_by_server(server, server_entry, TRUE);
/* Remove the server entry */
- if (!silc_idlist_del_server(server->global_list, server_entry))
-
silc_idlist_del_server(server->loc
al_list, server_entry);
+ silc_idlist_del_server(local ? server->local_list :
+
server->glob
al_list, server_entry);
/* XXX update statistics */
/* XXX update statistics */
@@
-1141,7
+1156,7
@@
do { \
if (tmp && channel->ban_list) {
char *start, *end, *n;
if (tmp && channel->ban_list) {
char *start, *end, *n;
- if (!str
cmp(channel->ban_list, tmp
)) {
+ if (!str
ncmp(channel->ban_list, tmp, strlen(channel->ban_list) - 1
)) {
silc_free(channel->ban_list);
channel->ban_list = NULL;
} else {
silc_free(channel->ban_list);
channel->ban_list = NULL;
} else {
@@
-1945,12
+1960,13
@@
static void silc_server_new_id_real(SilcServer server,
router = silc_idlist_find_server_by_id(server->local_list,
sender_id, TRUE, NULL);
silc_free(sender_id);
router = silc_idlist_find_server_by_id(server->local_list,
sender_id, TRUE, NULL);
silc_free(sender_id);
- if (!router)
- goto out;
router_sock = sock;
id_list = server->global_list;
}
router_sock = sock;
id_list = server->global_list;
}
+ if (!router)
+ goto out;
+
switch(id_type) {
case SILC_ID_CLIENT:
{
switch(id_type) {
case SILC_ID_CLIENT:
{
@@
-2483,7
+2499,7
@@
void silc_server_connection_auth_request(SilcServer server,
SilcSocketConnection sock,
SilcPacketContext *packet)
{
SilcSocketConnection sock,
SilcPacketContext *packet)
{
- SilcServerConfigSectionClient
Connection
*client = NULL;
+ SilcServerConfigSectionClient *client = NULL;
uint16 conn_type;
int ret, port;
SilcAuthMethod auth_meth;
uint16 conn_type;
int ret, port;
SilcAuthMethod auth_meth;
@@
-2507,11
+2523,11
@@
void silc_server_connection_auth_request(SilcServer server,
/* Get the authentication method for the client */
auth_meth = SILC_AUTH_NONE;
port = server->sockets[server->sock]->port; /* Listenning port */
/* Get the authentication method for the client */
auth_meth = SILC_AUTH_NONE;
port = server->sockets[server->sock]->port; /* Listenning port */
- client = silc_server_config_find_client
_conn
(server->config,
+ client = silc_server_config_find_client(server->config,
sock->ip,
port);
if (!client)
sock->ip,
port);
if (!client)
- client = silc_server_config_find_client
_conn
(server->config,
+ client = silc_server_config_find_client(server->config,
sock->hostname,
port);
if (client)
sock->hostname,
port);
if (client)