diff -urN gaim-0.80-orig/config.h.in gaim-0.80/config.h.in --- gaim-0.80-orig/config.h.in 2004-07-16 19:34:01.000000000 +0800 +++ gaim-0.80/config.h.in 2004-07-26 19:49:31.000000000 +0800 @@ -136,6 +136,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_GNUTLS_GNUTLS_H +/* Define if you have OpenSSL */ +#undef HAVE_OPENSSL + /* Define if you have the iconv() function. */ #undef HAVE_ICONV diff -urN gaim-0.80-orig/configure gaim-0.80/configure --- gaim-0.80-orig/configure 2004-07-16 19:34:33.000000000 +0800 +++ gaim-0.80/configure 2004-07-26 19:53:07.000000000 +0800 @@ -464,7 +464,7 @@ # include #endif" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO AMTAR install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot sedpath CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CPP CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL MKINSTALLDIRS USE_NLS MSGFMT GMSGFMT XGETTEXT MSGMERGE ALLOCA GLIBC21 HAVE_POSIX_PRINTF HAVE_ASPRINTF HAVE_SNPRINTF HAVE_WPRINTF LIBICONV LTLIBICONV INTLBISON BUILD_INCLUDED_LIBINTL USE_INCLUDED_LIBINTL CATOBJEXT DATADIRNAME INSTOBJEXT GENCAT INTLOBJS INTL_LIBTOOL_SUFFIX_PREFIX INTLLIBS LIBINTL LTLIBINTL POSUB SILC_INCLUDES LIBOBJS SILC_LIBS DISTRIB_TRUE DISTRIB_FALSE STATIC_PRPLS STATIC_GG_TRUE STATIC_GG_FALSE STATIC_IRC_TRUE STATIC_IRC_FALSE STATIC_JABBER_TRUE STATIC_JABBER_FALSE STATIC_MSN_TRUE STATIC_MSN_FALSE STATIC_NAPSTER_TRUE STATIC_NAPSTER_FALSE STATIC_NOVELL_TRUE STATIC_NOVELL_FALSE STATIC_OSCAR_TRUE STATIC_OSCAR_FALSE STATIC_RENDEZVOUS_TRUE STATIC_RENDEZVOUS_FALSE STATIC_SILC_TRUE STATIC_SILC_FALSE STATIC_TOC_TRUE STATIC_TOC_FALSE STATIC_TREPIA_TRUE STATIC_TREPIA_FALSE STATIC_YAHOO_TRUE STATIC_YAHOO_FALSE STATIC_ZEPHYR_TRUE STATIC_ZEPHYR_FALSE STATIC_LINK_LIBS DYNAMIC_PRPLS DYNAMIC_GG_TRUE DYNAMIC_GG_FALSE DYNAMIC_IRC_TRUE DYNAMIC_IRC_FALSE DYNAMIC_JABBER_TRUE DYNAMIC_JABBER_FALSE DYNAMIC_MSN_TRUE DYNAMIC_MSN_FALSE DYNAMIC_NAPSTER_TRUE DYNAMIC_NAPSTER_FALSE DYNAMIC_NOVELL_TRUE DYNAMIC_NOVELL_FALSE DYNAMIC_OSCAR_TRUE DYNAMIC_OSCAR_FALSE DYNAMIC_RENDEZVOUS_TRUE DYNAMIC_RENDEZVOUS_FALSE DYNAMIC_SILC_TRUE DYNAMIC_SILC_FALSE DYNAMIC_TOC_TRUE DYNAMIC_TOC_FALSE DYNAMIC_TREPIA_TRUE DYNAMIC_TREPIA_FALSE DYNAMIC_YAHOO_TRUE DYNAMIC_YAHOO_FALSE DYNAMIC_ZEPHYR_TRUE DYNAMIC_ZEPHYR_FALSE EXTERNAL_LIBZEPHYR_TRUE EXTERNAL_LIBZEPHYR_FALSE PKG_CONFIG GLIB_CFLAGS GLIB_LIBS GLIB_GENMARSHAL GOBJECT_QUERY GLIB_MKENUMS GTK_CFLAGS GTK_LIBS gaimpath X_CFLAGS X_PRE_LIBS X_LIBS X_EXTRA_LIBS STARTUP_NOTIFICATION_CFLAGS STARTUP_NOTIFICATION_LIBS EVOLUTION_ADDRESSBOOK_CFLAGS EVOLUTION_ADDRESSBOOK_LIBS BUILD_GEVOLUTION_TRUE BUILD_GEVOLUTION_FALSE XSS_LIBS SM_LIBS perlpath PERL USE_PERL_TRUE USE_PERL_FALSE PERL_CFLAGS PERL_LIBS PERL_MM_PARAMS DYNALOADER_A LIBPERL_A GNUTLS_CFLAGS GNUTLS_LIBS USE_GNUTLS_TRUE USE_GNUTLS_FALSE NSS_CFLAGS NSS_LIBS USE_NSS_TRUE USE_NSS_FALSE USE_TCL_TRUE USE_TCL_FALSE TCL_LIBS TCL_CFLAGS USE_TK_TRUE USE_TK_FALSE TK_LIBS GTKSPELL_CFLAGS GTKSPELL_LIBS AO_CFLAGS AO_LIBS AUDIOFILE_CONFIG AUDIOFILE_CFLAGS AUDIOFILE_LIBS SOUND_LIBS DEBUG_CFLAGS LDADD PLUGINS_TRUE PLUGINS_FALSE PRPLS_TRUE PRPLS_FALSE KRB4_CFLAGS KRB4_LDFLAGS KRB4_LIBS ZEPHYR_CFLAGS ZEPHYR_LDFLAGS ZEPHYR_LIBS LTLIBOBJS' +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO AMTAR install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot sedpath CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CPP CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL MKINSTALLDIRS USE_NLS MSGFMT GMSGFMT XGETTEXT MSGMERGE ALLOCA GLIBC21 HAVE_POSIX_PRINTF HAVE_ASPRINTF HAVE_SNPRINTF HAVE_WPRINTF LIBICONV LTLIBICONV INTLBISON BUILD_INCLUDED_LIBINTL USE_INCLUDED_LIBINTL CATOBJEXT DATADIRNAME INSTOBJEXT GENCAT INTLOBJS INTL_LIBTOOL_SUFFIX_PREFIX INTLLIBS LIBINTL LTLIBINTL POSUB SILC_INCLUDES LIBOBJS SILC_LIBS DISTRIB_TRUE DISTRIB_FALSE STATIC_PRPLS STATIC_GG_TRUE STATIC_GG_FALSE STATIC_IRC_TRUE STATIC_IRC_FALSE STATIC_JABBER_TRUE STATIC_JABBER_FALSE STATIC_MSN_TRUE STATIC_MSN_FALSE STATIC_NAPSTER_TRUE STATIC_NAPSTER_FALSE STATIC_NOVELL_TRUE STATIC_NOVELL_FALSE STATIC_OSCAR_TRUE STATIC_OSCAR_FALSE STATIC_RENDEZVOUS_TRUE STATIC_RENDEZVOUS_FALSE STATIC_SILC_TRUE STATIC_SILC_FALSE STATIC_TOC_TRUE STATIC_TOC_FALSE STATIC_TREPIA_TRUE STATIC_TREPIA_FALSE STATIC_YAHOO_TRUE STATIC_YAHOO_FALSE STATIC_ZEPHYR_TRUE STATIC_ZEPHYR_FALSE STATIC_LINK_LIBS DYNAMIC_PRPLS DYNAMIC_GG_TRUE DYNAMIC_GG_FALSE DYNAMIC_IRC_TRUE DYNAMIC_IRC_FALSE DYNAMIC_JABBER_TRUE DYNAMIC_JABBER_FALSE DYNAMIC_MSN_TRUE DYNAMIC_MSN_FALSE DYNAMIC_NAPSTER_TRUE DYNAMIC_NAPSTER_FALSE DYNAMIC_NOVELL_TRUE DYNAMIC_NOVELL_FALSE DYNAMIC_OSCAR_TRUE DYNAMIC_OSCAR_FALSE DYNAMIC_RENDEZVOUS_TRUE DYNAMIC_RENDEZVOUS_FALSE DYNAMIC_SILC_TRUE DYNAMIC_SILC_FALSE DYNAMIC_TOC_TRUE DYNAMIC_TOC_FALSE DYNAMIC_TREPIA_TRUE DYNAMIC_TREPIA_FALSE DYNAMIC_YAHOO_TRUE DYNAMIC_YAHOO_FALSE DYNAMIC_ZEPHYR_TRUE DYNAMIC_ZEPHYR_FALSE EXTERNAL_LIBZEPHYR_TRUE EXTERNAL_LIBZEPHYR_FALSE PKG_CONFIG GLIB_CFLAGS GLIB_LIBS GLIB_GENMARSHAL GOBJECT_QUERY GLIB_MKENUMS GTK_CFLAGS GTK_LIBS gaimpath X_CFLAGS X_PRE_LIBS X_LIBS X_EXTRA_LIBS STARTUP_NOTIFICATION_CFLAGS STARTUP_NOTIFICATION_LIBS EVOLUTION_ADDRESSBOOK_CFLAGS EVOLUTION_ADDRESSBOOK_LIBS BUILD_GEVOLUTION_TRUE BUILD_GEVOLUTION_FALSE XSS_LIBS SM_LIBS perlpath PERL USE_PERL_TRUE USE_PERL_FALSE PERL_CFLAGS PERL_LIBS PERL_MM_PARAMS DYNALOADER_A LIBPERL_A OPENSSL_CFLAGS OPENSSL_LIBS USE_OPENSSL_TRUE USE_OPENSSL_FALSE GNUTLS_CFLAGS GNUTLS_LIBS USE_GNUTLS_TRUE USE_GNUTLS_FALSE NSS_CFLAGS NSS_LIBS USE_NSS_TRUE USE_NSS_FALSE USE_TCL_TRUE USE_TCL_FALSE TCL_LIBS TCL_CFLAGS USE_TK_TRUE USE_TK_FALSE TK_LIBS GTKSPELL_CFLAGS GTKSPELL_LIBS AO_CFLAGS AO_LIBS AUDIOFILE_CONFIG AUDIOFILE_CFLAGS AUDIOFILE_LIBS SOUND_LIBS DEBUG_CFLAGS LDADD PLUGINS_TRUE PLUGINS_FALSE PRPLS_TRUE PRPLS_FALSE KRB4_CFLAGS KRB4_LDFLAGS KRB4_LIBS ZEPHYR_CFLAGS ZEPHYR_LDFLAGS ZEPHYR_LIBS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -1057,6 +1057,7 @@ --disable-sm compile without X session management support --disable-glibtest do not try to compile and run a test GLIB program --disable-gtktest do not try to compile and run a test GTK+ program + --enable-openssl=yes,no Attempt to use OpenSSL for SSL support (preferred) default=yes --disable-startup-notification compile without startup notification support --disable-gevolution compile without the Gaim-Evolution plugin --enable-gnutls=yes,no Attempt to use GNUTLS for SSL support (preferred) default=yes @@ -1090,6 +1091,8 @@ --with-x use the X Window System --with-perl-lib=site|vendor|DIR Specify where to install the Perl libraries for gaim. Default is site. + --with-openssl-includes=PREFIX Location of OpenSSL includes. + --with-openssl-libs=PREFIX Location of OpenSSL libraries. --with-gnutls-includes=PREFIX Location of GNUTLS includes. --with-gnutls-libs=PREFIX Location of GNUTLS libraries. --with-nspr-includes=PREFIX Specify location of Mozilla nspr4 includes. @@ -31852,6 +31855,14 @@ +# Check whether --enable-openssl or --disable-openssl was given. +if test "${enable_openssl+set}" = set; then + enableval="$enable_openssl" + enable_openssl="$enableval" +else + enable_openssl="yes" +fi; + # Check whether --enable-gnutls or --disable-gnutls was given. if test "${enable_gnutls+set}" = set; then enableval="$enable_gnutls" @@ -31870,6 +31881,299 @@ msg_ssl="None" +if test "x$enable_openssl" != "xno"; then + enable_openssl="no" + prefix=`eval echo $prefix` + + +# Check whether --with-openssl-includes or --without-openssl-includes was given. +if test "${with_openssl_includes+set}" = set; then + withval="$with_openssl_includes" + with_openssl_includes="$withval" +else + with_openssl_includes="$prefix/include" +fi; + + have_openssl_includes="no" + + if test "x$with_openssl_includes" != "xno"; then + CPPFLAGS_save="$CPPFLAGS" + + echo "$as_me:$LINENO: checking for OpenSSL includes" >&5 +echo $ECHO_N "checking for OpenSSL includes... $ECHO_C" >&6 + echo "$as_me:$LINENO: result: \"\"" >&5 +echo "${ECHO_T}\"\"" >&6 + + CPPFLAGS="$CPPFLAGS -I$with_openssl_includes" + +for ac_header in openssl/ssl.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; + no:yes ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + openssl_includes="yes" +fi + +done + + CPPFLAGS="$CPPFLAGS_save" + + if test "x$openssl_includes" != "xno" -a \ + "x$openssl_includes" != "x"; then + have_openssl_includes="yes" + + OPENSSL_CFLAGS="-I$with_openssl_includes" + else + OPENSSL_CFLAGS="" + fi + else + echo "$as_me:$LINENO: checking for OpenSSL includes" >&5 +echo $ECHO_N "checking for OpenSSL includes... $ECHO_C" >&6 + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + fi + + +# Check whether --with-openssl-libs or --without-openssl-libs was given. +if test "${with_openssl_libs+set}" = set; then + withval="$with_openssl_libs" + with_openssl_libs="$withval" +fi; + + if test "x$with_openssl_libs" != "xno" -a \ + "x$have_openssl_includes" != "xno"; then + + LDFLAGS_save="$LDFLAGS" + + case $with_openssl_libs in + ""|-L*) ;; + *) with_openssl_libs="-L$with_openssl_libs" ;; + esac + + echo "$as_me:$LINENO: checking for OpenSSL libraries" >&5 +echo $ECHO_N "checking for OpenSSL libraries... $ECHO_C" >&6 +if test "${openssl_libs+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + LDFLAGS="$LDFLAGS $with_openssl_libs -lssl -lcrypto" + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char SSL_library_init (); +int +main () +{ +SSL_library_init (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + openssl_libs="yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +openssl_libs="no" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + LDFLAGS="$LDFLAGS_save" + +fi +echo "$as_me:$LINENO: result: $openssl_libs" >&5 +echo "${ECHO_T}$openssl_libs" >&6 + + if test "x$openssl_libs" != "xno"; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_OPENSSL 1 +_ACEOF + + cat >>confdefs.h <<\_ACEOF +#define HAVE_SSL 1 +_ACEOF + + msg_openssl="OpenSSL" + OPENSSL_LIBS="$with_openssl_libs -lssl -lcrypto" + + enable_openssl="yes" + else + OPENSSL_CFLAGS="" + OPENSSL_LIBS="" + fi + else + echo "$as_me:$LINENO: checking for OpenSSL libraries" >&5 +echo $ECHO_N "checking for OpenSSL libraries... $ECHO_C" >&6 + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + fi +else + OPENSSL_CFLAGS="" + OPENSSL_LIBS="" +fi + +if test "x$enable_openssl" = "xyes"; then + USE_OPENSSL_TRUE= + USE_OPENSSL_FALSE='#' +else + USE_OPENSSL_TRUE='#' + USE_OPENSSL_FALSE= +fi + if test "x$enable_gnutls" != "xno"; then enable_gnutls="no" prefix=`eval echo $prefix` @@ -33049,12 +33353,20 @@ fi -if test "x$msg_nss" != "x" -a "x$msg_gnutls" != "x"; then +if test "x$msg_nss" != "x" -a "x$msg_gnutls" != "x" -a "x$msg_openssl" != "x"; then + msg_ssl="$msg_nss, $msg_gnutls, and $msg_openssl" +elif test "x$msg_nss" != "x" -a "x$msg_gnutls" != "x"; then msg_ssl="$msg_nss and $msg_gnutls" +elif test "x$msg_nss" != "x" -a "x$msg_openssl" != "x"; then + msg_ssl="$msg_nss and $msg_openssl" +elif test "x$msg_gnutls" != "x" -a "x$msg_openssl" != "x"; then + msg_ssl="$msg_gnutls and $msg_openssl" elif test "x$msg_nss" != "x"; then msg_ssl=$msg_nss elif test "x$msg_gnutls" != "x"; then msg_ssl=$msg_gnutls +elif test "x$msg_openssl" != "x"; then + msg_ssl=$msg_openssl fi if test "$enable_tcl" = yes; then @@ -36820,6 +37132,13 @@ Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi +if test -z "${USE_OPENSSL_TRUE}" && test -z "${USE_OPENSSL_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"USE_OPENSSL\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"USE_OPENSSL\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi if test -z "${USE_GNUTLS_TRUE}" && test -z "${USE_GNUTLS_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"USE_GNUTLS\" was never defined. Usually this means the macro was only invoked conditionally." >&5 @@ -37669,6 +37988,10 @@ s,@PERL_MM_PARAMS@,$PERL_MM_PARAMS,;t t s,@DYNALOADER_A@,$DYNALOADER_A,;t t s,@LIBPERL_A@,$LIBPERL_A,;t t +s,@OPENSSL_CFLAGS@,$OPENSSL_CFLAGS,;t t +s,@OPENSSL_LIBS@,$OPENSSL_LIBS,;t t +s,@USE_OPENSSL_TRUE@,$USE_OPENSSL_TRUE,;t t +s,@USE_OPENSSL_FALSE@,$USE_OPENSSL_FALSE,;t t s,@GNUTLS_CFLAGS@,$GNUTLS_CFLAGS,;t t s,@GNUTLS_LIBS@,$GNUTLS_LIBS,;t t s,@USE_GNUTLS_TRUE@,$USE_GNUTLS_TRUE,;t t diff -urN gaim-0.80-orig/gaim.spec gaim-0.80/gaim.spec --- gaim-0.80-orig/gaim.spec 2004-07-16 19:35:47.000000000 +0800 +++ gaim-0.80/gaim.spec 1970-01-01 08:00:00.000000000 +0800 @@ -1,181 +0,0 @@ -Summary: A Gtk+ based multiprotocol instant messaging client -Name: gaim -Version: 0.80 -Release: 0 -Epoch: 1 -License: GPL -Group: Applications/Internet -URL: http://gaim.sourceforge.net/ -Packager: %{packager} -Source: %{name}-%{version}.tar.gz -BuildRoot: %{_tmppath}/%{name}-%{version}-root - -%if "%{_vendor}" == "MandrakeSoft" -Requires: gtk+2.0 >= 2.0.0, libnss3 -BuildRequires: libao-devel, libgtk+2.0_0-devel, libtool, audiofile-devel, pkgconfig, libnss3-devel, perl-devel -Provides: libgaim-remote0 -%else -Requires: gtk2 >= 2.0.0, mozilla-nss, audiofile, libao -BuildRequires: libao-devel, gtk2-devel, libtool, audiofile-devel, pkgconfig, mozilla-nss-devel -%endif -%{?_with_silc:BuildRequires: libsilc-devel} -%{?_with_tcl:BuildRequires: tcl, tk} - -%if %{?_with_silc:1}%{!?_with_silc:0} -%package silc -Summary: SILC (Secure Internet Live Conferencing) plugin for Gaim -Group: Applications/Internet -Requires: gaim = %{epoch}:%{version} -%endif - -%if %{?_with_tcl:1}%{!?_with_tcl:0} -%package tcl -Summary: Tcl scripting support for Gaim -Group: Applications/Internet -Requires: gaim = %{epoch}:%{version} -%endif - -%package devel -Summary: Development headers, documentation, and libraries for Gaim. -Group: Applications/Internet -Requires: gaim = %{epoch}:%{version} - -%description -Gaim allows you to talk to anyone using a variety of messaging -protocols, including AIM (Oscar and TOC), ICQ, IRC, Yahoo!, -MSN Messenger, Jabber, Gadu-Gadu, Napster, and Zephyr. These -protocols are implemented using a modular, easy to use design. -To use a protocol, just add an account using the account editor. - -Gaim supports many common features of other clients, as well as many -unique features, such as perl scripting, TCL scripting and C plugins. - -Gaim is NOT affiliated with or endorsed by America Online, Inc., -Microsoft Corporation, Yahoo! Inc., or ICQ Inc. - -%if %{?_with_silc:1}%{!?_with_silc:0} -%description silc -SILC (Secure Internet Live Conferencing) plugin for Gaim -%endif - -%if %{?_with_tcl:1}%{!?_with_tcl:0} -%description tcl -Tcl plugin loader for Gaim. This package will allow you to write or -use Gaim plugins written in the Tcl programming language. -%endif - -%description devel -The gaim-devel package contains the header files, developer -documentation, and libraries required for development of gaim scripts -and plugins. - -%prep -%setup - -%build -CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=%{_prefix} \ - --bindir=%{_bindir} \ - --datadir=%{_datadir} \ - --includedir=%{_includedir} \ - --libdir=%{_libdir} \ - --mandir=%{_mandir} \ - --sysconfdir=%{_sysconfdir} \ - --with-perl-lib=%{buildroot}%{_prefix} \ - %{?_with_silc:--with-silc-includes=%{_includedir}/silc} \ - %{?_with_silc:--with-silc-libs=%{_libdir}/silc} \ - %{!?_with_tcl:--disable-tcl} - -make %{?_smp_mflags} - -%install -rm -rf %{buildroot} -make prefix=%{buildroot}%{_prefix} bindir=%{buildroot}%{_bindir} \ - datadir=%{buildroot}%{_datadir} includedir=%{buildroot}%{_includedir} \ - libdir=%{buildroot}%{_libdir} mandir=%{buildroot}%{_mandir} \ - sysconfdir=%{buildroot}%{_sysconfdir} \ - install - -rm -f $RPM_BUILD_ROOT%{_libdir}/perl5/*/*/perllocal.pod -rm -f $RPM_BUILD_ROOT%{_libdir}/gaim/*.la -find $RPM_BUILD_ROOT%{_libdir}/gaim -type f -print | \ - sed "s@^$RPM_BUILD_ROOT@@g" | \ - grep -v libsilcgaim.so | - grep -v tcl.so | - grep -v ".tcl$" > %{name}-%{version}-coreplugins - -%clean -rm -rf %{buildroot} - -%files -f %{name}-%{version}-coreplugins -%defattr(-, root, root) - -%doc doc/the_penguin.txt doc/CREDITS NEWS COPYING AUTHORS COPYRIGHT -%doc README ChangeLog -%doc %{_mandir}/man1/* -%doc %{_mandir}/man3*/* - -%dir %{_libdir}/gaim -%attr(755, root, root) %{_libdir}/libgaim-remote.so.* -%attr(755, root, root) %{_libdir}/perl5 - -%{_bindir}/* -%{_datadir}/locale/*/*/* -%{_datadir}/pixmaps/* -%dir %{_datadir}/sounds/gaim -%{_datadir}/sounds/gaim/* -%{_datadir}/applications/* - -%if %{?_with_silc:1}%{!?_with_silc:0} -%files silc -%defattr(-, root, root) - -%{_libdir}/gaim/libsilcgaim.* -%endif - -%if %{?_with_tcl:1}%{!?_with_silc:0} -%files tcl -%defattr(-, root, root) - -%{_libdir}/gaim/tcl.so -%endif - -%files devel -%defattr(-, root, root) - -%doc plugins/HOWTO -%doc HACKING PROGRAMMING_NOTES - -%attr(755, root, root) %{_libdir}/libgaim-remote.so -%attr(755, root, root) %{_libdir}/libgaim-remote.la -%dir %{_includedir}/gaim -%{_includedir}/gaim/*.h -%{_libdir}/pkgconfig/gaim.pc - -%changelog -* Tue Jun 29 2004 Ethan Blanton -- Change Tcl to use --with tcl, the same as SILC, and build a gaim-tcl - package if specified. - -* Thu Jun 24 2004 Mark Doliner -- Add --with silc rebuild option for compiling a separate gaim-silc - RPM containing the silc protocol plugin (Stu Tomlinson). - -* Wed Jun 23 2004 Ethan Blanton -- Moved gaim headers and a pkgconfig configuration file into the - gaim-devel RPM (Stu Tomlinson). - -* Thu Jan 15 2004 Ethan Blanton -- Removed the manual strip command, as it seems to be unwarranted if - the necessary programs are properly installed. (For me, this was - elfutils.) - -* Sun Jul 20 2003 Bjoern Voigt -- Added pkgconfig build dependency. -- if "%{_vendor}" != "MandrakeSoft" now also works with rpm 3.x. -- Added Gaim-specific directories to list of Gaim's files. - -* Wed Jul 16 2003 Ethan Blanton -- Complete spec file rewrite to take advantage of "new" RPM features - and make things prettier. -- Use system-supplied %%{_prefix}, %%{_datadir}, etc. rather than - attempt to define our own. diff -urN gaim-0.80-orig/plugins/ssl/Makefile.am gaim-0.80/plugins/ssl/Makefile.am --- gaim-0.80-orig/plugins/ssl/Makefile.am 2003-10-15 13:56:07.000000000 +0800 +++ gaim-0.80/plugins/ssl/Makefile.am 2004-07-26 19:49:31.000000000 +0800 @@ -4,6 +4,7 @@ plugindir = $(libdir)/gaim ssl_la_LDFLAGS = -module -avoid-version +ssl_openssl_la_LDFLAGS = -module -avoid-version ssl_gnutls_la_LDFLAGS = -module -avoid-version ssl_nss_la_LDFLAGS = -module -avoid-version @@ -11,13 +12,16 @@ plugin_LTLIBRARIES = \ ssl.la \ + ssl-openssl.la \ ssl-gnutls.la \ ssl-nss.la ssl_la_SOURCES = ssl.c +ssl_openssl_la_SOURCES = ssl-openssl.c ssl_gnutls_la_SOURCES = ssl-gnutls.c ssl_nss_la_SOURCES = ssl-nss.c +ssl_openssl_la_LIBADD = $(OPENSSL_LIBS) ssl_gnutls_la_LIBADD = $(GNUTLS_LIBS) ssl_nss_la_LIBADD = $(NSS_LIBS) @@ -31,4 +35,5 @@ $(GTK_CFLAGS) \ $(PLUGIN_CFLAGS) \ $(NSS_CFLAGS) \ + $(OPENSSL_CFLAGS) \ $(GNUTLS_CFLAGS) diff -urN gaim-0.80-orig/plugins/ssl/Makefile.in gaim-0.80/plugins/ssl/Makefile.in --- gaim-0.80-orig/plugins/ssl/Makefile.in 2004-07-16 19:34:39.000000000 +0800 +++ gaim-0.80/plugins/ssl/Makefile.in 2004-07-26 20:20:46.000000000 +0800 @@ -65,11 +65,15 @@ am__ssl_la_SOURCES_DIST = ssl.c @PLUGINS_TRUE@am_ssl_la_OBJECTS = ssl.lo ssl_la_OBJECTS = $(am_ssl_la_OBJECTS) +@PLUGINS_TRUE@ssl_openssl_la_DEPENDENCIES = $(am__DEPENDENCIES_1) +am__ssl_openssl_la_SOURCES_DIST = ssl-openssl.c +@PLUGINS_TRUE@am_ssl_openssl_la_OBJECTS = ssl-openssl.lo +ssl_openssl_la_OBJECTS = $(am_ssl_openssl_la_OBJECTS) DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles @AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/ssl-gnutls.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/ssl-nss.Plo ./$(DEPDIR)/ssl.Plo +@AMDEP_TRUE@ ./$(DEPDIR)/ssl-nss.Plo ./$(DEPDIR)/ssl.Plo ./$(DEPDIR)/ssl-openssl.Plo COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \ @@ -79,9 +83,9 @@ LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(ssl_gnutls_la_SOURCES) $(ssl_nss_la_SOURCES) \ - $(ssl_la_SOURCES) + $(ssl_la_SOURCES) $(ssl_openssl_la_SOURCES) DIST_SOURCES = $(am__ssl_gnutls_la_SOURCES_DIST) \ - $(am__ssl_nss_la_SOURCES_DIST) $(am__ssl_la_SOURCES_DIST) + $(am__ssl_nss_la_SOURCES_DIST) $(am__ssl_la_SOURCES_DIST) $(am__ssl_openssl_la_SOURCES_DIST) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) @@ -209,6 +213,8 @@ NSS_CFLAGS = @NSS_CFLAGS@ NSS_LIBS = @NSS_LIBS@ OBJEXT = @OBJEXT@ +OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ +OPENSSL_LIBS = @OPENSSL_LIBS@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ @@ -342,16 +348,20 @@ plugindir = $(libdir)/gaim ssl_la_LDFLAGS = -module -avoid-version +ssl_openssl_la_LDFLAGS = -module -avoid-version ssl_gnutls_la_LDFLAGS = -module -avoid-version ssl_nss_la_LDFLAGS = -module -avoid-version @PLUGINS_TRUE@plugin_LTLIBRARIES = \ @PLUGINS_TRUE@ ssl.la \ +@PLUGINS_TRUE@ ssl-openssl.la \ @PLUGINS_TRUE@ ssl-gnutls.la \ @PLUGINS_TRUE@ ssl-nss.la @PLUGINS_TRUE@ssl_la_SOURCES = ssl.c +@PLUGINS_TRUE@ssl_openssl_la_SOURCES = ssl-openssl.c @PLUGINS_TRUE@ssl_gnutls_la_SOURCES = ssl-gnutls.c @PLUGINS_TRUE@ssl_nss_la_SOURCES = ssl-nss.c +@PLUGINS_TRUE@ssl_openssl_la_LIBADD = $(OPENSSL_LIBS) @PLUGINS_TRUE@ssl_gnutls_la_LIBADD = $(GNUTLS_LIBS) @PLUGINS_TRUE@ssl_nss_la_LIBADD = $(NSS_LIBS) AM_CPPFLAGS = \ @@ -361,6 +371,7 @@ $(DEBUG_CFLAGS) \ $(GTK_CFLAGS) \ $(PLUGIN_CFLAGS) \ + $(OPENSSL_CFLAGS) \ $(NSS_CFLAGS) \ $(GNUTLS_CFLAGS) @@ -424,6 +435,8 @@ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done +ssl-openssl.la: $(ssl_openssl_la_OBJECTS) $(ssl_openssl_la_DEPENDENCIES) + $(LINK) -rpath $(plugindir) $(ssl_openssl_la_LDFLAGS) $(ssl_openssl_la_OBJECTS) $(ssl_openssl_la_LIBADD) $(LIBS) ssl-gnutls.la: $(ssl_gnutls_la_OBJECTS) $(ssl_gnutls_la_DEPENDENCIES) $(LINK) -rpath $(plugindir) $(ssl_gnutls_la_LDFLAGS) $(ssl_gnutls_la_OBJECTS) $(ssl_gnutls_la_LIBADD) $(LIBS) ssl-nss.la: $(ssl_nss_la_OBJECTS) $(ssl_nss_la_DEPENDENCIES) @@ -437,6 +450,7 @@ distclean-compile: -rm -f *.tab.c +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ssl-openssl.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ssl-gnutls.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ssl-nss.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ssl.Plo@am__quote@ diff -urN gaim-0.80-orig/plugins/ssl/ssl-openssl.c gaim-0.80/plugins/ssl/ssl-openssl.c --- gaim-0.80-orig/plugins/ssl/ssl-openssl.c 1970-01-01 08:00:00.000000000 +0800 +++ gaim-0.80/plugins/ssl/ssl-openssl.c 2004-07-26 21:04:28.000000000 +0800 @@ -0,0 +1,310 @@ +/* + * OpenSSL SSL-plugin for gaim + * + * Copyright (C) 2003 Matthew Luckie + * Copyright (c) 2004 Jim Huang + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This plugin is released under the GPL with the additional exemption + * that compiling, linking, and/or using OpenSSL is allowed. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * ********************* + * + * This code was written to link in with the gaim ssl plugin system. + * It was written using the ssl-nss.c and ssl-gnutls.c files as documentation + * as to how to use the gaim ssl plugin mechanism. That code was written by + * ChipX86. + * + * This code is not supported by the gaim team. If you have SSL-related + * problems with any service, disable this plugin and use one of the ssl + * plugins that ships with gaim before contacting them for support. + * + * The OpenSSL webpage at http://www.openssl.org/support/faq.html#LEGAL2 + * says that you may use this code on systems that normally include OpenSSL. + * It is my judgement that FreeBSD, NetBSD, and OpenBSD fit into this + * category, but I am not a lawyer. + */ + +#include "internal.h" +#include "debug.h" +#include "plugin.h" +#include "sslconn.h" + +#define SSL_OPENSSL_PLUGIN_ID "ssl-openssl" + +#ifdef HAVE_OPENSSL + +#include +#include + +typedef struct +{ + SSL *ssl; + SSL_CTX *ssl_ctx; +} GaimSslOpensslData; + +#define GAIM_SSL_OPENSSL_DATA(gsc) ((GaimSslOpensslData *)gsc->private_data) + +/* + * ssl_openssl_init + * + * load the error strings we might want to use eventually, and init the + * openssl library + */ +static gboolean ssl_openssl_init(void) +{ + /* + * load the error number to string strings so that we can make sense + * of ssl issues while debugging this code + */ + SSL_load_error_strings(); + + /* + * we need to initialise the openssl library + * we do not seed the random number generator, although we probably + * should in gaim-win32. + */ + SSL_library_init(); + + return TRUE; +} + +/* + * ssl_openssl_uninit + * + * couldn't find anything to match the call to SSL_library_init in the man + * pages, i wonder if there actually is anything we need to call + */ +static void ssl_openssl_uninit(void) +{ + ERR_free_strings(); + return; +} + +/* + * ssl_openssl_connect_cb + * + * given a socket, put an openssl connection around it. + */ +static void ssl_openssl_connect_cb(gpointer data, gint source, GaimInputCondition cond) +{ + GaimSslConnection *gsc = (GaimSslConnection *)data; + GaimSslOpensslData *openssl_data; + + /* + * we need a valid file descriptor to associate the SSL connection with. + */ + if(source < 0) + { + return; + } + + gsc->fd = source; + + /* + * allocate some memory to store variables for the openssl connection. + * the memory comes zero'd from g_new0 so we don't need to null the + * pointers held in this struct. + */ + openssl_data = g_new0(GaimSslOpensslData, 1); + gsc->private_data = openssl_data; + + /* + * allocate a new SSL_CTX object + */ + openssl_data->ssl_ctx = SSL_CTX_new(SSLv23_client_method()); + if(openssl_data->ssl_ctx == NULL) + { + gaim_debug_error("openssl", "SSL_CTX_new failed\n"); + if(gsc->error_cb != NULL) + { + gsc->error_cb(gsc, GAIM_SSL_HANDSHAKE_FAILED, gsc->connect_cb_data); + } + + gaim_ssl_close(gsc); + return; + } + + /* + * allocate a new SSL object + */ + openssl_data->ssl = SSL_new(openssl_data->ssl_ctx); + if(openssl_data->ssl == NULL) + { + gaim_debug_error("openssl", "SSL_new failed\n"); + if(gsc->error_cb != NULL) + { + gsc->error_cb(gsc, GAIM_SSL_HANDSHAKE_FAILED, gsc->connect_cb_data); + } + + gaim_ssl_close(gsc); + return; + } + + /* + * now we associate the file descriptor we have with the SSL connection + */ + if(SSL_set_fd(openssl_data->ssl, source) == 0) + { + gaim_debug_error("openssl", "SSL_set_fd failed\n"); + if(gsc->error_cb != NULL) + { + gsc->error_cb(gsc, GAIM_SSL_HANDSHAKE_FAILED, gsc->connect_cb_data); + } + + gaim_ssl_close(gsc); + return; + } + + /* + * finally, do the negotiation that sets up the SSL connection between + * here and there. + */ + if(SSL_connect(openssl_data->ssl) <= 0) + { + gaim_debug_error("openssl", "SSL_connect failed\n"); + if(gsc->error_cb != NULL) + { + gsc->error_cb(gsc, GAIM_SSL_HANDSHAKE_FAILED, gsc->connect_cb_data); + } + + gaim_ssl_close(gsc); + return; + } + + /* SSL connected now */ + gsc->connect_cb(gsc->connect_cb_data, gsc, cond); + return; +} + +static void ssl_openssl_close(GaimSslConnection *gsc) +{ + GaimSslOpensslData *openssl_data = GAIM_SSL_OPENSSL_DATA(gsc); + int i; + + if(openssl_data == NULL) + { + return; + } + + if(openssl_data->ssl != NULL) + { + i = SSL_shutdown(openssl_data->ssl); + if(i == 0) SSL_shutdown(openssl_data->ssl); + SSL_free(openssl_data->ssl); + } + + if(openssl_data->ssl_ctx != NULL) + { + SSL_CTX_free(openssl_data->ssl_ctx); + } + + g_free(openssl_data); + + return; +} + +static size_t ssl_openssl_read(GaimSslConnection *gsc, void *data, size_t len) +{ + GaimSslOpensslData *openssl_data = GAIM_SSL_OPENSSL_DATA(gsc); + int i; + + i = SSL_read(openssl_data->ssl, data, len); + if(i < 0) i = 0; + + return i; +} + +static size_t ssl_openssl_write(GaimSslConnection *gsc, const void *data, size_t len) +{ + GaimSslOpensslData *openssl_data = GAIM_SSL_OPENSSL_DATA(gsc); + int s = 0; + + if(openssl_data != NULL) + { + s = SSL_write(openssl_data->ssl, data, len); + } + + if(s < 0) + { + s = 0; + } + + return s; +} + +static GaimSslOps ssl_ops = +{ + ssl_openssl_init, + ssl_openssl_uninit, + ssl_openssl_connect_cb, + ssl_openssl_close, + ssl_openssl_read, + ssl_openssl_write +}; + +#endif /* HAVE_OPENSSL */ + +static gboolean plugin_load(GaimPlugin *plugin) +{ +#ifdef HAVE_OPENSSL + gaim_ssl_set_ops(&ssl_ops); + return TRUE; +#else + return FALSE; +#endif +} + +static gboolean plugin_unload(GaimPlugin *plugin) +{ +#ifdef HAVE_OPENSSL + gaim_ssl_set_ops(NULL); +#endif + + return TRUE; +} + +static GaimPluginInfo info = +{ + GAIM_PLUGIN_API_VERSION, /* api_version */ + GAIM_PLUGIN_STANDARD, /* type */ + NULL, /* ui_requirement */ + GAIM_PLUGIN_FLAG_INVISIBLE, /* flags */ + NULL, /* dependencies */ + GAIM_PRIORITY_DEFAULT, /* priority */ + + SSL_OPENSSL_PLUGIN_ID, /* id */ + N_("OpenSSL"), /* name */ + VERSION, /* version */ + + N_("Provides SSL support through OpenSSL."), /* description */ + N_("Provides SSL support through OpenSSL."), + "Matthew Luckie ", + GAIM_WEBSITE, /* homepage */ + + plugin_load, /* load */ + plugin_unload, /* unload */ + NULL, /* destroy */ + + NULL, /* ui_info */ + NULL /* extra_info */ +}; + +static void init_plugin(GaimPlugin *plugin) +{ +} + +GAIM_INIT_PLUGIN(ssl_openssl, init_plugin, info)