Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Added OpenSSL support by vjt@users.sf.net. Also fixes a possible cras…
…h after

using /SERVER ADD -ircnet.


git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2890 dbcabf3a-b0e7-0310-adc4-f8d773084564
  • Loading branch information
Timo Sirainen authored and cras committed Aug 26, 2002
1 parent 13effe8 commit 1539cf8
Show file tree
Hide file tree
Showing 14 changed files with 392 additions and 12 deletions.
3 changes: 3 additions & 0 deletions acconfig.h
Expand Up @@ -36,3 +36,6 @@
#undef HAVE_GETTEXT
#undef HAVE_LC_MESSAGES
#undef HAVE_STPCPY

/* SSL */
#undef HAVE_OPENSSL
73 changes: 66 additions & 7 deletions configure.in
Expand Up @@ -112,7 +112,7 @@ if test "x$prefix" != "xNONE"; then
fi

AC_ARG_WITH(tests,
[ --with-glib2 Use GLIB 2.0 instead of 1.2],
[ --with-glib2 Use GLIB 2.0 instead of 1.2],
if test x$withval = xyes; then
want_glib2=yes
else
Expand All @@ -126,7 +126,7 @@ AC_ARG_WITH(tests,

AC_ARG_WITH(perl-staticlib,
[ --with-perl-staticlib Specify that we want to link perl libraries
statically in irssi, default is no],
statically in irssi, default is no],
if test x$withval = xyes; then
want_staticperllib=yes
else
Expand All @@ -141,7 +141,7 @@ AC_ARG_WITH(perl-staticlib,

AC_ARG_WITH(perl-lib,
[ --with-perl-lib=[site|vendor|DIR] Specify where to install the
Perl libraries for irssi, default is site],
Perl libraries for irssi, default is site],
if test "x$withval" = xyes; then
want_perl=yes
elif test "x$withval" = xno; then
Expand Down Expand Up @@ -170,8 +170,8 @@ AC_ARG_WITH(perl-lib,

AC_ARG_WITH(perl,
[ --with-perl[=yes|no|module] Build with Perl support - also specifies
if it should be built into main irssi binary
(static, default) or as module],
if it should be built into main irssi binary
(static, default) or as module],
if test x$withval = xyes; then
want_perl=static
elif test x$withval = xstatic; then
Expand All @@ -196,6 +196,62 @@ AC_ARG_ENABLE(ipv6,
fi,
want_ipv6=no)

dnl **
dnl ** SSL Library checks (OpenSSL)
dnl **

AC_ARG_ENABLE(ssl,
[ --disable-ssl Turn on Secure Sockets Layer support [default=yes]],,
enable_ssl=yes)

AC_ARG_WITH(openssl-includes,
[ --with-openssl-includes Specify location of OpenSSL header files],
[openssl_inc_prefix=-I$withval])

AC_ARG_WITH(openssl-libs,
[ --with-openssl-libs Specify location of OpenSSL libs],
[openssl_prefix=$withval],
[openssl_prefix=/usr/lib])

if test "x$enable_ssl" = xyes; then
###
### Check for OpenSSL
###
save_CFLAGS=$CFLAGS;
CFLAGS="-lcrypto";

enable_openssl="no";
OPENSSL_LDFLAGS="";
AC_CHECK_LIB(ssl, SSL_read,
AC_CHECK_LIB(crypto, X509_new,
AC_CHECK_HEADERS(openssl/ssl.h openssl/err.h,
[
enable_openssl="yes";
OPENSSL_LDFLAGS="-lssl -lcrypto"
],
AC_ERROR([Cannot find OpenSSL includes !])),
AC_ERROR([Cannot find libCrypto !])),
AC_ERROR([Cannot find libSSL !]))
CFLAGS=$save_CFLAGS

if test "x$enable_openssl" = xyes; then
AC_DEFINE(HAVE_OPENSSL)
OPENSSL_LIBS="-L$openssl_prefix $OPENSSL_LDFLAGS"
OPENSSL_CFLAGS="$openssl_inc_prefix"
else
OPENSSL_LIBS=
OPENSSL_CFLAGS=
fi

AC_SUBST(OPENSSL_CFLAGS)
AC_SUBST(OPENSSL_LIBS)
LIBS="$LIBS $OPENSSL_LIBS"
CFLAGS="$CFLAGS $OPENSSL_CFLAGS"
else
enable_openssl="no"
fi


dnl **
dnl ** just some generic stuff...
dnl **
Expand Down Expand Up @@ -830,7 +886,6 @@ fi
echo "Building text frontend ..... : $text"
echo "Building irssi bot ......... : $want_irssibot"
echo "Building irssi proxy ....... : $want_irssiproxy"
echo "Building with IPv6 support . : $want_ipv6"
if test "x$have_gmodule" = "xyes"; then
echo "Building with module support : yes"
else
Expand Down Expand Up @@ -877,8 +932,12 @@ if test "x$want_perl" != "xno"; then
echo " Anyway, installing perl to this directory should work just as well."
fi
fi

echo "Install prefix ............. : $prefix"

echo

echo "Building with IPv6 support . : $want_ipv6"
echo "Building with SSL support .. : ${enable_openssl}"

echo
echo "If there was any problems, read the INSTALL file."
1 change: 1 addition & 0 deletions src/core/Makefile.am
Expand Up @@ -30,6 +30,7 @@ libcore_a_SOURCES = \
net-nonblock.c \
net-sendbuffer.c \
network.c \
network-openssl.c \
nicklist.c \
nickmatch-cache.c \
pidwait.c \
Expand Down
10 changes: 7 additions & 3 deletions src/core/chat-commands.c
Expand Up @@ -88,12 +88,16 @@ static SERVER_CONNECT_REC *get_server_connect(const char *data, int *plus_addr,
else if (g_hash_table_lookup(optlist, "4") != NULL)
conn->family = AF_INET;

if(g_hash_table_lookup(optlist, "ssl") != NULL)
conn->use_ssl = TRUE;

if (g_hash_table_lookup(optlist, "!") != NULL)
conn->no_autojoin_channels = TRUE;

if (g_hash_table_lookup(optlist, "noproxy") != NULL)
g_free_and_null(conn->proxy);


*rawlog_file = g_strdup(g_hash_table_lookup(optlist, "rawlog"));

host = g_hash_table_lookup(optlist, "host");
Expand All @@ -108,7 +112,7 @@ static SERVER_CONNECT_REC *get_server_connect(const char *data, int *plus_addr,
return conn;
}

/* SYNTAX: CONNECT [-4 | -6] [-ircnet <ircnet>] [-host <hostname>]
/* SYNTAX: CONNECT [-4 | -6] [-ssl] [-ircnet <ircnet>] [-host <hostname>]
<address>|<chatnet> [<port> [<password> [<nick>]]] */
static void cmd_connect(const char *data)
{
Expand Down Expand Up @@ -209,7 +213,7 @@ static void sig_default_command_server(const char *data, SERVER_REC *server,
signal_emit("command server connect", 3, data, server, item);
}

/* SYNTAX: SERVER [-4 | -6] [-ircnet <ircnet>] [-host <hostname>]
/* SYNTAX: SERVER [-4 | -6] [-ssl] [-ircnet <ircnet>] [-host <hostname>]
[+]<address>|<chatnet> [<port> [<password> [<nick>]]] */
static void cmd_server_connect(const char *data, SERVER_REC *server)
{
Expand Down Expand Up @@ -439,7 +443,7 @@ void chat_commands_init(void)

signal_add("default command server", (SIGNAL_FUNC) sig_default_command_server);

command_set_options("connect", "4 6 !! +host noproxy -rawlog");
command_set_options("connect", "4 6 !! ssl +host noproxy -rawlog");
command_set_options("join", "invite");
command_set_options("msg", "channel nick");
}
Expand Down

0 comments on commit 1539cf8

Please sign in to comment.