diff options
author | Test_User <hax@andrewyu.org> | 2024-06-15 18:35:19 -0400 |
---|---|---|
committer | Test_User <hax@andrewyu.org> | 2024-06-15 18:35:19 -0400 |
commit | 98040ca35a29172701adf32c95e6d15392ec5fd1 (patch) | |
tree | db51f5aba9e3cdacd8a636faf19758538a9bf60e /protocols/inspircd2.c | |
parent | 4876b376c4eed926e4500b9f2cd1a3b8bfde554f (diff) | |
download | haxircd-98040ca35a29172701adf32c95e6d15392ec5fd1.tar.gz haxircd-98040ca35a29172701adf32c95e6d15392ec5fd1.zip |
Start of InspIRCd v3 support
Diffstat (limited to 'protocols/inspircd2.c')
-rw-r--r-- | protocols/inspircd2.c | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/protocols/inspircd2.c b/protocols/inspircd2.c index 9bd40b9..cfc9cf9 100644 --- a/protocols/inspircd2.c +++ b/protocols/inspircd2.c @@ -253,7 +253,13 @@ void * inspircd2_protocol_connection(void *type) { struct string line = {.data = full_msg.data, .len = msg_len}; - WRITES(2, STRING("[InspIRCd v2] [server -> us] Got `")); + if (ready) { + WRITES(2, STRING("[InspIRCd v2] [")); + WRITES(2, config->name); + WRITES(2, STRING(" -> us] Got `")); + } else { + WRITES(2, STRING("[InspIRCd v2] [unidentified server -> us] Got `")); + } WRITES(2, line); WRITES(2, STRING("'\r\n")); @@ -362,6 +368,23 @@ void * inspircd2_protocol_connection(void *type) { pthread_mutex_lock(&state_lock); + if (source.len != 0) { + struct server_info *server; + struct user_info *user = get_table_index(user_list, source); + if (user) + server = get_table_index(server_list, user->server); + else + server = get_table_index(server_list, source); + + if (!server) + goto inspircd2_protocol_handle_connection_unlock_next; + + if (STRING_EQ(server->sid, SID) || !STRING_EQ(server->next, config->sid)) { + WRITES(2, STRING("[InspIRCd v2] Protocol violation: sourge isn't on this link.\r\n\n")); + goto inspircd2_protocol_handle_connection_unlock_close; + } + } + if (!ready) { int (*func)(struct string source, size_t argc, struct string *argv, size_t net, void *handle, struct server_config **config, char is_incoming); func = get_table_index(inspircd2_protocol_init_commands, command); |