Commit 47bb2c52 authored by Thomas Roessler's avatar Thomas Roessler

Adding support for Netscape's (pardon, Mozilla's) SSL

implementation.  From Michael Elkins.
parent bc3d0e28
......@@ -69,11 +69,12 @@ non_us_sources = pgp.c pgpinvoke.c pgpkey.c pgplib.c sha1.c \
doc/language.txt doc/language50.txt OPS.PGP doc/PGP-Notes.txt \
OPS.MIX remailer.c remailer.h pgpewrap \
contrib/pgp2.rc contrib/pgp5.rc contrib/gpg.rc \
mutt_ssl.c mutt_ssl.h README.SSL
mutt_ssl.c mutt_ssl.h README.SSL mutt_ssl_nss.c
EXTRA_mutt_SOURCES = account.c md5c.c mutt_sasl.c mutt_socket.c mutt_ssl.c \
pop.c pgp.c pgpinvoke.c pgpkey.c pgplib.c sha1.c gnupgparse.c \
resize.c dotlock.c remailer.c browser.h mbyte.h remailer.h url.h
resize.c dotlock.c remailer.c browser.h mbyte.h remailer.h url.h \
mutt_ssl_nss.c
EXTRA_DIST = COPYRIGHT GPL OPS OPS.PGP TODO configure acconfig.h account.h \
attach.h buffy.h charset.h copy.h dotlock.h functions.h gen_defs \
......
......@@ -59,6 +59,9 @@
/* Do you want support for SSL? (--with-ssl) */
#undef USE_SSL
/* Do you want support for SSL via the NSS library? (--with-nss) */
#undef USE_NSS
/* Avoid SSL routines which used patent-encumbered RC5 algorithms */
#undef NO_RC5
......
......@@ -554,8 +554,8 @@ dnl -- end socket dependencies --
if test "$need_socket" = "yes"
then
AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
AC_CHECK_FUNC(gethostent, , AC_CHECK_LIB(nsl, gethostent))
AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
AC_CHECK_FUNCS(getaddrinfo)
AC_DEFINE(USE_SOCKET)
MUTT_LIB_OBJECTS="$MUTT_LIB_OBJECTS account.o mutt_socket.o"
......@@ -659,6 +659,30 @@ AC_ARG_WITH(ssl, [ --with-ssl[=PFX] Compile in SSL socket support for
])
AM_CONDITIONAL(USE_SSL, test x$need_ssl = xyes)
dnl SSL support via NSS
AC_ARG_WITH(nss, [ --with-nss[=PFX] Compile in SSL socket support for POP/IMAP via NSS],
[ if test "$with_nss" != no
then
if test "$need_socket" != "yes"; then
AC_MSG_ERROR([SSL support is only useful with POP or IMAP support])
fi
if test "$with_nss" != "yes"
then
LDFLAGS="$LDFLAGS -L$withval/lib"
CPPFLAGS="$CPPFLAGS -I$withval/include -I$withval/public/security"
fi
AC_DEFINE(USE_NSS)
MUTTLIBS="$MUTTLIBS -lssl -lnss -lcertdb -lcerthi -lcryptohi"
MUTTLIBS="$MUTTLIBS -lpk11wrap -lsoftoken -lsecutil -ldbm -lplds4 -lplc4 -lfreebl"
MUTTLIBS="$MUTTLIBS -lnspr4"
MUTT_LIB_OBJECTS="$MUTT_LIB_OBJECTS mutt_ssl_nss.o"
need_ssl=yes
fi
])
dnl -- end imap dependencies --
AC_ARG_WITH(sasl, [ --with-sasl[=DIR] Use Cyrus SASL library for POP/IMAP authentication],
......
......@@ -31,7 +31,7 @@
#endif
#ifdef USE_SSL
#if defined(USE_SSL) || defined(USE_NSS)
#include "mutt_ssl.h"
#endif
......
......@@ -1326,7 +1326,7 @@ struct option_t MuttVars[] = {
*/
#endif /* HAVE_PGP */
#ifdef USE_SSL
#if defined(USE_SSL)||defined(USE_NSS)
{ "certificate_file", DT_PATH, R_NONE, UL &SslCertFile, 0 },
/*
** .pp
......@@ -1412,10 +1412,14 @@ struct option_t MuttVars[] = {
** .pp
** The name or address of your POP3 server.
*/
{ "pop_port", DT_NUM, R_NONE, UL &PopPort, 110 },
{ "pop_port", DT_NUM, R_NONE, UL &PopPort, -1 },
/*
** .pp
** This variable specifies which port your POP server is listening on.
** If you specify a value less than zero, Mutt will auto-select the port
** based upon whether your are doing normal pop3 (110) or pop3s (995).
** If your POP3 server listens on a non-standard port, you will have to
** set this to the correct value for your environment.
*/
{ "pop_last", DT_BOOL, R_NONE, OPTPOPLAST, 0 },
/*
......
......@@ -318,7 +318,7 @@ enum
OPTIMAPFORCESSL,
# endif
#endif
#ifdef USE_SSL
#if defined(USE_SSL) || defined(USE_NSS)
OPTSSLV2,
OPTSSLV3,
OPTTLSV1,
......
......@@ -195,6 +195,8 @@ CONNECTION* mutt_conn_find (const CONNECTION* start, const ACCOUNT* account)
{
#ifdef USE_SSL
ssl_socket_setup (conn);
#elif USE_NSS
mutt_nss_socket_setup (conn);
#else
mutt_error _("SSL is unavailable.");
sleep (2);
......
This diff is collapsed.
......@@ -120,7 +120,7 @@ int pop_authenticate (CONNECTION *conn)
void mutt_fetchPopMail (void)
{
char buffer[LONG_STRING];
char msgbuf[SHORT_STRING];
char msgbuf[SHORT_STRING], *p;
int i, delanswer, last = 0, msgs, bytes, err = 0;
CONTEXT ctx;
MESSAGE *msg = NULL;
......@@ -133,10 +133,30 @@ void mutt_fetchPopMail (void)
return;
}
/* if the host is specified as `my.com/ssl', use ssl to connect to the
* given port. this is kinda silly (looks like nobody was using this
* as of 9-29-2000), but it's easier to test pop+ssl than imap+ssl for
* the new NSS support. -me
*/
account.flags = 0;
strfcpy (account.host, PopHost, sizeof (account.host));
account.port = PopPort;
p = strchr(account.host, '/');
if (p) {
if (!strcmp (p+1, "ssl")) {
*p = 0;
account.flags |= M_ACCT_SSL;
}
}
account.type = M_ACCT_TYPE_POP;
account.flags = 0;
if (PopPort < 0) {
/* auto-select the port based upon what we are attempting to do */
if (account.flags & M_ACCT_SSL)
account.port = 995; /* pop3s (pop3 + ssl) */
else
account.port = 110; /* pop3 */
}
else
account.port = PopPort;
conn = mutt_conn_find (NULL, &account);
if (mutt_socket_open (conn) < 0)
return;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment