From 99ba4795414c55c34fb778da3b3b0563170212a5 Mon Sep 17 00:00:00 2001 From: pk910 Date: Sun, 8 Nov 2015 19:55:34 +0100 Subject: [PATCH] added ssl cipher notice on connect --- include/ssl.h | 2 ++ ircd/s_user.c | 3 +++ ircd/ssl.c | 7 +++++++ 3 files changed, 12 insertions(+) diff --git a/include/ssl.h b/include/ssl.h index dc910b1..db4cad0 100644 --- a/include/ssl.h +++ b/include/ssl.h @@ -94,4 +94,6 @@ IOResult ssl_send_encrypt(struct SSLConnection *connection, struct MsgQ* buf, un IOResult ssl_send_encrypt_plain(struct SSLConnection *connection, char *buf, int len); extern int ssl_connection_flush(struct SSLConnection *connection); +extern const char* ssl_get_cipher(struct SSLConnection *connection); + #endif /* INCLUDED_parse_h */ diff --git a/ircd/s_user.c b/ircd/s_user.c index 632e185..9853ed2 100644 --- a/ircd/s_user.c +++ b/ircd/s_user.c @@ -399,6 +399,9 @@ int register_user(struct Client *cptr, struct Client *sptr) if(cli_connect(sptr)->con_ssl) { SetSSLConn(sptr); + + const char *cipher = ssl_get_cipher(cli_connect(sptr)->con_ssl); + sendcmdto_one(&me, CMD_NOTICE, sptr, "%C :You are connected to %s with %s", sptr, cli_name(&me), cipher); } } else { diff --git a/ircd/ssl.c b/ircd/ssl.c index e407bd4..62f6147 100644 --- a/ircd/ssl.c +++ b/ircd/ssl.c @@ -405,6 +405,12 @@ int ssl_connection_flush(struct SSLConnection *connection) { return 0; } +const char* ssl_get_cipher(struct SSLConnection *connection) { + if(!connection) + return NULL; + return SSL_get_cipher(connection->session); +} + #else void ssl_free_connection(struct SSLConnection *connection) {} void ssl_free_listener(struct SSLConnection *listener) {} @@ -412,5 +418,6 @@ struct SSLListener *ssl_create_listener() { return NULL; } struct SSLConnection *ssl_start_handshake_listener(struct SSLListener *listener, int fd, void *data, enum SSLDataType datatype) { return NULL; } IOResult ssl_recv_decrypt(struct SSLConnection *connection, char *buf, int *len) { return IO_FAILURE; } int ssl_connection_flush(struct SSLConnection *connection) { return 0; }; +const char* ssl_get_cipher(struct SSLConnection *connection) { return NULL; } #endif -- 2.20.1