Replace uses of HAVE_SSL with HAVE_LIBSSL
autoconf's AC_CHECK_LIB automatically sets HAVE_LIBSSL, whereas HAVE_SSL has to be set manually. This prepares us to remove some code from configure.
This commit is contained in:
@@ -157,7 +157,7 @@ typedef struct
|
||||
#endif
|
||||
char *orignick;
|
||||
struct timeval connect_time;
|
||||
#if defined(HAVE_SSL) && !defined(IN_MODULE)
|
||||
#if defined(HAVE_LIBSSL) && !defined(IN_MODULE)
|
||||
SSL_CTX* ctx;
|
||||
int enable_ssl;
|
||||
int ssl_error;
|
||||
@@ -328,7 +328,7 @@ ChannelList *BX_get_server_channels (int);
|
||||
int get_server_reconnect (int);
|
||||
int get_server_reconnecting (int);
|
||||
int get_server_change_pending (int);
|
||||
#ifdef HAVE_SSL
|
||||
#ifdef HAVE_LIBSSL
|
||||
void set_server_ssl(int, int);
|
||||
int get_server_ssl(int);
|
||||
#endif
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#if defined(HAVE_SSL) && !defined(IN_MODULE)
|
||||
#if defined(HAVE_LIBSSL) && !defined(IN_MODULE)
|
||||
|
||||
#ifndef __ssl_h__
|
||||
#define __ssl_h__
|
||||
|
||||
@@ -97,7 +97,7 @@ typedef struct
|
||||
void (*func_write) (int);
|
||||
void (*cleanup) (int);
|
||||
void *info;
|
||||
#if defined(HAVE_SSL) && !defined(IN_MODULE)
|
||||
#if defined(HAVE_LIBSSL) && !defined(IN_MODULE)
|
||||
SSL_CTX* ctx;
|
||||
int ssl_error;
|
||||
SSL* ssl_fd;
|
||||
|
||||
22
source/dcc.c
22
source/dcc.c
@@ -468,7 +468,7 @@ struct stat buf;
|
||||
send(s, (const char *)&n->transfer_orders, sizeof(struct transfer_struct), 0);
|
||||
}
|
||||
|
||||
#ifdef HAVE_SSL
|
||||
#ifdef HAVE_LIBSSL
|
||||
int SSL_dcc_create(SocketList *s, int sock, int doconnect)
|
||||
{
|
||||
set_blocking(sock);
|
||||
@@ -526,12 +526,12 @@ DCC_List *new_i;
|
||||
new = (DCC_int *)s->info;
|
||||
|
||||
if ((new_s = connect_by_number(inet_ntoa(new->remote), &new->remport, SERVICE_CLIENT, PROTOCOL_TCP, 0)) < 0
|
||||
#ifdef HAVE_SSL
|
||||
#ifdef HAVE_LIBSSL
|
||||
|| (flags & DCC_SSL ? SSL_dcc_create(s, new_s, 1) : 0) < 0
|
||||
#endif
|
||||
)
|
||||
{
|
||||
#ifdef HAVE_SSL
|
||||
#ifdef HAVE_LIBSSL
|
||||
SSL_show_errors();
|
||||
#endif
|
||||
erase_dcc_info(s->is_read, 1, "%s", convert_output_format("$G %RDCC%n Unable to create connection: $0-", "%s", errno ? strerror(errno) : "Unknown Host"));
|
||||
@@ -574,7 +574,7 @@ DCC_List *new_i;
|
||||
if (type == DCC_REFILEREAD)
|
||||
refileread_send_start(new_s, new);
|
||||
if (get_int_var(DCC_FAST_VAR)
|
||||
#ifdef HAVE_SSL
|
||||
#ifdef HAVE_LIBSSL
|
||||
&& !(flags & DCC_SSL)
|
||||
#endif
|
||||
)
|
||||
@@ -737,7 +737,7 @@ void (*func)(int) = process_dcc_chat;
|
||||
set_socketinfo(new_s, n);
|
||||
|
||||
new_sa = get_socket(new_s);
|
||||
#ifdef HAVE_SSL
|
||||
#ifdef HAVE_LIBSSL
|
||||
if((flags & DCC_SSL) && SSL_dcc_create(new_sa, new_s, 0) < 0)
|
||||
{
|
||||
say("SSL_accept failed.");
|
||||
@@ -781,7 +781,7 @@ SocketList *sl;
|
||||
if (dcc_types[type]->input)
|
||||
bytesread = (*dcc_types[type]->input)(s, type, bufptr, 1, BIG_BUFFER_SIZE);
|
||||
else
|
||||
#ifdef HAVE_SSL
|
||||
#ifdef HAVE_LIBSSL
|
||||
bytesread = dgets(bufptr, s, 1, BIG_BUFFER_SIZE, sl->ssl_fd);
|
||||
#else
|
||||
bytesread = dgets(bufptr, s, 1, BIG_BUFFER_SIZE, NULL);
|
||||
@@ -915,7 +915,7 @@ SocketList *sl;
|
||||
if (dcc_types[type]->input)
|
||||
bytesread = (*dcc_types[type]->input) (type, s, bufptr, 1, BIG_BUFFER_SIZE);
|
||||
else
|
||||
#ifdef HAVE_SSL
|
||||
#ifdef HAVE_LIBSSL
|
||||
bytesread = dgets(bufptr, s, 1, BIG_BUFFER_SIZE, sl->ssl_fd);
|
||||
#else
|
||||
bytesread = dgets(bufptr, s, 1, BIG_BUFFER_SIZE, NULL);
|
||||
@@ -1017,7 +1017,7 @@ char thing = 0;
|
||||
if (dcc_types[type]->output)
|
||||
(*dcc_types[type]->output) (type, s->is_read, tmp, len);
|
||||
else
|
||||
#ifdef HAVE_SSL
|
||||
#ifdef HAVE_LIBSSL
|
||||
if(s->ssl_fd)
|
||||
SSL_write(s->ssl_fd, tmp, len);
|
||||
else
|
||||
@@ -1669,7 +1669,7 @@ void dcc_chat(char *command, char *args)
|
||||
bot++;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SSL
|
||||
#ifdef HAVE_LIBSSL
|
||||
if(my_strnicmp(args, "-SSL", 4) == 0)
|
||||
{
|
||||
new_next_arg(args, &args);
|
||||
@@ -3024,7 +3024,7 @@ BUILT_IN_COMMAND(chat)
|
||||
if (!my_strnicmp(command, "NOC", 3))
|
||||
no_chat = 1;
|
||||
|
||||
#if HAVE_SSL
|
||||
#if HAVE_LIBSSL
|
||||
if(my_strnicmp(args, "-SSL", 4) == 0)
|
||||
{
|
||||
new_next_arg(args, &args);
|
||||
@@ -3038,7 +3038,7 @@ BUILT_IN_COMMAND(chat)
|
||||
if (no_chat)
|
||||
malloc_sprintf(&tmp, "CLOSE CHAT %s", args);
|
||||
else
|
||||
#ifdef HAVE_SSL
|
||||
#ifdef HAVE_LIBSSL
|
||||
if(flags & DCC_SSL)
|
||||
malloc_sprintf(&tmp, "CHAT -ssl %s", args);
|
||||
else
|
||||
|
||||
10
source/irc.c
10
source/irc.c
@@ -109,7 +109,7 @@ int irc_port = IRC_PORT, /* port of ircd */
|
||||
background = 0,
|
||||
do_check_pid = 0,
|
||||
do_ignore_ajoin = 0,
|
||||
#ifdef HAVE_SSL
|
||||
#ifdef HAVE_LIBSSL
|
||||
do_use_ssl = 0,
|
||||
#endif
|
||||
run_level = 0,
|
||||
@@ -244,7 +244,7 @@ static char *switch_help[] = {
|
||||
" -Z\t\tuse NAT address when doing dcc.\n",
|
||||
" -P\t\ttoggle check pid.nickname for running program.\n",
|
||||
" -v\t\ttells you about the client's version\n",
|
||||
#ifdef HAVE_SSL
|
||||
#ifdef HAVE_LIBSSL
|
||||
" -s\t\tservers specified are SSL.\n",
|
||||
#endif
|
||||
" -i\t\tignores the autojoin list entries.\n",
|
||||
@@ -924,7 +924,7 @@ static char *parse_args (char *argv[], int argc, char **envp)
|
||||
case 'i':
|
||||
do_ignore_ajoin = 1;
|
||||
break;
|
||||
#ifdef HAVE_SSL
|
||||
#ifdef HAVE_LIBSSL
|
||||
case 's':
|
||||
do_use_ssl = 1;
|
||||
break;
|
||||
@@ -953,7 +953,7 @@ static char *parse_args (char *argv[], int argc, char **envp)
|
||||
strlcpy(nickname, argv[ac], sizeof nickname);
|
||||
else
|
||||
build_server_list(argv[ac]);
|
||||
#ifdef HAVE_SSL
|
||||
#ifdef HAVE_LIBSSL
|
||||
do_use_ssl = 0;
|
||||
#endif
|
||||
}
|
||||
@@ -1610,7 +1610,7 @@ int main(int argc, char *argv[], char *envp[])
|
||||
#endif
|
||||
add_tcl_vars();
|
||||
#endif
|
||||
#ifdef HAVE_SSL
|
||||
#ifdef HAVE_LIBSSL
|
||||
{
|
||||
char *entropy = malloc(100);
|
||||
int i;
|
||||
|
||||
@@ -86,7 +86,7 @@ static void init_io (void)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef HAVE_SSL
|
||||
#ifdef HAVE_LIBSSL
|
||||
void SSL_show_errors(void)
|
||||
{
|
||||
char buf[1000];
|
||||
@@ -234,13 +234,13 @@ int BX_dgets (char *str, int des, int buffer, int buffersize, void *ssl_fd)
|
||||
|
||||
else if (nbytes)
|
||||
{
|
||||
#ifdef HAVE_SSL
|
||||
#ifdef HAVE_LIBSSL
|
||||
int rc = 0;
|
||||
#endif
|
||||
|
||||
if (nbytes >= IO_BUFFER_SIZE)
|
||||
nbytes = IO_BUFFER_SIZE-1;
|
||||
#ifdef HAVE_SSL
|
||||
#ifdef HAVE_LIBSSL
|
||||
if(ssl_fd)
|
||||
{
|
||||
c = SSL_read((SSL *)ssl_fd, ioe->buffer + ioe->write_pos,
|
||||
@@ -266,7 +266,7 @@ int BX_dgets (char *str, int des, int buffer, int buffersize, void *ssl_fd)
|
||||
|
||||
if (c <= 0)
|
||||
{
|
||||
#ifdef HAVE_SSL
|
||||
#ifdef HAVE_LIBSSL
|
||||
if(ssl_fd)
|
||||
{
|
||||
say("SSL_read() failed, SSL error %d", rc);
|
||||
|
||||
@@ -150,7 +150,7 @@ void BX_close_server (int cs_index, char *message)
|
||||
cs_index, message ? message : empty_string);
|
||||
snprintf(buffer, MAX_PROTOCOL_SIZE + 1, "QUIT :%s", message);
|
||||
strlcat(buffer, "\r\n", sizeof buffer);
|
||||
#ifdef HAVE_SSL
|
||||
#ifdef HAVE_LIBSSL
|
||||
if (get_server_ssl(cs_index))
|
||||
{
|
||||
SSL_write(server_list[cs_index].ssl_fd, buffer, strlen(buffer));
|
||||
@@ -498,13 +498,13 @@ void do_server (fd_set *rd, fd_set *wr)
|
||||
|
||||
if (getpeername(des, (struct sockaddr *) &sa, &salen) != -1)
|
||||
{
|
||||
#ifdef HAVE_SSL
|
||||
#ifdef HAVE_LIBSSL
|
||||
if(!server_list[i].ctx || server_list[i].ssl_error == SSL_ERROR_WANT_WRITE)
|
||||
{
|
||||
#endif
|
||||
server_list[i].connect_wait = 0;
|
||||
finalize_server_connect(i, server_list[i].c_server, i);
|
||||
#ifdef HAVE_SSL
|
||||
#ifdef HAVE_LIBSSL
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -521,7 +521,7 @@ void do_server (fd_set *rd, fd_set *wr)
|
||||
junk = (*serv_input_func)(i, bufptr, des, 1, BIG_BUFFER_SIZE);
|
||||
else
|
||||
{
|
||||
#ifdef HAVE_SSL
|
||||
#ifdef HAVE_LIBSSL
|
||||
if(get_server_ssl(i))
|
||||
{
|
||||
#ifdef NON_BLOCKING_CONNECTS
|
||||
@@ -798,7 +798,7 @@ extern int default_swatch;
|
||||
server_list[from_server].motd = 1;
|
||||
server_list[from_server].ircop_flags = default_swatch;
|
||||
server_list[from_server].port = port;
|
||||
#ifdef HAVE_SSL
|
||||
#ifdef HAVE_LIBSSL
|
||||
set_server_ssl(from_server, ssl);
|
||||
#endif
|
||||
malloc_strcpy(&server_list[from_server].umodes, umodes);
|
||||
@@ -863,7 +863,7 @@ void remove_from_server_list (int i)
|
||||
new_free(&server_list[i].recv_nick);
|
||||
new_free(&server_list[i].sent_nick);
|
||||
new_free(&server_list[i].sent_body);
|
||||
#ifdef HAVE_SSL
|
||||
#ifdef HAVE_LIBSSL
|
||||
SSL_CTX_free(server_list[i].ctx);
|
||||
#endif
|
||||
clear_server_sping(i, NULL);
|
||||
@@ -984,7 +984,7 @@ int BX_build_server_list (char *servers)
|
||||
|
||||
int port_num;
|
||||
int i = 0;
|
||||
#ifdef HAVE_SSL
|
||||
#ifdef HAVE_LIBSSL
|
||||
extern int do_use_ssl;
|
||||
#else
|
||||
int do_use_ssl = 0;
|
||||
@@ -1336,7 +1336,7 @@ int finalize_server_connect(int refnum, int c_server, int my_from_server)
|
||||
close_server(c_server, "changing servers");
|
||||
}
|
||||
|
||||
#ifdef HAVE_SSL
|
||||
#ifdef HAVE_LIBSSL
|
||||
if(get_server_ssl(refnum))
|
||||
{
|
||||
int err = 0;
|
||||
@@ -1551,7 +1551,7 @@ void try_connect (int server, int old_server)
|
||||
else if (server < 0)
|
||||
server = 0;
|
||||
|
||||
#ifdef HAVE_SSL
|
||||
#ifdef HAVE_LIBSSL
|
||||
server_list[server].ctx = NULL;
|
||||
#endif
|
||||
if(server_list[server].server_change_refnum > -1)
|
||||
@@ -1645,7 +1645,7 @@ BUILT_IN_COMMAND(servercmd)
|
||||
{
|
||||
char *server = NULL;
|
||||
int i, my_from_server = from_server;
|
||||
#ifdef HAVE_SSL
|
||||
#ifdef HAVE_LIBSSL
|
||||
int ssl_connect = 0;
|
||||
#endif
|
||||
|
||||
@@ -1655,7 +1655,7 @@ BUILT_IN_COMMAND(servercmd)
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef HAVE_SSL
|
||||
#ifdef HAVE_LIBSSL
|
||||
if((i = find_in_server_list(server, 0)) != -1)
|
||||
set_server_ssl(i, 0);
|
||||
|
||||
@@ -1738,7 +1738,7 @@ BUILT_IN_COMMAND(servercmd)
|
||||
if (*++server)
|
||||
{
|
||||
i = find_server_refnum(server, &args);
|
||||
#ifdef HAVE_SSL
|
||||
#ifdef HAVE_LIBSSL
|
||||
if(ssl_connect)
|
||||
set_server_ssl(i, 1);
|
||||
#endif
|
||||
@@ -1773,7 +1773,7 @@ BUILT_IN_COMMAND(servercmd)
|
||||
else
|
||||
{
|
||||
i = find_server_refnum(server, &args);
|
||||
#ifdef HAVE_SSL
|
||||
#ifdef HAVE_LIBSSL
|
||||
if(ssl_connect)
|
||||
set_server_ssl(i, 1);
|
||||
#endif
|
||||
@@ -2450,7 +2450,7 @@ int err = 0;
|
||||
err = (*serv_output_func)(server, des, buffer, strlen(buffer));
|
||||
else
|
||||
{
|
||||
#ifdef HAVE_SSL
|
||||
#ifdef HAVE_LIBSSL
|
||||
if(get_server_ssl(server))
|
||||
{
|
||||
if(!server_list[server].ssl_fd)
|
||||
@@ -2467,7 +2467,7 @@ int err = 0;
|
||||
if ((err == -1) && !get_int_var(NO_FAIL_DISCONNECT_VAR))
|
||||
{
|
||||
say("Write to server failed. Closing connection.");
|
||||
#ifdef HAVE_SSL
|
||||
#ifdef HAVE_LIBSSL
|
||||
if(get_server_ssl(server))
|
||||
SSL_shutdown (server_list[server].ssl_fd);
|
||||
#endif
|
||||
@@ -3307,7 +3307,7 @@ void set_server_reconnect(int s, int val)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef HAVE_SSL
|
||||
#ifdef HAVE_LIBSSL
|
||||
void set_server_ssl(int s, int val)
|
||||
{
|
||||
if (s > -1 && s < number_of_servers)
|
||||
|
||||
@@ -3849,13 +3849,13 @@ static Window *window_remove (Window *window, char **args, char *usage)
|
||||
BUILT_IN_WINDOW(window_server)
|
||||
{
|
||||
char *arg;
|
||||
#ifdef HAVE_SSL
|
||||
#ifdef HAVE_LIBSSL
|
||||
int withSSL = 0;
|
||||
#endif
|
||||
|
||||
if ((arg = next_arg(*args, args)))
|
||||
{
|
||||
#ifdef HAVE_SSL
|
||||
#ifdef HAVE_LIBSSL
|
||||
if (!my_strnicmp(arg, "-SSL", strlen(arg)))
|
||||
{
|
||||
withSSL = 1;
|
||||
@@ -3867,7 +3867,7 @@ BUILT_IN_WINDOW(window_server)
|
||||
#endif
|
||||
int i = find_server_refnum(arg, NULL);
|
||||
|
||||
#ifdef HAVE_SSL
|
||||
#ifdef HAVE_LIBSSL
|
||||
if(i != -1)
|
||||
{
|
||||
if(withSSL)
|
||||
@@ -3890,7 +3890,7 @@ BUILT_IN_WINDOW(window_server)
|
||||
#endif
|
||||
}
|
||||
window_check_servers(from_server);
|
||||
#ifdef HAVE_SSL
|
||||
#ifdef HAVE_LIBSSL
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user