diff options
Diffstat (limited to 'zyklonb.c')
-rw-r--r-- | zyklonb.c | 36 |
1 files changed, 18 insertions, 18 deletions
@@ -32,11 +32,11 @@ static struct config_item g_config_table[] = { "irc_host", NULL, "Address of the IRC server" }, { "irc_port", "6667", "Port of the IRC server" }, - { "ssl", "off", "Whether to use SSL" }, - { "ssl_cert", NULL, "Client SSL certificate (PEM)" }, - { "ssl_verify", "on", "Whether to verify certificates" }, - { "ssl_ca_file", NULL, "OpenSSL CA bundle file" }, - { "ssl_ca_path", NULL, "OpenSSL CA bundle path" }, + { "tls", "off", "Whether to use TLS" }, + { "tls_cert", NULL, "Client TLS certificate (PEM)" }, + { "tls_verify", "on", "Whether to verify certificates" }, + { "tls_ca_file", NULL, "OpenSSL CA bundle file" }, + { "tls_ca_path", NULL, "OpenSSL CA bundle path" }, { "autojoin", NULL, "Channels to join on start" }, { "reconnect", "on", "Whether to reconnect on error" }, { "reconnect_delay", "5", "Time between reconnecting" }, @@ -320,7 +320,7 @@ irc_initialize_ssl_ctx (struct bot_context *ctx, struct error **e) SSL_CTX_set_options (ctx->ssl_ctx, SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3); bool verify; - if (!irc_get_boolean_from_config (ctx, "ssl_verify", &verify, e)) + if (!irc_get_boolean_from_config (ctx, "tls_verify", &verify, e)) return false; SSL_CTX_set_verify (ctx->ssl_ctx, verify ? SSL_VERIFY_PEER : SSL_VERIFY_NONE, NULL); @@ -363,7 +363,7 @@ ca_error: } static bool -irc_initialize_ssl (struct bot_context *ctx, struct error **e) +irc_initialize_tls (struct bot_context *ctx, struct error **e) { const char *error_info = NULL; ctx->ssl_ctx = SSL_CTX_new (SSLv23_client_method ()); @@ -376,17 +376,17 @@ irc_initialize_ssl (struct bot_context *ctx, struct error **e) if (!ctx->ssl) goto error_ssl_2; - const char *ssl_cert = str_map_find (&ctx->config, "ssl_cert"); - if (ssl_cert) + const char *tls_cert = str_map_find (&ctx->config, "tls_cert"); + if (tls_cert) { char *path = resolve_filename - (ssl_cert, resolve_relative_config_filename); + (tls_cert, resolve_relative_config_filename); if (!path) - print_error ("%s: %s", "cannot open file", ssl_cert); + print_error ("%s: %s", "cannot open file", tls_cert); // XXX: perhaps we should read the file ourselves for better messages else if (!SSL_use_certificate_file (ctx->ssl, path, SSL_FILETYPE_PEM) || !SSL_use_PrivateKey_file (ctx->ssl, path, SSL_FILETYPE_PEM)) - print_error ("%s: %s", "setting the SSL client certificate failed", + print_error ("%s: %s", "setting the TLS client certificate failed", ERR_error_string (ERR_get_error (), NULL)); free (path); } @@ -418,7 +418,7 @@ error_ssl_1: // multiple errors on the OpenSSL stack. if (!error_info) error_info = ERR_error_string (ERR_get_error (), NULL); - error_set (e, "%s: %s", "could not initialize SSL", error_info); + error_set (e, "%s: %s", "could not initialize TLS", error_info); return false; } @@ -1444,7 +1444,7 @@ enum irc_read_result }; static enum irc_read_result -irc_fill_read_buffer_ssl (struct bot_context *ctx, struct str *buf) +irc_fill_read_buffer_tls (struct bot_context *ctx, struct str *buf) { int n_read; start: @@ -1608,7 +1608,7 @@ on_irc_readable (const struct pollfd *fd, struct bot_context *ctx) struct str *buf = &ctx->read_buffer; enum irc_read_result (*fill_buffer)(struct bot_context *, struct str *) = ctx->ssl - ? irc_fill_read_buffer_ssl + ? irc_fill_read_buffer_tls : irc_fill_read_buffer; bool disconnected = false; while (true) @@ -1754,8 +1754,8 @@ irc_connect (struct bot_context *ctx, struct error **e) return false; } - bool use_ssl; - if (!irc_get_boolean_from_config (ctx, "ssl", &use_ssl, e)) + bool use_tls; + if (!irc_get_boolean_from_config (ctx, "tls", &use_tls, e)) return false; bool connected = socks_host @@ -1765,7 +1765,7 @@ irc_connect (struct bot_context *ctx, struct error **e) if (!connected) return false; - if (use_ssl && !irc_initialize_ssl (ctx, e)) + if (use_tls && !irc_initialize_tls (ctx, e)) { xclose (ctx->irc_fd); ctx->irc_fd = -1; |