diff --git a/bitlbee-1.2.7-libresolv.patch b/bitlbee-1.2.7-libresolv.patch deleted file mode 100644 index 782e06e..0000000 --- a/bitlbee-1.2.7-libresolv.patch +++ /dev/null @@ -1,434 +0,0 @@ -Patch by Robert Scheck , based on a patch by Matěj Cepl - for bitlbee >= 1.2, to avoid static linking to a private glibc -function, normally visible as libc.so.6(GLIBC_PRIVATE) in the binary RPM package. -Glibc >= 2.9 allows dynamic linking using -lresolv for ns_initparse()/ns_parserr(), -but Red Hat Enterprise Linux 4 and 5 (including derivates) are shipping older glibc -versions. A few more information and details regarding this patch are mentioned in -Red Hat Bugzilla ID #439047: https://bugzilla.redhat.com/show_bug.cgi?id=439047 - ---- bitlbee-1.2.7/configure 2010-04-19 15:10:03.000000000 +0200 -+++ bitlbee-1.2.7/configure.libresolv 2010-04-25 14:52:00.000000000 +0200 -@@ -19,7 +19,7 @@ - pidfile='/var/run/bitlbee.pid' - ipcsocket='/var/run/bitlbee.sock' - pcdir='$prefix/lib/pkgconfig' --systemlibdirs="/lib /lib64 /usr/lib /usr/lib64 /usr/local/lib /usr/local/lib64" -+systemlibdirs="/lib64 /usr/lib64 /usr/local/lib64 /lib /usr/lib /usr/local/lib" - - msn=1 - jabber=1 -@@ -313,10 +313,10 @@ - TMPFILE=$(mktemp /tmp/bitlbee-configure.XXXXXX) - ret=1 - for i in $systemlibdirs; do -- if [ -f $i/libresolv.a ]; then -+ if [ -f $i/libresolv.so ]; then - echo "$RESOLV_TESTCODE" | $CC -o $TMPFILE -x c - -Wl,$i/libresolv.a >/dev/null 2>/dev/null - if [ "$?" = "0" ]; then -- echo 'EFLAGS+='$i'/libresolv.a' >> Makefile.settings -+ echo 'EFLAGS+=-lresolv' >> Makefile.settings - ret=0 - fi - fi ---- bitlbee-1.2.7/lib/Makefile 2010-04-19 15:10:03.000000000 +0200 -+++ bitlbee-1.2.7/lib/Makefile.libresolv 2010-04-25 14:52:00.000000000 +0200 -@@ -9,7 +9,7 @@ - -include ../Makefile.settings - - # [SH] Program variables --objects = arc.o base64.o $(EVENT_HANDLER) http_client.o ini.o md5.o misc.o oauth.o proxy.o sha1.o $(SSL_CLIENT) url.o xmltree.o -+objects = arc.o base64.o $(EVENT_HANDLER) http_client.o ini.o md5.o misc.o oauth.o proxy.o sha1.o srv.o $(SSL_CLIENT) url.o xmltree.o - - CFLAGS += -Wall - LFLAGS += -r ---- bitlbee-1.2.7/lib/misc.c 2010-04-19 15:10:03.000000000 +0200 -+++ bitlbee-1.2.7/lib/misc.c.libresolv 2010-04-25 14:58:57.000000000 +0200 -@@ -44,6 +44,7 @@ - #ifdef HAVE_RESOLV_A - #include - #include -+#include - #endif - - #include "md5.h" -@@ -505,58 +506,6 @@ - return 0; - } - --struct ns_srv_reply *srv_lookup( char *service, char *protocol, char *domain ) --{ -- struct ns_srv_reply *reply = NULL; --#ifdef HAVE_RESOLV_A -- char name[1024]; -- unsigned char querybuf[1024]; -- const unsigned char *buf; -- ns_msg nsh; -- ns_rr rr; -- int i, len, size; -- -- g_snprintf( name, sizeof( name ), "_%s._%s.%s", service, protocol, domain ); -- -- if( ( size = res_query( name, ns_c_in, ns_t_srv, querybuf, sizeof( querybuf ) ) ) <= 0 ) -- return NULL; -- -- if( ns_initparse( querybuf, size, &nsh ) != 0 ) -- return NULL; -- -- if( ns_parserr( &nsh, ns_s_an, 0, &rr ) != 0 ) -- return NULL; -- -- size = ns_rr_rdlen( rr ); -- buf = ns_rr_rdata( rr ); -- -- len = 0; -- for( i = 6; i < size && buf[i]; i += buf[i] + 1 ) -- len += buf[i] + 1; -- -- if( i > size ) -- return NULL; -- -- reply = g_malloc( sizeof( struct ns_srv_reply ) + len ); -- memcpy( reply->name, buf + 7, len ); -- -- for( i = buf[6]; i < len && buf[7+i]; i += buf[7+i] + 1 ) -- reply->name[i] = '.'; -- -- if( i > len ) -- { -- g_free( reply ); -- return NULL; -- } -- -- reply->prio = ( buf[0] << 8 ) | buf[1]; -- reply->weight = ( buf[2] << 8 ) | buf[3]; -- reply->port = ( buf[4] << 8 ) | buf[5]; --#endif -- -- return reply; --} -- - /* Word wrapping. Yes, I know this isn't UTF-8 clean. I'm willing to take the risk. */ - char *word_wrap( const char *msg, int line_len ) - { ---- bitlbee-1.2.7/lib/misc.h 2010-04-19 15:10:03.000000000 +0200 -+++ bitlbee-1.2.7/lib/misc.h.libresolv 2010-04-25 14:56:02.000000000 +0200 -@@ -28,14 +28,7 @@ - - #include - #include -- --struct ns_srv_reply --{ -- int prio; -- int weight; -- int port; -- char name[]; --}; -+#include "srv.h" - - G_MODULE_EXPORT void strip_linefeed( gchar *text ); - G_MODULE_EXPORT char *add_cr( char *text ); ---- bitlbee-1.2.7/lib/srv.c 1970-01-01 01:00:00.000000000 +0100 -+++ bitlbee-1.2.7/lib/srv.c.libresolv 2010-04-25 14:58:24.000000000 +0200 -@@ -0,0 +1,249 @@ -+/* srv.c - DNS SRV code -+ * Copyright (C) 2003 Free Software Foundation, Inc. -+ * -+ * This file is part of GNUPG. -+ * -+ * GNUPG 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 3 of the License, or -+ * (at your option) any later version. -+ * -+ * GNUPG 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. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, see . -+ */ -+ -+#undef TEST -+ -+#ifdef TEST -+#define HAVE_RESOLV_A -+#endif -+ -+#include -+#include -+ -+#include -+#include -+#include -+#include -+ -+#ifdef HAVE_RESOLV_A -+# ifdef _WIN32 -+# include -+# else -+# include -+# include -+# include -+# endif /* !_WIN32 */ -+#endif /* USE_DNS_SRV */ -+ -+#include "srv.h" -+#include -+#include -+#include -+ -+/* Not every installation has gotten around to supporting SRVs yet...*/ -+#ifndef T_SRV -+#define T_SRV 33 -+#endif -+ -+static int priosort(const void *a, const void *b) { -+ const struct ns_srv_reply *sa=a, *sb=b; -+ if (sa->prio>sb->prio) -+ return 1; -+ else if (sa->prioprio) -+ return -1; -+ else -+ return 0; -+} -+ -+struct ns_srv_reply *srv_lookup(char *service, char *protocol, char *domain) { -+ struct ns_srv_reply *reply = NULL; -+ struct ns_srv_reply *list = NULL; -+ char name[1024]; -+#ifdef HAVE_RESOLV_A -+ unsigned char answer[PACKETSZ]; -+ int r, srvcount=0; -+ unsigned char *pt, *emsg; -+ int count, dlen; -+ -+ g_snprintf(name, sizeof(name ), "_%s._%s.%s", service, protocol, domain); -+ -+ _res.options |= RES_DEBUG; -+ -+ if ( res_init() != 0 ) -+ return NULL; -+ -+ r=res_query(name, C_IN, T_SRV, answer, PACKETSZ); -+ -+ if (rPACKETSZ) -+ return NULL; -+ -+ if ((((HEADER *)answer)->rcode)==NOERROR && (count=ntohs(((HEADER *)answer)->ancount))) { -+ int i, rc; -+ -+ emsg=&answer[r]; /* end of message ??? */ -+ pt=&answer[sizeof(HEADER)]; -+ -+ /* Skip over the query */ -+ rc=dn_skipname(pt, emsg); -+ if (rc==-1) -+ goto fail; -+ -+ pt+=rc+QFIXEDSZ; -+ -+ while (count-->0 && ptprio=*pt++ << 8; -+ srv->prio|=*pt++; -+ srv->weight=*pt++ << 8; -+ srv->weight|=*pt++; -+ srv->port=*pt++ << 8; -+ srv->port|=*pt++; -+ -+ /* Get the name. 2782 doesn't allow name compression, but -+ dn_expand still works to pull the name out of the -+ packet. */ -+ rc=dn_expand(answer, emsg, pt, srv->name, MAXDNAME); -+ if (rc==1 && srv->name[0]==0) /* "." */ -+ goto noanswer; -+ if (rc==-1) -+ goto fail; -+ pt+=rc; -+ /* Corrupt packet? */ -+ if (dlen!=rc+6) -+ goto fail; -+ } -+ -+ /* Now we have an array of all the srv records. */ -+ -+ /* Order by priority */ -+ qsort(list, srvcount, sizeof(struct ns_srv_reply), priosort); -+ -+ /* For each priority, move the zero-weighted items first. */ -+ for (i=0; iprio); -+ printf("weight=%hu\n", srv->weight); -+ printf("port=%hu\n", srv->port); -+ printf("target=%s\n", srv->name); -+ printf("\n"); -+ g_free(srv); -+ } -+ -+ return 0; -+} -+#endif /* TEST */ ---- bitlbee-1.2.7/lib/srv.h 1970-01-01 01:00:00.000000000 +0100 -+++ bitlbee-1.2.7/lib/srv.h.libresolv 2010-04-25 14:58:44.000000000 +0200 -@@ -0,0 +1,38 @@ -+/* srv.h -+ * Copyright (C) 2003, 2004 Free Software Foundation, Inc. -+ * -+ * This file is part of GNUPG. -+ * -+ * GNUPG 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 3 of the License, or -+ * (at your option) any later version. -+ * -+ * GNUPG 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. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, see . -+ */ -+ -+#ifndef GNUPG_COMMON_SRV_H -+#define GNUPG_COMMON_SRV_H -+ -+#ifndef MAXDNAME -+#define MAXDNAME 1025 -+#endif -+ -+struct ns_srv_reply -+{ -+ int prio; /* priority */ -+ int weight; /* weight */ -+ int port; /* port */ -+ int run_count; /* from struct srventry at gnupg's common/srv.h */ -+ char name[MAXDNAME]; /* target */ -+}; -+ -+struct ns_srv_reply *srv_lookup(char *service, char *protocol, char *domain); -+ -+#endif /*GNUPG_COMMON_SRV_H*/ ---- bitlbee-1.2.7/Makefile 2010-04-19 15:10:03.000000000 +0200 -+++ bitlbee-1.2.7/Makefile.libresolv 2010-04-25 14:52:00.000000000 +0200 -@@ -10,7 +10,7 @@ - - # Program variables - objects = account.o bitlbee.o chat.o crypting.o help.o ipc.o irc.o irc_commands.o nick.o query.o root_commands.o set.o storage.o $(STORAGE_OBJS) user.o --headers = account.h bitlbee.h commands.h conf.h config.h crypting.h help.h ipc.h irc.h log.h nick.h query.h set.h sock.h storage.h user.h lib/events.h lib/http_client.h lib/ini.h lib/md5.h lib/misc.h lib/proxy.h lib/sha1.h lib/ssl_client.h lib/url.h protocols/nogaim.h -+headers = account.h bitlbee.h commands.h conf.h config.h crypting.h help.h ipc.h irc.h log.h nick.h query.h set.h sock.h storage.h user.h lib/events.h lib/http_client.h lib/ini.h lib/md5.h lib/misc.h lib/proxy.h lib/sha1.h lib/srv.h lib/ssl_client.h lib/url.h protocols/nogaim.h - subdirs = lib protocols - - ifeq ($(TARGET),i586-mingw32msvc) diff --git a/bitlbee-1.2.8-strtoll.patch b/bitlbee-1.2.8-strtoll.patch deleted file mode 100644 index 8d88442..0000000 --- a/bitlbee-1.2.8-strtoll.patch +++ /dev/null @@ -1,23 +0,0 @@ -Patch by Robert Scheck for bitlbee >= 1.2.8, which works around the -requirement of g_ascii_strtoll(), that is only available in glib >= 2.12.0. But glib <= 2.12.4 -is potentially buggy as well, see: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=488013. At -the moment, Red Hat Enterprise Linux 4 and 5 (including derivates) are shipping the older glib -versions. The upstream bug report can be read at: http://bugs.bitlbee.org/bitlbee/ticket/643 - ---- bitlbee-1.2.8/protocols/twitter/twitter_lib.c 2010-07-04 19:26:16.000000000 +0200 -+++ bitlbee-1.2.8/protocols/twitter/twitter_lib.c.strtoll 2010-07-04 21:27:50.000000000 +0200 -@@ -35,6 +35,14 @@ - #include - #include - -+/* GLib < 2.12.0 doesn't have g_ascii_strtoll(), work around using system strtoll(). */ -+/* GLib < 2.12.4 can be buggy: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=488013 */ -+#if !GLIB_CHECK_VERSION(2,12,5) -+#include -+#include -+#define g_ascii_strtoll strtoll -+#endif -+ - #define TXL_STATUS 1 - #define TXL_USER 2 - #define TXL_ID 3 diff --git a/bitlbee-3.0-configure-eclipse.patch b/bitlbee-3.0-configure-eclipse.patch deleted file mode 100644 index a00f088..0000000 --- a/bitlbee-3.0-configure-eclipse.patch +++ /dev/null @@ -1,16 +0,0 @@ -diff --git a/configure b/configure -index be06d6a..8976adc 100755 ---- a/configure -+++ b/configure -@@ -128,8 +128,9 @@ LFLAGS= - EFLAGS= - EOF - --srcdir="$(dirname $0)" --if [ "$srcdir" != "." ]; then -+srcdir="$(readlink -f $(dirname $0))" -+curdir="$(readlink -f $(pwd))" -+if [ "$srcdir" != "$curdir" ]; then - echo - echo "configure script run from a different directory. Will create some symlinks..." - if [ ! -e Makefile -o -L Makefile ]; then diff --git a/bitlbee-3.0-nss.patch b/bitlbee-3.0-nss.patch deleted file mode 100644 index 36abcef..0000000 --- a/bitlbee-3.0-nss.patch +++ /dev/null @@ -1,179 +0,0 @@ -diff --git a/configure b/configure -index ff68da8..be06d6a 100755 ---- a/configure -+++ b/configure -@@ -288,10 +288,10 @@ EOF - - detect_nss() - { -- if $PKG_CONFIG --version > /dev/null 2>/dev/null && $PKG_CONFIG mozilla-nss; then -+ if $PKG_CONFIG --version > /dev/null 2>/dev/null && $PKG_CONFIG nss; then - cat<>Makefile.settings --EFLAGS+=`$PKG_CONFIG --libs mozilla-nss` --CFLAGS+=`$PKG_CONFIG --cflags mozilla-nss` -+EFLAGS+=`$PKG_CONFIG --libs nss` -+CFLAGS+=`$PKG_CONFIG --cflags nss` - EOF - - ssl=nss -@@ -426,7 +426,7 @@ if [ "$ret" = "0" ]; then - exit 1 - fi; - --if [ "$msn" = "1" -a "$ssl" != "openssl" -a "$ssl" != "gnutls" ]; then -+if [ "$msn" = "1" -a "$ssl" != "openssl" -a "$ssl" != "nss" -a "$ssl" != "gnutls" ]; then - # Needed for MSN only. OpenSSL exports nice cipher functions already, - # in case of GnuTLS we should be able to use gcrypt. Otherwise, use - # built-in stuff. (Since right now those are the only two supported -diff --git a/lib/ssl_nss.c b/lib/ssl_nss.c -index b0e2f9f..63a47f5 100644 ---- a/lib/ssl_nss.c -+++ b/lib/ssl_nss.c -@@ -33,8 +33,10 @@ - #include - #include - #include -+#include - #include - #include -+#include - #include - #include - -@@ -52,6 +54,7 @@ struct scd - }; - - static gboolean ssl_connected( gpointer data, gint source, b_input_condition cond ); -+static gboolean ssl_starttls_real( gpointer data, gint source, b_input_condition cond ); - - - static SECStatus nss_auth_cert (void *arg, PRFileDesc *socket, PRBool checksig, PRBool isserver) -@@ -121,6 +124,35 @@ void *ssl_connect( char *host, int port, ssl_input_function func, gpointer data - return( conn ); - } - -+static gboolean ssl_starttls_real( gpointer data, gint source, b_input_condition cond ) -+{ -+ struct scd *conn = data; -+ -+ return ssl_connected( conn, conn->fd, B_EV_IO_WRITE ); -+} -+ -+void *ssl_starttls( int fd, ssl_input_function func, gpointer data ) -+{ -+ struct scd *conn = g_new0( struct scd, 1 ); -+ -+ conn->fd = fd; -+ conn->func = func; -+ conn->data = data; -+ -+ /* This function should be called via a (short) timeout instead of -+ directly from here, because these SSL calls are *supposed* to be -+ *completely* asynchronous and not ready yet when this function -+ (or *_connect, for examle) returns. Also, errors are reported via -+ the callback function, not via this function's return value. -+ -+ In short, doing things like this makes the rest of the code a lot -+ simpler. */ -+ -+ b_timeout_add( 1, ssl_starttls_real, conn ); -+ -+ return conn; -+} -+ - static gboolean ssl_connected( gpointer data, gint source, b_input_condition cond ) - { - struct scd *conn = data; -@@ -200,3 +232,92 @@ b_input_condition ssl_getdirection( void *conn ) - /* Just in case someone calls us, let's return the most likely case: */ - return B_EV_IO_READ; - } -+ -+size_t ssl_des3_encrypt(const unsigned char *key, size_t key_len, -+ const unsigned char *input, size_t input_len, const unsigned char *iv, -+ unsigned char **res) -+{ -+ int output_length = 0; -+ -+ CK_MECHANISM_TYPE cipherMech; -+ PK11SlotInfo* slot = NULL; -+ PK11SymKey* SymKey = NULL; -+ SECItem* SecParam = NULL; -+ PK11Context* EncContext = NULL; -+ SECItem keyItem, ivItem; -+ SECStatus rv1, rv2; -+ int tmp1_outlen, tmp2_outlen; -+ -+ if (!initialized) -+ { -+ ssl_init(); -+ } -+ -+ *res = g_new0(unsigned char, 1024); -+ -+ cipherMech = CKM_DES3_CBC_PAD; -+ slot = PK11_GetBestSlot(cipherMech, NULL); -+ -+ if (slot == NULL) -+ { -+ fprintf(stderr, "Unable to find security device (err %d)\n", -+ PR_GetError()); -+ goto out; -+ } -+ -+ // Converts "raw key" into a key object. -+ keyItem.type = siBuffer; -+ keyItem.data = (unsigned char*)key; -+ keyItem.len = key_len; -+ -+ SymKey = PK11_ImportSymKey(slot, cipherMech, PK11_OriginUnwrap, CKA_ENCRYPT, -+ &keyItem, NULL); -+ -+ if (SymKey == NULL) -+ { -+ fprintf(stderr, "Failure to import key into NSS (err %d)\n", -+ PR_GetError()); -+ goto out; -+ } -+ -+ /* set up the PKCS11 encryption paramters. -+ * when not using CBC mode, ivItem.data and ivItem.len can be 0, or you -+ * can simply pass NULL for the iv parameter in PK11_ParamFromIV func -+ */ -+ ivItem.type = siBuffer; -+ ivItem.data = iv; -+ ivItem.len = strlen(iv); // ??? Is it right? FIXME -+ SecParam = PK11_ParamFromIV(cipherMech, &ivItem); -+ if (SecParam == NULL) -+ { -+ fprintf(stderr, "Failure to set up PKCS11 param (err %d)\n", -+ PR_GetError()); -+ goto out; -+ } -+ -+ /* ========================= START SECTION ============================= */ -+ /* If using the the same key and iv over and over, stuff before this */ -+ /* section and after this section needs to be done only ONCE */ -+ /* ENCRYPT data into buf1. buf1 len must be atleast (data len + 8) */ -+ tmp1_outlen = tmp2_outlen = 0; -+ -+ /* Create cipher context */ -+ EncContext = PK11_CreateContextBySymKey(cipherMech, CKA_ENCRYPT, -+ SymKey, SecParam); -+ rv1 = PK11_CipherOp(EncContext, res, &tmp1_outlen, sizeof(res), -+ input, input_len+1); -+ rv2 = PK11_DigestFinal(EncContext, res+tmp1_outlen, &tmp2_outlen, -+ sizeof(res)-tmp1_outlen); -+ PK11_DestroyContext(EncContext, PR_TRUE); -+ output_length = tmp1_outlen + tmp2_outlen; -+ if (rv1 != SECSuccess || rv2 != SECSuccess) -+ goto out; -+ -+ return output_length; -+ -+ out: -+ if (SymKey) -+ PK11_FreeSymKey(SymKey); -+ if (SecParam) -+ SECITEM_FreeItem(SecParam, PR_TRUE); -+} diff --git a/bitlbee-configure-eclipse.patch b/bitlbee-configure-eclipse.patch new file mode 100644 index 0000000..2b16641 --- /dev/null +++ b/bitlbee-configure-eclipse.patch @@ -0,0 +1,15 @@ +diff -up bitlbee-3.0/configure.configureEclipse bitlbee-3.0/configure +--- bitlbee-3.0/configure.configureEclipse 2010-11-22 02:37:09.000000000 +0100 ++++ bitlbee-3.0/configure 2010-11-22 02:37:45.000000000 +0100 +@@ -128,8 +128,9 @@ LFLAGS= + EFLAGS= + EOF + +-srcdir="$(dirname $0)" +-if [ "$srcdir" != "." ]; then ++srcdir=$(cd $(dirname $0);pwd) ++currdir=$(pwd) ++if [ "$srcdir" != "$currdir" ]; then + echo + echo "configure script run from a different directory. Will create some symlinks..." + if [ ! -e Makefile -o -L Makefile ]; then diff --git a/bitlbee-libresolv.patch b/bitlbee-libresolv.patch new file mode 100644 index 0000000..e38171c --- /dev/null +++ b/bitlbee-libresolv.patch @@ -0,0 +1,440 @@ +diff -up bitlbee-3.0/configure.libresolv bitlbee-3.0/configure +--- bitlbee-3.0/configure.libresolv 2010-11-22 02:38:33.000000000 +0100 ++++ bitlbee-3.0/configure 2010-11-22 02:38:33.000000000 +0100 +@@ -348,10 +349,10 @@ detect_resolv_static() + TMPFILE=$(mktemp /tmp/bitlbee-configure.XXXXXX) + ret=1 + for i in $systemlibdirs; do +- if [ -f $i/libresolv.a ]; then ++ if [ -f $i/libresolv.so ]; then + echo "$RESOLV_TESTCODE" | $CC -o $TMPFILE -x c - -Wl,$i/libresolv.a >/dev/null 2>/dev/null + if [ "$?" = "0" ]; then +- echo 'EFLAGS+='$i'/libresolv.a' >> Makefile.settings ++ echo 'EFLAGS+=-lresolv' >> Makefile.settings + ret=0 + fi + fi +diff -up bitlbee-3.0/lib/Makefile.libresolv bitlbee-3.0/lib/Makefile +--- bitlbee-3.0/lib/Makefile.libresolv 2010-10-22 02:51:31.000000000 +0200 ++++ bitlbee-3.0/lib/Makefile 2010-11-22 02:38:33.000000000 +0100 +@@ -12,7 +12,7 @@ SRCDIR := $(SRCDIR)lib/ + endif + + # [SH] Program variables +-objects = arc.o base64.o $(DES) $(EVENT_HANDLER) ftutil.o http_client.o ini.o md5.o misc.o oauth.o proxy.o sha1.o $(SSL_CLIENT) url.o xmltree.o ++objects = arc.o base64.o $(DES) $(EVENT_HANDLER) ftutil.o http_client.o ini.o md5.o misc.o oauth.o proxy.o sha1.o srv.o $(SSL_CLIENT) url.o xmltree.o + + LFLAGS += -r + +diff -up bitlbee-3.0/lib/misc.c.libresolv bitlbee-3.0/lib/misc.c +--- bitlbee-3.0/lib/misc.c.libresolv 2010-10-22 02:51:31.000000000 +0200 ++++ bitlbee-3.0/lib/misc.c 2010-11-22 02:38:33.000000000 +0100 +@@ -44,6 +44,7 @@ + #ifdef HAVE_RESOLV_A + #include + #include ++#include + #endif + + #include "md5.h" +@@ -514,66 +515,6 @@ int bool2int( char *value ) + return 0; + } + +-struct ns_srv_reply **srv_lookup( char *service, char *protocol, char *domain ) +-{ +- struct ns_srv_reply **replies = NULL; +-#ifdef HAVE_RESOLV_A +- struct ns_srv_reply *reply = NULL; +- char name[1024]; +- unsigned char querybuf[1024]; +- const unsigned char *buf; +- ns_msg nsh; +- ns_rr rr; +- int i, n, len, size; +- +- g_snprintf( name, sizeof( name ), "_%s._%s.%s", service, protocol, domain ); +- +- if( ( size = res_query( name, ns_c_in, ns_t_srv, querybuf, sizeof( querybuf ) ) ) <= 0 ) +- return NULL; +- +- if( ns_initparse( querybuf, size, &nsh ) != 0 ) +- return NULL; +- +- n = 0; +- while( ns_parserr( &nsh, ns_s_an, n, &rr ) == 0 ) +- { +- size = ns_rr_rdlen( rr ); +- buf = ns_rr_rdata( rr ); +- +- len = 0; +- for( i = 6; i < size && buf[i]; i += buf[i] + 1 ) +- len += buf[i] + 1; +- +- if( i > size ) +- break; +- +- reply = g_malloc( sizeof( struct ns_srv_reply ) + len ); +- memcpy( reply->name, buf + 7, len ); +- +- for( i = buf[6]; i < len && buf[7+i]; i += buf[7+i] + 1 ) +- reply->name[i] = '.'; +- +- if( i > len ) +- { +- g_free( reply ); +- break; +- } +- +- reply->prio = ( buf[0] << 8 ) | buf[1]; +- reply->weight = ( buf[2] << 8 ) | buf[3]; +- reply->port = ( buf[4] << 8 ) | buf[5]; +- +- n ++; +- replies = g_renew( struct ns_srv_reply *, replies, n + 1 ); +- replies[n-1] = reply; +- } +- if( replies ) +- replies[n] = NULL; +-#endif +- +- return replies; +-} +- + void srv_free( struct ns_srv_reply **srv ) + { + int i; +diff -up bitlbee-3.0/lib/misc.h.libresolv bitlbee-3.0/lib/misc.h +--- bitlbee-3.0/lib/misc.h.libresolv 2010-10-22 02:51:31.000000000 +0200 ++++ bitlbee-3.0/lib/misc.h 2010-11-22 02:39:51.000000000 +0100 +@@ -28,14 +28,7 @@ + + #include + #include +- +-struct ns_srv_reply +-{ +- int prio; +- int weight; +- int port; +- char name[]; +-}; ++#include "srv.h" + + G_MODULE_EXPORT void strip_linefeed( gchar *text ); + G_MODULE_EXPORT char *add_cr( char *text ); +@@ -60,7 +53,6 @@ G_MODULE_EXPORT void random_bytes( unsig + G_MODULE_EXPORT int is_bool( char *value ); + G_MODULE_EXPORT int bool2int( char *value ); + +-G_MODULE_EXPORT struct ns_srv_reply **srv_lookup( char *service, char *protocol, char *domain ); + G_MODULE_EXPORT void srv_free( struct ns_srv_reply **srv ); + + G_MODULE_EXPORT char *word_wrap( const char *msg, int line_len ); +diff -up /dev/null bitlbee-3.0/lib/srv.c +--- /dev/null 2010-11-21 23:39:22.000456625 +0100 ++++ bitlbee-3.0/lib/srv.c 2010-11-22 02:38:33.000000000 +0100 +@@ -0,0 +1,249 @@ ++/* srv.c - DNS SRV code ++ * Copyright (C) 2003 Free Software Foundation, Inc. ++ * ++ * This file is part of GNUPG. ++ * ++ * GNUPG 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 3 of the License, or ++ * (at your option) any later version. ++ * ++ * GNUPG 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. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, see . ++ */ ++ ++#undef TEST ++ ++#ifdef TEST ++#define HAVE_RESOLV_A ++#endif ++ ++#include ++#include ++ ++#include ++#include ++#include ++#include ++ ++#ifdef HAVE_RESOLV_A ++# ifdef _WIN32 ++# include ++# else ++# include ++# include ++# include ++# endif /* !_WIN32 */ ++#endif /* USE_DNS_SRV */ ++ ++#include "srv.h" ++#include ++#include ++#include ++ ++/* Not every installation has gotten around to supporting SRVs yet...*/ ++#ifndef T_SRV ++#define T_SRV 33 ++#endif ++ ++static int priosort(const void *a, const void *b) { ++ const struct ns_srv_reply *sa=a, *sb=b; ++ if (sa->prio>sb->prio) ++ return 1; ++ else if (sa->prioprio) ++ return -1; ++ else ++ return 0; ++} ++ ++struct ns_srv_reply *srv_lookup(char *service, char *protocol, char *domain) { ++ struct ns_srv_reply *reply = NULL; ++ struct ns_srv_reply *list = NULL; ++ char name[1024]; ++#ifdef HAVE_RESOLV_A ++ unsigned char answer[PACKETSZ]; ++ int r, srvcount=0; ++ unsigned char *pt, *emsg; ++ int count, dlen; ++ ++ g_snprintf(name, sizeof(name ), "_%s._%s.%s", service, protocol, domain); ++ ++ _res.options |= RES_DEBUG; ++ ++ if ( res_init() != 0 ) ++ return NULL; ++ ++ r=res_query(name, C_IN, T_SRV, answer, PACKETSZ); ++ ++ if (rPACKETSZ) ++ return NULL; ++ ++ if ((((HEADER *)answer)->rcode)==NOERROR && (count=ntohs(((HEADER *)answer)->ancount))) { ++ int i, rc; ++ ++ emsg=&answer[r]; /* end of message ??? */ ++ pt=&answer[sizeof(HEADER)]; ++ ++ /* Skip over the query */ ++ rc=dn_skipname(pt, emsg); ++ if (rc==-1) ++ goto fail; ++ ++ pt+=rc+QFIXEDSZ; ++ ++ while (count-->0 && ptprio=*pt++ << 8; ++ srv->prio|=*pt++; ++ srv->weight=*pt++ << 8; ++ srv->weight|=*pt++; ++ srv->port=*pt++ << 8; ++ srv->port|=*pt++; ++ ++ /* Get the name. 2782 doesn't allow name compression, but ++ dn_expand still works to pull the name out of the ++ packet. */ ++ rc=dn_expand(answer, emsg, pt, srv->name, MAXDNAME); ++ if (rc==1 && srv->name[0]==0) /* "." */ ++ goto noanswer; ++ if (rc==-1) ++ goto fail; ++ pt+=rc; ++ /* Corrupt packet? */ ++ if (dlen!=rc+6) ++ goto fail; ++ } ++ ++ /* Now we have an array of all the srv records. */ ++ ++ /* Order by priority */ ++ qsort(list, srvcount, sizeof(struct ns_srv_reply), priosort); ++ ++ /* For each priority, move the zero-weighted items first. */ ++ for (i=0; iprio); ++ printf("weight=%hu\n", srv->weight); ++ printf("port=%hu\n", srv->port); ++ printf("target=%s\n", srv->name); ++ printf("\n"); ++ g_free(srv); ++ } ++ ++ return 0; ++} ++#endif /* TEST */ +diff -up /dev/null bitlbee-3.0/lib/srv.h +--- /dev/null 2010-11-21 23:39:22.000456625 +0100 ++++ bitlbee-3.0/lib/srv.h 2010-11-22 02:38:33.000000000 +0100 +@@ -0,0 +1,38 @@ ++/* srv.h ++ * Copyright (C) 2003, 2004 Free Software Foundation, Inc. ++ * ++ * This file is part of GNUPG. ++ * ++ * GNUPG 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 3 of the License, or ++ * (at your option) any later version. ++ * ++ * GNUPG 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. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, see . ++ */ ++ ++#ifndef GNUPG_COMMON_SRV_H ++#define GNUPG_COMMON_SRV_H ++ ++#ifndef MAXDNAME ++#define MAXDNAME 1025 ++#endif ++ ++struct ns_srv_reply ++{ ++ int prio; /* priority */ ++ int weight; /* weight */ ++ int port; /* port */ ++ int run_count; /* from struct srventry at gnupg's common/srv.h */ ++ char name[MAXDNAME]; /* target */ ++}; ++ ++struct ns_srv_reply *srv_lookup(char *service, char *protocol, char *domain); ++ ++#endif /*GNUPG_COMMON_SRV_H*/ +diff -up bitlbee-3.0/Makefile.libresolv bitlbee-3.0/Makefile +--- bitlbee-3.0/Makefile.libresolv 2010-10-22 02:51:31.000000000 +0200 ++++ bitlbee-3.0/Makefile 2010-11-22 02:38:33.000000000 +0100 +@@ -10,7 +10,7 @@ + + # Program variables + objects = bitlbee.o dcc.o help.o ipc.o irc.o irc_im.o irc_channel.o irc_commands.o irc_send.o irc_user.o irc_util.o nick.o $(OTR_BI) query.o root_commands.o set.o storage.o $(STORAGE_OBJS) +-headers = bitlbee.h commands.h conf.h config.h help.h ipc.h irc.h log.h nick.h query.h set.h sock.h storage.h lib/events.h lib/ftutil.h lib/http_client.h lib/ini.h lib/md5.h lib/misc.h lib/proxy.h lib/sha1.h lib/ssl_client.h lib/url.h protocols/account.h protocols/bee.h protocols/ft.h protocols/nogaim.h ++headers = bitlbee.h commands.h conf.h config.h help.h ipc.h irc.h log.h nick.h query.h set.h sock.h storage.h lib/events.h lib/ftutil.h lib/http_client.h lib/ini.h lib/md5.h lib/misc.h lib/proxy.h lib/sha1.h lib/srv.h lib/ssl_client.h lib/url.h protocols/account.h protocols/bee.h protocols/ft.h protocols/nogaim.h + subdirs = lib protocols + + ifeq ($(TARGET),i586-mingw32msvc) diff --git a/bitlbee-nss.patch b/bitlbee-nss.patch new file mode 100644 index 0000000..344e139 --- /dev/null +++ b/bitlbee-nss.patch @@ -0,0 +1,163 @@ +diff -up bitlbee-3.0/configure.nss bitlbee-3.0/configure +--- bitlbee-3.0/configure.nss 2010-11-22 00:39:26.000000000 +0100 ++++ bitlbee-3.0/configure 2010-11-22 00:39:46.000000000 +0100 +@@ -427,7 +427,7 @@ if [ "$ret" = "0" ]; then + exit 1 + fi; + +-if [ "$msn" = "1" -a "$ssl" != "openssl" -a "$ssl" != "gnutls" ]; then ++if [ "$msn" = "1" -a "$ssl" != "openssl" -a "$ssl" != "nss" -a "$ssl" != "gnutls" ]; then + # Needed for MSN only. OpenSSL exports nice cipher functions already, + # in case of GnuTLS we should be able to use gcrypt. Otherwise, use + # built-in stuff. (Since right now those are the only two supported +diff -up bitlbee-3.0/lib/ssl_nss.c.nss bitlbee-3.0/lib/ssl_nss.c +--- bitlbee-3.0/lib/ssl_nss.c.nss 2010-10-22 02:51:31.000000000 +0200 ++++ bitlbee-3.0/lib/ssl_nss.c 2010-11-22 00:39:46.000000000 +0100 +@@ -33,8 +33,10 @@ + #include + #include + #include ++#include + #include + #include ++#include + #include + #include + +@@ -52,6 +54,7 @@ struct scd + }; + + static gboolean ssl_connected( gpointer data, gint source, b_input_condition cond ); ++static gboolean ssl_starttls_real( gpointer data, gint source, b_input_condition cond ); + + + static SECStatus nss_auth_cert (void *arg, PRFileDesc *socket, PRBool checksig, PRBool isserver) +@@ -121,6 +124,35 @@ void *ssl_connect( char *host, int port, + return( conn ); + } + ++static gboolean ssl_starttls_real( gpointer data, gint source, b_input_condition cond ) ++{ ++ struct scd *conn = data; ++ ++ return ssl_connected( conn, conn->fd, B_EV_IO_WRITE ); ++} ++ ++void *ssl_starttls( int fd, ssl_input_function func, gpointer data ) ++{ ++ struct scd *conn = g_new0( struct scd, 1 ); ++ ++ conn->fd = fd; ++ conn->func = func; ++ conn->data = data; ++ ++ /* This function should be called via a (short) timeout instead of ++ directly from here, because these SSL calls are *supposed* to be ++ *completely* asynchronous and not ready yet when this function ++ (or *_connect, for examle) returns. Also, errors are reported via ++ the callback function, not via this function's return value. ++ ++ In short, doing things like this makes the rest of the code a lot ++ simpler. */ ++ ++ b_timeout_add( 1, ssl_starttls_real, conn ); ++ ++ return conn; ++} ++ + static gboolean ssl_connected( gpointer data, gint source, b_input_condition cond ) + { + struct scd *conn = data; +@@ -200,3 +232,92 @@ b_input_condition ssl_getdirection( void + /* Just in case someone calls us, let's return the most likely case: */ + return B_EV_IO_READ; + } ++ ++size_t ssl_des3_encrypt(const unsigned char *key, size_t key_len, ++ const unsigned char *input, size_t input_len, const unsigned char *iv, ++ unsigned char **res) ++{ ++ int output_length = 0; ++ ++ CK_MECHANISM_TYPE cipherMech; ++ PK11SlotInfo* slot = NULL; ++ PK11SymKey* SymKey = NULL; ++ SECItem* SecParam = NULL; ++ PK11Context* EncContext = NULL; ++ SECItem keyItem, ivItem; ++ SECStatus rv1, rv2; ++ int tmp1_outlen, tmp2_outlen; ++ ++ if (!initialized) ++ { ++ ssl_init(); ++ } ++ ++ *res = g_new0(unsigned char, 1024); ++ ++ cipherMech = CKM_DES3_CBC_PAD; ++ slot = PK11_GetBestSlot(cipherMech, NULL); ++ ++ if (slot == NULL) ++ { ++ fprintf(stderr, "Unable to find security device (err %d)\n", ++ PR_GetError()); ++ goto out; ++ } ++ ++ // Converts "raw key" into a key object. ++ keyItem.type = siBuffer; ++ keyItem.data = (unsigned char*)key; ++ keyItem.len = key_len; ++ ++ SymKey = PK11_ImportSymKey(slot, cipherMech, PK11_OriginUnwrap, CKA_ENCRYPT, ++ &keyItem, NULL); ++ ++ if (SymKey == NULL) ++ { ++ fprintf(stderr, "Failure to import key into NSS (err %d)\n", ++ PR_GetError()); ++ goto out; ++ } ++ ++ /* set up the PKCS11 encryption paramters. ++ * when not using CBC mode, ivItem.data and ivItem.len can be 0, or you ++ * can simply pass NULL for the iv parameter in PK11_ParamFromIV func ++ */ ++ ivItem.type = siBuffer; ++ ivItem.data = iv; ++ ivItem.len = strlen(iv); // ??? Is it right? FIXME ++ SecParam = PK11_ParamFromIV(cipherMech, &ivItem); ++ if (SecParam == NULL) ++ { ++ fprintf(stderr, "Failure to set up PKCS11 param (err %d)\n", ++ PR_GetError()); ++ goto out; ++ } ++ ++ /* ========================= START SECTION ============================= */ ++ /* If using the the same key and iv over and over, stuff before this */ ++ /* section and after this section needs to be done only ONCE */ ++ /* ENCRYPT data into buf1. buf1 len must be atleast (data len + 8) */ ++ tmp1_outlen = tmp2_outlen = 0; ++ ++ /* Create cipher context */ ++ EncContext = PK11_CreateContextBySymKey(cipherMech, CKA_ENCRYPT, ++ SymKey, SecParam); ++ rv1 = PK11_CipherOp(EncContext, res, &tmp1_outlen, sizeof(res), ++ input, input_len+1); ++ rv2 = PK11_DigestFinal(EncContext, res+tmp1_outlen, &tmp2_outlen, ++ sizeof(res)-tmp1_outlen); ++ PK11_DestroyContext(EncContext, PR_TRUE); ++ output_length = tmp1_outlen + tmp2_outlen; ++ if (rv1 != SECSuccess || rv2 != SECSuccess) ++ goto out; ++ ++ return output_length; ++ ++ out: ++ if (SymKey) ++ PK11_FreeSymKey(SymKey); ++ if (SecParam) ++ SECITEM_FreeItem(SecParam, PR_TRUE); ++} diff --git a/bitlbee-syslibdirs.patch b/bitlbee-syslibdirs.patch new file mode 100644 index 0000000..d48774f --- /dev/null +++ b/bitlbee-syslibdirs.patch @@ -0,0 +1,12 @@ +diff -up bitlbee-3.0/configure.libresolv bitlbee-3.0/configure +--- bitlbee-3.0/configure.libresolv 2010-10-22 02:51:31.000000000 +0200 ++++ bitlbee-3.0/configure 2010-11-22 01:15:01.000000000 +0100 +@@ -19,7 +19,7 @@ libevent='/usr/' + pidfile='/var/run/bitlbee.pid' + ipcsocket='/var/run/bitlbee.sock' + pcdir='$prefix/lib/pkgconfig' +-systemlibdirs="/lib /lib64 /usr/lib /usr/lib64 /usr/local/lib /usr/local/lib64" ++systemlibdirs="/lib64 /usr/lib64 /usr/local/lib64 /lib /usr/lib /usr/local/lib" + + msn=1 + jabber=1 diff --git a/bitlbee.spec b/bitlbee.spec index cbfe03b..a428a3e 100644 --- a/bitlbee.spec +++ b/bitlbee.spec @@ -8,14 +8,15 @@ URL: http://www.bitlbee.org/ Source0: http://get.bitlbee.org/src/%{name}-%{version}.tar.gz Source1: bitlbee.xinetd Source2: bitlbee-wrapper.h -Patch0: bitlbee-1.2.7-libresolv.patch -Patch1: bitlbee-3.0-nss.patch -Patch2: bitlbee-3.0-configure-eclipse.patch +Patch0: bitlbee-syslibdirs.patch +Patch1: bitlbee-libresolv.patch +Patch2: bitlbee-nss.patch +Patch3: bitlbee-configure-eclipse.patch Requires: xinetd Requires(pre): shadow-utils Requires(preun): /sbin/service BuildRequires: glib2-devel >= 2.4, libxslt -%if 0%{?fedora}%{?rhel} +%if 0%{?fedora}%{?rhel} < 6 BuildRequires: gnutls-devel %else BuildRequires: openssl-devel @@ -39,11 +40,12 @@ developing programs and plugins which use bitlbee. %prep %setup -q +%patch0 -p1 -b .syslibdir %if 0%{?fedora}%{?rhel} < 6 -%patch0 -p1 -b .libresolv +%patch1 -p1 -b .libresolv %endif -%patch1 -p1 -b .nss -%patch2 -p1 -b .configureEclipse +%patch2 -p1 -b .nss +%patch3 -p1 -b .configureEclipse %build CFLAGS="$RPM_OPT_FLAGS" ./configure \