aboutsummaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
Diffstat (limited to 'protocols')
-rw-r--r--protocols/inspircd2.c40
-rw-r--r--protocols/inspircd2.h3
2 files changed, 43 insertions, 0 deletions
diff --git a/protocols/inspircd2.c b/protocols/inspircd2.c
index 17dc726..b19960e 100644
--- a/protocols/inspircd2.c
+++ b/protocols/inspircd2.c
@@ -697,6 +697,21 @@ void inspircd2_protocol_propagate_set_account(struct string from, struct user_in
inspircd2_protocol_propagate(from, STRING("\n"));
}
+// [:source] METADATA <user> ssl_cert <vtrsE (none) | vTrse <cert>>
+void inspircd2_protocol_propagate_set_cert(struct string from, struct user_info *user, struct string cert, struct string source) {
+ inspircd2_protocol_propagate(from, STRING(":"));
+ inspircd2_protocol_propagate(from, source);
+ inspircd2_protocol_propagate(from, STRING(" METADATA "));
+ inspircd2_protocol_propagate(from, user->uid);
+ if (cert.len != 0) {
+ inspircd2_protocol_propagate(from, STRING(" ssl_cert :vTrse "));
+ inspircd2_protocol_propagate(from, cert);
+ inspircd2_protocol_propagate(from, STRING("\n"));
+ } else {
+ inspircd2_protocol_propagate(from, STRING(" ssl_cert :vtrsE No certificate was found.\n"));
+ }
+}
+
// [:source] FJOIN <channel> <timestamp> <modes> [<mode args>] <userlist: modes,uid [...]>
void inspircd2_protocol_propagate_set_channel(struct string from, struct channel_info *channel, char is_new_server, size_t user_count, struct user_info **users) {
inspircd2_protocol_propagate(from, STRING(":"));
@@ -865,6 +880,10 @@ int inspircd2_protocol_handle_set_account(struct string from, struct user_info *
return 0;
}
+int inspircd2_protocol_handle_set_cert(struct string from, struct user_info *info, struct string cert, struct string source) {
+ return 0;
+}
+
int inspircd2_protocol_handle_set_channel(struct string from, struct channel_info *channel, char is_new_channel, size_t user_count, struct user_info **users) {
return 0;
}
@@ -901,6 +920,10 @@ void inspircd2_protocol_fail_set_account(struct string from, struct user_info *i
return;
}
+void inspircd2_protocol_fail_set_cert(struct string from, struct user_info *info, struct string cert, struct string source) {
+ return;
+}
+
void inspircd2_protocol_fail_set_channel(struct string from, struct channel_info *channel, char is_new_channel, size_t user_count, struct user_info **users) {
return;
}
@@ -1828,6 +1851,23 @@ int inspircd2_protocol_handle_metadata(struct string source, size_t argc, struct
if (STRING_EQ(argv[1], STRING("accountname"))) {
if (set_account(config->sid, info, argv[2], source) != 0)
return -1;
+ } else if (STRING_EQ(argv[1], STRING("ssl_cert"))) {
+ struct string no_cert = STRING("vtrsE ");
+ if (argv[2].len < no_cert.len)
+ return -1;
+ struct string start = {.data = argv[2].data, .len = no_cert.len};
+ if (STRING_EQ(start, no_cert)) {
+ if (set_cert(config->sid, info, STRING(""), source) != 0)
+ return -1;
+ } else if (STRING_EQ(start, STRING("vTrse "))) {
+ struct string cert = {.data = argv[2].data + no_cert.len, .len = argv[2].len - no_cert.len};
+ size_t len;
+ for (len = 0; len < cert.len && cert.data[len] != ' '; len++)
+ ;
+ cert.len = len;
+ if (set_cert(config->sid, info, cert, source) != 0)
+ return -1;
+ }
}
return 0;
diff --git a/protocols/inspircd2.h b/protocols/inspircd2.h
index b8e7cda..7c5bc99 100644
--- a/protocols/inspircd2.h
+++ b/protocols/inspircd2.h
@@ -55,6 +55,7 @@ void inspircd2_protocol_propagate_kill_user(struct string from, struct string so
void inspircd2_protocol_propagate_oper_user(struct string from, struct user_info *info, struct string type, struct string source);
void inspircd2_protocol_propagate_set_account(struct string from, struct user_info *info, struct string account, struct string source);
+void inspircd2_protocol_propagate_set_cert(struct string from, struct user_info *info, struct string cert, struct string source);
void inspircd2_protocol_propagate_set_channel(struct string from, struct channel_info *channel, char is_new_channel, size_t user_count, struct user_info **users);
void inspircd2_protocol_propagate_join_channel(struct string from, struct channel_info *channel, size_t user_count, struct user_info **users);
@@ -74,6 +75,7 @@ void inspircd2_protocol_handle_kill_user(struct string from, struct string sourc
int inspircd2_protocol_handle_oper_user(struct string from, struct user_info *info, struct string type, struct string source);
int inspircd2_protocol_handle_set_account(struct string from, struct user_info *info, struct string account, struct string source);
+int inspircd2_protocol_handle_set_cert(struct string from, struct user_info *info, struct string cert, struct string source);
int inspircd2_protocol_handle_set_channel(struct string from, struct channel_info *channel, char is_new_channel, size_t user_count, struct user_info **users);
int inspircd2_protocol_handle_join_channel(struct string from, struct channel_info *channel, size_t user_count, struct user_info **users, char propagate);
@@ -87,6 +89,7 @@ void inspircd2_protocol_fail_rename_user(struct string from, struct user_info *i
void inspircd2_protocol_fail_oper_user(struct string from, struct user_info *info, struct string type, struct string source);
void inspircd2_protocol_fail_set_account(struct string from, struct user_info *info, struct string account, struct string source);
+void inspircd2_protocol_fail_set_cert(struct string from, struct user_info *info, struct string cert, struct string source);
void inspircd2_protocol_fail_set_channel(struct string from, struct channel_info *channel, char is_new_channel, size_t user_count, struct user_info **users);
void inspircd2_protocol_fail_join_channel(struct string from, struct channel_info *channel, size_t user_count, struct user_info **users, char propagate);