diff options
-rwxr-xr-x | configure | 6 | ||||
-rw-r--r-- | protocols/nogaim.h | 2 | ||||
-rw-r--r-- | protocols/ssl_sspi.c | 45 | ||||
-rw-r--r-- | util.c | 7 |
4 files changed, 40 insertions, 20 deletions
@@ -162,24 +162,28 @@ if [ -z "$PKG_CONFIG" ]; then PKG_CONFIG=pkg-config fi +GLIB=0 + if $PKG_CONFIG --version > /dev/null 2>/dev/null && $PKG_CONFIG glib-2.0; then cat<<EOF>>Makefile.settings EFLAGS+=`$PKG_CONFIG --libs glib-2.0 gmodule-2.0` CFLAGS+=`$PKG_CONFIG --cflags glib-2.0 gmodule-2.0` EOF echo '#define GLIB2' >> config.h + GLIB=2 elif type glib-config > /dev/null 2> /dev/null; then cat<<EOF>>Makefile.settings EFLAGS+=`glib-config --libs` CFLAGS+=`glib-config --cflags` EOF echo '#define GLIB1' >> config.h + GLIB=1 else echo 'Cannot find glib development libraries, aborting. (Install libglib-dev?)' exit 1; fi -if [ -r /usr/include/iconv.h ]; then +if [ GLIB = 1 -o -r /usr/include/iconv.h ]; then :; elif [ -r /usr/local/include/iconv.h ]; then echo CFLAGS+=-I/usr/local/include >> Makefile.settings; diff --git a/protocols/nogaim.h b/protocols/nogaim.h index 3721361c..e109beb8 100644 --- a/protocols/nogaim.h +++ b/protocols/nogaim.h @@ -51,7 +51,7 @@ #define SELF_ALIAS_LEN 400 #define BUDDY_ALIAS_MAXLEN 388 /* because MSN names can be 387 characters */ -#define WEBSITE "http://www.bitlee.org/" +#define WEBSITE "http://www.bitlbee.org/" #define IM_FLAG_AWAY 0x0020 #define OPT_CONN_HTML 0x00000001 #define OPT_LOGGED_IN 0x00010000 diff --git a/protocols/ssl_sspi.c b/protocols/ssl_sspi.c index c6d7def9..110f0af2 100644 --- a/protocols/ssl_sspi.c +++ b/protocols/ssl_sspi.c @@ -47,7 +47,7 @@ struct scd SecPkgContext_StreamSizes sizes; }; -static void ssl_connected( gpointer data, gint source, GaimInputCondition cond ); +static void ssl_connected(gpointer, gint, GaimInputCondition); void sspi_global_init( void ) { @@ -62,16 +62,7 @@ void sspi_global_deinit( void ) void *ssl_connect( char *host, int port, ssl_input_function func, gpointer data ) { struct scd *conn = g_new0( struct scd, 1 ); - SCHANNEL_CRED ssl_cred; - TimeStamp timestamp; - SecBuffer ibuf[2],obuf[1]; - SecBufferDesc ibufs,obufs; - ULONG req = ISC_REQ_REPLAY_DETECT | ISC_REQ_SEQUENCE_DETECT | - ISC_REQ_CONFIDENTIALITY | ISC_REQ_USE_SESSION_KEY | - ISC_REQ_ALLOCATE_MEMORY | ISC_REQ_STREAM | ISC_REQ_EXTENDED_ERROR | - ISC_REQ_MANUAL_CRED_VALIDATION; - ULONG a; - + conn->fd = proxy_connect( host, port, ssl_connected, conn ); conn->func = func; conn->data = data; @@ -90,20 +81,38 @@ void *ssl_connect( char *host, int port, ssl_input_function func, gpointer data atexit( sspi_global_deinit ); } + return conn; +} + +static void ssl_connected(gpointer data, gint fd, GaimInputCondition cond) +{ + struct scd *conn = data; + SCHANNEL_CRED ssl_cred; + TimeStamp timestamp; + SecBuffer ibuf[2],obuf[1]; + SecBufferDesc ibufs,obufs; + ULONG req = ISC_REQ_REPLAY_DETECT | ISC_REQ_SEQUENCE_DETECT | + ISC_REQ_CONFIDENTIALITY | ISC_REQ_USE_SESSION_KEY | + ISC_REQ_ALLOCATE_MEMORY | ISC_REQ_STREAM | ISC_REQ_EXTENDED_ERROR | + ISC_REQ_MANUAL_CRED_VALIDATION; + ULONG a; + memset(&ssl_cred, 0, sizeof(SCHANNEL_CRED)); ssl_cred.dwVersion = SCHANNEL_CRED_VERSION; ssl_cred.grbitEnabledProtocols = SP_PROT_SSL3_CLIENT; SECURITY_STATUS st = AcquireCredentialsHandle(NULL, UNISP_NAME, SECPKG_CRED_OUTBOUND, NULL, &ssl_cred, NULL, NULL, &conn->cred, ×tamp); - if (st != SEC_E_OK) - return NULL; + if (st != SEC_E_OK) { + conn->func( conn->data, NULL, cond ); + return; + do { /* initialize buffers */ ibuf[0].cbBuffer = size; ibuf[0].pvBuffer = buf; - ibuf[1].cbBuffer = 0; ibuf[1].pvBuffer = NIL; - obuf[0].cbBuffer = 0; obuf[0].pvBuffer = NIL; + ibuf[1].cbBuffer = 0; ibuf[1].pvBuffer = NULL; + obuf[0].cbBuffer = 0; obuf[0].pvBuffer = NULL; ibuf[0].BufferType = obuf[0].BufferType = SECBUFFER_TOKEN; ibuf[1].BufferType = SECBUFFER_EMPTY; @@ -126,9 +135,9 @@ void *ssl_connect( char *host, int port, ssl_input_function func, gpointer data QueryContextAttributes(&conn->context, SECPKG_ATTR_STREAM_SIZES, &conn->sizes); + } while (1); - - return( conn ); + conn->func( conn->data, conn, cond ); } int ssl_read( void *conn, char *retdata, int len ) @@ -232,7 +241,7 @@ void ssl_disconnect( void *conn ) DeleteSecurityContext(&scd->context); - FreeCredentialHandle(&scd->cred); + FreeCredentialsHandle(&scd->cred); closesocket( scd->fd ); g_free(scd); @@ -38,7 +38,14 @@ #include <ctype.h> #include <glib.h> #include <time.h> +#ifdef GLIB2 +#define iconv_t GIConv +#define iconv_open g_iconv_open +#define iconv_close g_iconv_close +#define iconv g_iconv +#else #include <iconv.h> +#endif void strip_linefeed(gchar *text) { |