[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

rpms/kdenetwork/FC-3 kdenetwork-3.3.1-kopete-gadu.patch, NONE, 1.1 post-3.3.2-kdenetwork-libgadu.patch, NONE, 1.1 kdenetwork.spec, 1.45, 1.46



Author: than

Update of /cvs/dist/rpms/kdenetwork/FC-3
In directory cvs.devel.redhat.com:/tmp/cvs-serv9556

Modified Files:
	kdenetwork.spec 
Added Files:
	kdenetwork-3.3.1-kopete-gadu.patch 
	post-3.3.2-kdenetwork-libgadu.patch 
Log Message:
- fix crash in kopete
- apply patch to fix libgadu vulnerabilities #163811, CVE CAN-2005-1852
  thank to kde security team
- backport patch to fix annoying problem with registration
  dialog not able to register/retrieve token due to network problems.



kdenetwork-3.3.1-kopete-gadu.patch:
 kopete/chatwindow/chatview.cpp                  |    8 --
 kopete/chatwindow/kopetechatwindow.cpp          |    2 
 kopete/chatwindow/kopeteemailwindow.cpp         |    3 
 kopete/config/appearance/appearanceconfig.cpp   |    6 +
 kopete/config/plugins/kopetepluginconfig.cpp    |    5 +
 kopete/config/plugins/kopetepluginconfig.h      |    2 
 kopete/contactlist/kopetelistview.cpp           |   13 ++-
 kopete/kopetewindow.cpp                         |    5 -
 libkopete/compat/kresolvermanager.cpp           |    2 
 libkopete/compat/ksockssocketdevice.cpp         |    8 +-
 libkopete/kopetecontactlist.cpp                 |    9 +-
 libkopete/kopetegroup.cpp                       |    5 +
 libkopete/kopetemessagemanagerfactory.cpp       |    5 +
 libkopete/kopetemessagemanagerfactory.h         |    3 
 libkopete/kopetexsl.cpp                         |   27 +++++-
 libkopete/ui/accountselector.cpp                |    1 
 libkopete/ui/kopetefileconfirmdialog.cpp        |    6 -
 protocols/gadu/gadueditaccount.cpp              |   12 ++-
 protocols/gadu/gaduregisteraccount.cpp          |   17 +---
 protocols/gadu/libgadu/common.c                 |   87 ++++++++++++++++++---
 protocols/gadu/libgadu/events.c                 |   83 ++++++++++++--------
 protocols/gadu/libgadu/http.c                   |   11 +-
 protocols/gadu/libgadu/libgadu.c                |   95 +++++++++++++++++-------
 protocols/gadu/libgadu/libgadu.h                |    4 -
 protocols/gadu/libgadu/pubdir.c                 |    4 -
 protocols/irc/ui/channellist.cpp                |    1 
 protocols/oscar/oscarsocket/oscarconnection.cpp |    7 +
 protocols/oscar/oscarsocket/oscarsocket.aim.cpp |    2 
 28 files changed, 304 insertions(+), 129 deletions(-)

--- NEW FILE kdenetwork-3.3.1-kopete-gadu.patch ---
--- kdenetwork-3.3.1/kopete/kopete/chatwindow/chatview.cpp.tn	2004-10-03 09:43:20.000000000 +0200
+++ kdenetwork-3.3.1/kopete/kopete/chatwindow/chatview.cpp	2004-11-28 18:10:16.000000000 +0100
@@ -216,7 +216,6 @@
 	editpart = new KopeteRichTextEditPart( editDock, "kopeterichtexteditpart",
 		mgr->protocol()->richTextCapabilities() );
 	connect( editpart, SIGNAL( toggleToolbar(bool)), this, SLOT(slotToggleRtfToolbar(bool)) );
-	connect( this, SIGNAL( windowCreated()), editpart, SLOT(checkToolbarEnabled()) );
 
 	m_edit = static_cast<KTextEdit*>( editpart->widget() );
 
@@ -338,12 +337,7 @@
 	if( !KWin::windowInfo( m_mainWindow->winId(), NET::WMDesktop ).onAllDesktops() )
 		KWin::setOnDesktop( m_mainWindow->winId(), KWin::currentDesktop() );
 
-	m_mainWindow->show();
-	//raise() and show() should normaly deIconify the window. but it doesn't do here due
-	// to a bug in QT or in KDE  (qt3.1.x or KDE 3.1.x) then, i have to call KWin's method
-	if(m_mainWindow->isMinimized())
-		KWin::deIconifyWindow(m_mainWindow->winId() );
-	KWin::raiseWindow( m_mainWindow->winId() );
+	m_mainWindow->raise();
 
 	/* Removed Nov 2003
 	According to Zack, the user double-clicking a contact is not valid reason for a non-pager
--- kdenetwork-3.3.1/kopete/kopete/chatwindow/kopetechatwindow.cpp.tn	2004-10-03 09:43:20.000000000 +0200
+++ kdenetwork-3.3.1/kopete/kopete/chatwindow/kopetechatwindow.cpp	2004-11-28 18:10:16.000000000 +0100
@@ -846,7 +846,7 @@
 
 	guiFactory()->addClient(view->msgManager());
 	createGUI( view->part() );
-	readOptions();
+	
 	if( m_activeView )
 		m_activeView->setActive( false );
 
--- kdenetwork-3.3.1/kopete/kopete/chatwindow/kopeteemailwindow.cpp.tn	2004-10-03 09:43:20.000000000 +0200
+++ kdenetwork-3.3.1/kopete/kopete/chatwindow/kopeteemailwindow.cpp	2004-11-28 18:10:16.000000000 +0100
@@ -670,7 +670,10 @@
 void KopeteEmailWindow::raise(bool activate)
 {
 	makeVisible();
+	
+	if ( !KWin::windowInfo( winId(), NET::WMDesktop ).onAllDesktops() )
 	KWin::setOnDesktop( winId(), KWin::currentDesktop() );
+	
 	KMainWindow::raise();
 
 	/* Removed Nov 2003
--- kdenetwork-3.3.1/kopete/kopete/config/appearance/appearanceconfig.cpp.tn	2004-08-09 11:27:10.000000000 +0200
+++ kdenetwork-3.3.1/kopete/kopete/config/appearance/appearanceconfig.cpp	2004-11-28 18:10:17.000000000 +0100
@@ -310,7 +310,11 @@
 	mPrfsContactList->mIndentContacts->setChecked( p->contactListIndentContacts() );
 	mPrfsContactList->mDisplayMode->setButton( p->contactListDisplayMode() );
 	mPrfsContactList->mAnimateChanges->setChecked( p->contactListAnimation() );
-	mPrfsContactList->mFadeVisibility->setChecked( p->contactListFading() && HAVE_XRENDER );
+#ifdef HAVE_XRENDER
+	mPrfsContactList->mFadeVisibility->setChecked( p->contactListFading() );
+#else
+	mPrfsContactList->mFadeVisibility->setChecked( false );
+#endif
 	mPrfsContactList->mFoldVisibility->setChecked( p->contactListFolding() );
 
 	// "Colors & Fonts" TAB =====================================================
--- kdenetwork-3.3.1/kopete/kopete/config/plugins/kopetepluginconfig.cpp.tn	2004-08-05 21:26:20.000000000 +0200
+++ kdenetwork-3.3.1/kopete/kopete/config/plugins/kopetepluginconfig.cpp	2004-11-28 18:10:17.000000000 +0100
@@ -34,6 +34,11 @@
 	bool isChanged;
 };
 
+KopetePluginConfig::~KopetePluginConfig()
+{
+	delete d;
+}
+
 KopetePluginConfig::KopetePluginConfig( QWidget *parent, const char *name )
 : KDialogBase( Plain, i18n( "Configure" ), Help | Default | Cancel | Apply | Ok | User1,
 	Ok, parent, name, false, true, KGuiItem( i18n( "&Reset" ), "undo" ) )
--- kdenetwork-3.3.1/kopete/kopete/config/plugins/kopetepluginconfig.h.tn	2003-10-18 00:01:42.000000000 +0200
+++ kdenetwork-3.3.1/kopete/kopete/config/plugins/kopetepluginconfig.h	2004-11-28 18:10:17.000000000 +0100
@@ -33,7 +33,7 @@
 
 public:
 	KopetePluginConfig( QWidget *parent, const char *name = 0L );
-
+	~KopetePluginConfig();
 	void apply();
 
 public slots:
--- kdenetwork-3.3.1/kopete/kopete/contactlist/kopetelistview.cpp.tn	2004-07-30 17:10:30.000000000 +0200
+++ kdenetwork-3.3.1/kopete/kopete/contactlist/kopetelistview.cpp	2004-11-28 18:10:17.000000000 +0100
@@ -180,10 +180,15 @@
  */
 void ListView::keyPressEvent( QKeyEvent *e )
 {
-	if ( (e->key() == Qt::Key_F2) && currentItem() )
-		rename( currentItem(), 0 );
-	else if ( (e->key() == Qt::Key_Enter || e->key() == Qt::Key_Return) && currentItem())
-		emitExecute( currentItem(), QPoint(), 0 );
+	QListViewItem *item = currentItem();
+	if ( (e->key() == Qt::Key_F2) && item && item->isVisible() )
+		rename( item, 0 );
+	else if ( (e->key() == Qt::Key_Enter || e->key() == Qt::Key_Return) && item && item->isVisible() )
+	{
+		// must provide a point within the item; emitExecute checks for this
+		QPoint p = viewport()->mapToGlobal(itemRect(item).center());
+		emitExecute( currentItem(), p, 0 );
+	}
 	else
 		KListView::keyPressEvent(e);
 }
--- kdenetwork-3.3.1/kopete/kopete/kopetewindow.cpp.tn	2004-10-03 09:43:20.000000000 +0200
+++ kdenetwork-3.3.1/kopete/kopete/kopetewindow.cpp	2004-11-28 18:10:16.000000000 +0100
@@ -196,7 +196,7 @@
 
 	globalAccel = new KGlobalAccel( this );
 	globalAccel->insert( QString::fromLatin1("Read Message"), i18n("Read Message"), i18n("Read the next pending message"),
-		CTRL+SHIFT+Key_I, KKey::QtWIN+CTRL+Key_I, KopeteMessageManagerFactory::factory() , SIGNAL(readMessage()) );
+		CTRL+SHIFT+Key_I, KKey::QtWIN+CTRL+Key_I, KopeteMessageManagerFactory::factory(), SLOT(slotReadMessage()) );
 
 	globalAccel->insert( QString::fromLatin1("Show/Hide Contact List"), i18n("Show/Hide Contact List"), i18n("Show or hide the contact list"),
 		CTRL+SHIFT+Key_C, KKey::QtWIN+CTRL+Key_C, this, SLOT(slotShowHide()) );
@@ -400,7 +400,7 @@
 void KopeteWindow::slotConfToolbar()
 {
 	saveMainWindowSettings(KGlobal::config(), "General Options");
-	KEditToolbar *dlg = new KEditToolbar(actionCollection(), "kopeteui.rc");
+	KEditToolbar *dlg = new KEditToolbar(factory());
 	connect( dlg, SIGNAL(newToolbarConfig()), this, SLOT(slotUpdateToolbar()) );
 	connect( dlg, SIGNAL(finished()) , dlg, SLOT(deleteLater()));
 	dlg->show();
@@ -408,7 +408,6 @@
 
 void KopeteWindow::slotUpdateToolbar()
 {
-	createGUI("kopeteui.rc", false);
 	applyMainWindowSettings(KGlobal::config(), "General Options");
 }
 
--- kdenetwork-3.3.1/kopete/libkopete/compat/kresolvermanager.cpp.tn	2004-10-03 09:43:23.000000000 +0200
+++ kdenetwork-3.3.1/kopete/libkopete/compat/kresolvermanager.cpp	2004-11-28 18:10:18.000000000 +0100
@@ -203,7 +203,7 @@
 // a thread will try maxThreadRetries to get data, waiting at most
 // maxThreadWaitTime milliseconds between each attempt. After that, it'll
 // exit
-static const int maxThreadWaitTime = 20000; // 20 seconds
+static const int maxThreadWaitTime = ULONG_MAX; // wait forever
 static const int maxThreads = 5;
 
 static pid_t pid;		// FIXME -- disable when everything is ok
--- kdenetwork-3.3.1/kopete/libkopete/compat/ksockssocketdevice.cpp.tn	2004-10-03 09:43:23.000000000 +0200
+++ kdenetwork-3.3.1/kopete/libkopete/compat/ksockssocketdevice.cpp	2004-11-28 18:10:18.000000000 +0100
@@ -169,7 +169,7 @@
   return new KSocksSocketDevice(newfd);
 }
 
-static int socks_read_common(int sockfd, char *data, Q_ULONG maxlen, KSocketAddress* from, ssize_t &retval, bool peek = false)
+static int socks_read_common(int sockfd, char *data, Q_ULONG maxlen, KNetwork::KSocketAddress* from, ssize_t &retval, bool peek = false)
 {
   kde_socklen_t len;
   if (from)
@@ -304,7 +304,7 @@
   return retval;
 }
 
-KSocketAddress KSocksSocketDevice::localAddress() const
+KNetwork::KSocketAddress KSocksSocketDevice::localAddress() const
 {
   if (m_sockfd == -1)
     return KSocketAddress();	// not open, empty value
@@ -333,7 +333,7 @@
   return localAddress;
 }
 
-KSocketAddress KSocksSocketDevice::peerAddress() const
+KNetwork::KSocketAddress KSocksSocketDevice::peerAddress() const
 {
   if (m_sockfd == -1)
     return KSocketAddress();	// not open, empty value
@@ -362,7 +362,7 @@
   return peerAddress;
 }
 
-KSocketAddress KSocksSocketDevice::externalAddress() const
+KNetwork::KSocketAddress KSocksSocketDevice::externalAddress() const
 {
   // return empty, indicating unknown external address
   return KSocketAddress();
--- kdenetwork-3.3.1/kopete/libkopete/kopetecontactlist.cpp.tn	2004-08-05 21:26:20.000000000 +0200
+++ kdenetwork-3.3.1/kopete/libkopete/kopetecontactlist.cpp	2004-11-28 18:10:18.000000000 +0100
@@ -912,9 +912,12 @@
 		setSelectedItems( d->selectedMetaContacts, d->selectedGroups );
 	}
 
-	d->groups.remove( g );
-	emit groupRemoved( g );
-	delete g;
+	if ( g->type() == KopeteGroup::Normal )
+	{
+		d->groups.remove( g );
+		emit groupRemoved( g );
+		delete g;
+	}
 }
 
 KopeteGroup * KopeteContactList::getGroup(const QString& displayName, int type)
--- kdenetwork-3.3.1/kopete/libkopete/kopetegroup.cpp.tn	2004-08-05 21:26:20.000000000 +0200
+++ kdenetwork-3.3.1/kopete/libkopete/kopetegroup.cpp	2004-11-28 18:10:18.000000000 +0100
@@ -96,6 +96,11 @@
 
 KopeteGroup::~KopeteGroup()
 {
+	if ( d->type == TopLevel )
+		s_topLevel = 0L;
+	if ( d->type == Temporary )
+		s_temporary = 0L;
+
 	delete d;
 }
 
--- kdenetwork-3.3.1/kopete/libkopete/kopetemessagemanagerfactory.cpp.tn	2004-05-22 22:57:15.000000000 +0200
+++ kdenetwork-3.3.1/kopete/libkopete/kopetemessagemanagerfactory.cpp	2004-11-28 18:10:18.000000000 +0100
@@ -105,6 +105,11 @@
 	return (result);
 }
 
+void KopeteMessageManagerFactory::slotReadMessage()
+{
+	emit readMessage();
+}
+
 void KopeteMessageManagerFactory::addKopeteMessageManager(KopeteMessageManager * result)
 {
 	if(result->mmId() == 0)
--- kdenetwork-3.3.1/kopete/libkopete/kopetemessagemanagerfactory.h.tn	2004-05-22 22:57:15.000000000 +0200
+++ kdenetwork-3.3.1/kopete/libkopete/kopetemessagemanagerfactory.h	2004-11-28 18:10:18.000000000 +0100
@@ -188,6 +188,9 @@
 	 */
 	 void getActiveView( KopeteView *& );
 
+public slots:
+	void slotReadMessage();
+
 private:
 	KopeteMessageManagerFactory( QObject* parent = 0, const char* name = 0 );
 
--- kdenetwork-3.3.1/kopete/libkopete/kopetexsl.cpp.tn	2004-06-25 11:10:09.000000000 +0200
+++ kdenetwork-3.3.1/kopete/libkopete/kopetexsl.cpp	2004-11-28 18:10:18.000000000 +0100
@@ -36,6 +36,8 @@
 #include <qsignal.h>
 #include <qstylesheet.h>
 #include <qthread.h>
+#include <qevent.h>
+#include <qmutex.h>
 
 #include <kapplication.h>
 #include <kdebug.h>
@@ -48,7 +50,7 @@
  * The thread class that actually performs the XSL processing.
  * Using a thread allows async operation.
  */
-class KopeteXSLThread : public QThread
+class KopeteXSLThread : public QObject, public QThread
 {
 public:
 	/**
@@ -66,6 +68,11 @@
 	 */
 	virtual void run();
 
+	/**
+	 * A user event is used to get back to the UI thread to emit the completed signal
+	 */
+	bool event( QEvent *event );
+	
 	static QString xsltTransform( const QString &xmlString, const QCString &xsltString );
 
 	/**
@@ -80,6 +87,7 @@
 	QString m_resultString;
 	QObject *m_target;
 	const char *m_slotCompleted;
+	QMutex dataMutex;
 };
 
 KopeteXSLThread::KopeteXSLThread( const QString &xmlString, const QCString &xsltString, QObject *target, const char *slotCompleted )
@@ -93,19 +101,30 @@
 
 void KopeteXSLThread::run()
 {
+	dataMutex.lock();
 	m_resultString = xsltTransform( m_xml, m_xsl );
+	dataMutex.unlock();
+	// get back to the main thread
+	qApp->postEvent( this, new QEvent( QEvent::User ) );
+}
 
-	// Signal completion
+bool KopeteXSLThread::event( QEvent *event )
+{
+	if ( event->type() == QEvent::User )
+	{
+		dataMutex.lock();
 	if( m_target && m_slotCompleted )
 	{
 		QSignal completeSignal( m_target );
 		completeSignal.connect( m_target, m_slotCompleted );
 		completeSignal.setValue( m_resultString );
 		completeSignal.activate();
-
-		// FIXME: Why no 'delete this' if there's no slotCompleted? - Martijn
+		}
+		dataMutex.unlock();
 		delete this;
+		return true;
 	}
+	return QObject::event( event );
 }
 
 QString KopeteXSLThread::xsltTransform( const QString &xmlString, const QCString &xslCString )
--- kdenetwork-3.3.1/kopete/libkopete/ui/accountselector.cpp.tn	2004-06-03 21:22:49.000000000 +0200
+++ kdenetwork-3.3.1/kopete/libkopete/ui/accountselector.cpp	2004-11-28 18:10:19.000000000 +0100
@@ -85,6 +85,7 @@
 AccountSelector::~AccountSelector()
 {
 	kdDebug(14010) << k_funcinfo << endl;
+	delete d;
 }
 
 
--- kdenetwork-3.3.1/kopete/libkopete/ui/kopetefileconfirmdialog.cpp.tn	2004-07-17 21:10:23.000000000 +0200
+++ kdenetwork-3.3.1/kopete/libkopete/ui/kopetefileconfirmdialog.cpp	2004-11-28 18:10:19.000000000 +0100
@@ -31,7 +31,7 @@
 
 KopeteFileConfirmDialog::KopeteFileConfirmDialog(const KopeteFileTransferInfo &info,const QString& description,QWidget *parent, const char *name )
 : KDialogBase( parent, name, true, i18n( "A User Would Like to Send You a File" ),
-	KDialogBase::User1 | KDialogBase::User2, KDialogBase::User1, true, i18n( "&Accept" ), i18n( "&Refuse" ) ),
+	KDialogBase::User1 | KDialogBase::User2, KDialogBase::User1, true, i18n( "&Refuse" ), i18n( "&Accept" ) ),
 	m_info( info )
 {
 	setWFlags( WDestructiveClose );
@@ -66,7 +66,7 @@
 	}
 }
 
-void KopeteFileConfirmDialog::slotUser1()
+void KopeteFileConfirmDialog::slotUser2()
 {
 	m_emited=true;
 	KURL url(m_view->m_saveto->text());
@@ -83,7 +83,7 @@
 	close();
 }
 
-void KopeteFileConfirmDialog::slotUser2()
+void KopeteFileConfirmDialog::slotUser1()
 {
 	m_emited=true;
 	emit refused(m_info);
--- kdenetwork-3.3.1/kopete/protocols/gadu/libgadu/common.c.tn	2004-05-24 18:05:24.000000000 +0200
+++ kdenetwork-3.3.1/kopete/protocols/gadu/libgadu/common.c	2004-11-28 18:10:20.000000000 +0100
@@ -428,28 +428,91 @@
 /*
  * gg_gethostbyname() // funkcja pomocnicza
  *
- * odpowiednik gethostbyname() u¿ywaj±cy gethostbyname_r(), gdy potrzebna
- * jest wielobie¿no¶æ. chwilowo korzysta ze zwyk³ego gethostbyname().
+ * odpowiednik gethostbyname() troszcz±cy siê o wspó³bie¿no¶æ, gdy mamy do
+ * dyspozycji funkcjê gethostbyname_r().
  *
  *  - hostname - nazwa serwera
  *
- * zaalokowany bufor, który nale¿y zwolniæ lub NULL w przypadku b³êdu.
+ * zwraca wska¼nik na strukturê in_addr, któr± nale¿y zwolniæ.
  */
-struct hostent *gg_gethostbyname(const char *hostname)
+struct in_addr *gg_gethostbyname(const char *hostname)
 {
-	/* XXX u¿yæ gethostbyname_r() */
+	struct in_addr *addr = NULL;
 
-	struct hostent *hp, *hp2;
+#ifdef HAVE_GETHOSTBYNAME_R
+	char *tmpbuf = NULL, *buf = NULL;
+	struct hostent *hp = NULL, *hp2 = NULL;
+	int h_errnop, ret;
+	size_t buflen = 1024;
+	int new_errno;
+	
+	new_errno = ENOMEM;
+	
+	if (!(addr = malloc(sizeof(struct in_addr))))
+		goto cleanup;
+	
+	if (!(hp = calloc(1, sizeof(*hp))))
+		goto cleanup;
+
+	if (!(buf = malloc(buflen)))
+		goto cleanup;
+
+	tmpbuf = buf;
+	
+	while ((ret = gethostbyname_r(hostname, hp, buf, buflen, &hp2, &h_errnop)) == ERANGE) {
+		buflen *= 2;
+		
+		if (!(tmpbuf = realloc(buf, buflen)))
+			break;
+		
+		buf = tmpbuf;
+	}
+	
+	if (ret)
+		new_errno = h_errnop;
+
+	if (ret || !hp2 || !tmpbuf)
+		goto cleanup;
+	
+	memcpy(addr, hp->h_addr, sizeof(struct in_addr));
+	
+	free(buf);
+	free(hp);
+	
+	return addr;
+	
+cleanup:
+	errno = new_errno;
+	
+	if (addr)
+		free(addr);
+	if (hp)
+		free(hp);
+	if (buf)
+		free(buf);
+	
+	return NULL;
+#else
+	struct hostent *hp;
+
+	if (!(addr = malloc(sizeof(struct in_addr)))) {
+		errno = ENOMEM;
+		goto cleanup;
+	}
 
 	if (!(hp = gethostbyname(hostname)))
-		return NULL;
+		goto cleanup;
 
-	if (!(hp2 = calloc(1, sizeof(*hp))))
-		return NULL;
+	memcpy(addr, hp->h_addr, sizeof(struct in_addr));
 
-	memcpy(hp2, hp, sizeof(*hp));
+	return addr;
+	
+cleanup:
+	if (addr)
+		free(addr);
 
-	return hp2;
+	return NULL;
+#endif
 }
 
 #ifdef ASSIGN_SOCKETS_TO_THREADS
@@ -694,7 +757,7 @@
  */
 static void gg_crc32_make_table()
 {
-	uint32_t h = 0;
+	uint32_t h = 1;
 	int i, j;
 
 	memset(gg_crc32_table, 0, sizeof(gg_crc32_table));
--- kdenetwork-3.3.1/kopete/protocols/gadu/libgadu/events.c.tn	2004-05-24 18:05:24.000000000 +0200
+++ kdenetwork-3.3.1/kopete/protocols/gadu/libgadu/events.c	2004-11-28 18:10:20.000000000 +0100
@@ -59,47 +59,60 @@
 	if (!e)
 		return;
 	
-	if (e->type == GG_EVENT_MSG) {
-		free(e->event.msg.message);
-		free(e->event.msg.formats);
-		free(e->event.msg.recipients);
-	}
+	switch (e->type) {
+		case GG_EVENT_MSG:
+			free(e->event.msg.message);
+			free(e->event.msg.formats);
+			free(e->event.msg.recipients);
+			break;
 	
-	if (e->type == GG_EVENT_NOTIFY)
-		free(e->event.notify);
+		case GG_EVENT_NOTIFY:
+			free(e->event.notify);
+			break;
 	
-	if (e->type == GG_EVENT_NOTIFY60) {
-		int i;
+		case GG_EVENT_NOTIFY60:
+		{
+			int i;
 
-		for (i = 0; e->event.notify60[i].uin; i++)
-			free(e->event.notify60[i].descr);
+			for (i = 0; e->event.notify60[i].uin; i++)
+				free(e->event.notify60[i].descr);
 		
-		free(e->event.notify60);
-	}
+			free(e->event.notify60);
 
-	if (e->type == GG_EVENT_STATUS60)
-		free(e->event.status60.descr);
+			break;
+		}
+
+		case GG_EVENT_STATUS60:
+			free(e->event.status60.descr);
+			break;
 	
-	if (e->type == GG_EVENT_STATUS)
-		free(e->event.status.descr);
+		case GG_EVENT_STATUS:
+			free(e->event.status.descr);
+			break;
 
-	if (e->type == GG_EVENT_NOTIFY_DESCR) {
-		free(e->event.notify_descr.notify);
-		free(e->event.notify_descr.descr);
-	}
+		case GG_EVENT_NOTIFY_DESCR:
+			free(e->event.notify_descr.notify);
+			free(e->event.notify_descr.descr);
+			break;
 
-	if (e->type == GG_EVENT_DCC_VOICE_DATA)
-		free(e->event.dcc_voice_data.data);
+		case GG_EVENT_DCC_VOICE_DATA:
+			free(e->event.dcc_voice_data.data);
+			break;
 
-	if (e->type == GG_EVENT_PUBDIR50_SEARCH_REPLY || e->type == GG_EVENT_PUBDIR50_READ || e->type == GG_EVENT_PUBDIR50_WRITE)
-		gg_pubdir50_free(e->event.pubdir50);
+		case GG_EVENT_PUBDIR50_SEARCH_REPLY:
+		case GG_EVENT_PUBDIR50_READ:
+		case GG_EVENT_PUBDIR50_WRITE:
+			gg_pubdir50_free(e->event.pubdir50);
+			break;
 
-	if (e->type == GG_EVENT_USERLIST)
-		free(e->event.userlist.reply);
+		case GG_EVENT_USERLIST:
+			free(e->event.userlist.reply);
+			break;
 	
-	if (e->type == GG_EVENT_IMAGE_REPLY) {
-		free(e->event.image_reply.filename);
-		free(e->event.image_reply.image);
+		case GG_EVENT_IMAGE_REPLY:
+			free(e->event.image_reply.filename);
+			free(e->event.image_reply.image);
+			break;
 	}
 
 	free(e);
@@ -837,7 +850,7 @@
 
 		case GG_STATE_CONNECTING_HUB:
 		{
-			char buf[1024], *client;
+			char buf[1024], *client, *auth;
 			int res = 0, res_size = sizeof(res);
 			const char *host, *appmsg;
 
@@ -890,12 +903,18 @@
 #endif
 				appmsg = "appmsg2.asp";
 
+			auth = gg_proxy_auth();
+
 			snprintf(buf, sizeof(buf) - 1,
 				"GET %s/appsvc/%s?fmnumber=%u&version=%s&lastmsg=%d HTTP/1.0\r\n"
 				"Host: " GG_APPMSG_HOST "\r\n"
 				"User-Agent: " GG_HTTP_USERAGENT "\r\n"
 				"Pragma: no-cache\r\n"
-				"\r\n", host, appmsg, sess->uin, client, sess->last_sysmsg);
+				"%s" 
+				"\r\n", host, appmsg, sess->uin, client, sess->last_sysmsg, (auth) ? auth : "");
+
+			if (auth)
+				free(auth);
 			
 			free(client);
 
--- kdenetwork-3.3.1/kopete/protocols/gadu/libgadu/http.c.tn	2004-05-24 18:05:24.000000000 +0200
+++ kdenetwork-3.3.1/kopete/protocols/gadu/libgadu/http.c	2004-11-28 18:10:20.000000000 +0100
@@ -117,17 +117,16 @@
 		h->check = GG_CHECK_READ;
 		h->timeout = GG_DEFAULT_TIMEOUT;
 	} else {
-		struct hostent *he;
-		struct in_addr a;
+		struct in_addr *hn, a;
 
-		if (!(he = gg_gethostbyname(hostname))) {
-                        gg_debug(GG_DEBUG_MISC, "// gg_http_connect() host not found\n");
+		if (!(hn = gg_gethostbyname(hostname))) {
+			gg_debug(GG_DEBUG_MISC, "// gg_http_connect() host not found\n");
 			gg_http_free(h);
 			errno = ENOENT;
 			return NULL;
 		} else {
-			memcpy((char*) &a, he->h_addr, sizeof(a));
-			free(he);
+			a.s_addr = hn->s_addr;
+			free(hn);
 		}
 
 		if (!(h->fd = gg_connect(&a, port, 0)) == -1) {
--- kdenetwork-3.3.1/kopete/protocols/gadu/libgadu/libgadu.c.tn	2004-05-24 18:05:24.000000000 +0200
+++ kdenetwork-3.3.1/kopete/protocols/gadu/libgadu/libgadu.c	2004-11-28 18:10:20.000000000 +0100
@@ -197,18 +197,21 @@
 	if (pipe(pipes) == -1)
 		return -1;
 
-	if ((res = fork()) == -1)
+	if ((res = fork()) == -1) {
+		close(pipes[0]);
+		close(pipes[1]);
 		return -1;
+	}
 
 	if (!res) {
 		if ((a.s_addr = inet_addr(hostname)) == INADDR_NONE) {
-			struct hostent *he;
+			struct in_addr *hn;
 		
-			if (!(he = gg_gethostbyname(hostname)))
+			if (!(hn = gg_gethostbyname(hostname)))
 				a.s_addr = INADDR_NONE;
 			else {
-				memcpy((char*) &a, he->h_addr, sizeof(a));
-				free(he);
+				a.s_addr = hn->s_addr;
+				free(hn);
 			}
 		}
 
@@ -238,13 +241,13 @@
 	struct in_addr a;
 
 	if ((a.s_addr = inet_addr(d->hostname)) == INADDR_NONE) {
-		struct hostent *he;
+		struct in_addr *hn;
 		
-		if (!(he = gg_gethostbyname(d->hostname)))
+		if (!(hn = gg_gethostbyname(d->hostname)))
 			a.s_addr = INADDR_NONE;
 		else {
-			memcpy((char*) &a, he->h_addr, sizeof(a));
-			free(he);
+			a.s_addr = hn->s_addr;
+			free(hn);
 		}
 	}
 
@@ -277,9 +280,9 @@
  */
 int gg_resolve_pthread(int *fd, void **resolver, const char *hostname)
 {
-	struct gg_resolve_pthread_data *d;
+	struct gg_resolve_pthread_data *d = NULL;
 	pthread_t *tmp;
-	int pipes[2];
+	int pipes[2], new_errno;
 
 	gg_debug(GG_DEBUG_FUNCTION, "** gg_resolve_pthread(%p, %p, \"%s\");\n", fd, resolver, hostname);
 	
@@ -291,6 +294,7 @@
 
 	if (!(tmp = malloc(sizeof(pthread_t)))) {
 		gg_debug(GG_DEBUG_MISC, "// gg_resolve_pthread() out of memory for pthread id\n");
+		errno = ENOMEM;
 		return -1;
 	}
 	
@@ -300,20 +304,26 @@
 		return -1;
 	}
 
-	if (!(d = malloc(sizeof(*d))) || !(d->hostname = strdup(hostname))) {
+	if (!(d = malloc(sizeof(*d)))) {
 		gg_debug(GG_DEBUG_MISC, "// gg_resolve_pthread() out of memory\n");
-		free(tmp);
-		return -1;
+		new_errno = ENOMEM;
+		goto cleanup;
+	}
+	
+	d->hostname = NULL;
+
+	if (!(d->hostname = strdup(hostname))) {
+		gg_debug(GG_DEBUG_MISC, "// gg_resolve_pthread() out of memory\n");
+		new_errno = ENOMEM;
+		goto cleanup;
 	}
 
 	d->fd = pipes[1];
 
 	if (pthread_create(tmp, NULL, gg_resolve_pthread_thread, d)) {
 		gg_debug(GG_DEBUG_MISC, "// gg_resolve_phread() unable to create thread\n");
-		close(pipes[0]);
-		close(pipes[1]);
-		free(tmp);
-		return -1;
+		new_errno = errno;
+		goto cleanup;
 	}
 
 	gg_debug(GG_DEBUG_MISC, "// gg_resolve_pthread() %p\n", tmp);
@@ -323,6 +333,21 @@
 	*fd = pipes[0];
 
 	return 0;
+
+cleanup:
+	if (d) {
+		free(d->hostname);
+		free(d);
+	}
+
+	close(pipes[0]);
+	close(pipes[1]);
+
+	free(tmp);
+
+	errno = new_errno;
+
+	return -1;
 }
 
 #endif
@@ -396,7 +421,23 @@
 		}
 	} else
 #endif
-		res = write(sess->fd, buf, length);
+	{
+		int written = 0;
+		
+		while (written < length) {
+			res = write(sess->fd, buf + written, length - written);
+
+			if (res == -1) {
+				if (errno == EAGAIN)
+					continue;
+				else
+					break;
+			} else {
+				written += res;
+				res = written;
+			}
+		}
+	}
 
 	return res;
 }
@@ -439,6 +480,7 @@
 			gg_debug(GG_DEBUG_MISC, "// gg_recv_packet() header recv(%d,%p,%d) = %d\n", sess->fd, &h + sess->header_done, sizeof(h) - sess->header_done, ret);
 
 			if (!ret) {
+				errno = 0;
 				gg_debug(GG_DEBUG_MISC, "// gg_recv_packet() header recv() failed: connection broken\n");
 				return NULL;
 			}
@@ -707,7 +749,7 @@
 	sess->initial_status = p->status;
 	sess->callback = gg_session_callback;
 	sess->destroy = gg_free_session;
-	sess->port = (p->server_port) ? p->server_port : GG_DEFAULT_PORT;
+	sess->port = (p->server_port) ? p->server_port : ((gg_proxy_enabled) ? GG_HTTPS_PORT : GG_DEFAULT_PORT);
 	sess->server_addr = p->server_addr;
 	sess->external_port = p->external_port;
 	sess->external_addr = p->external_addr;
@@ -774,14 +816,14 @@
 
 		if (!p->server_addr || !p->server_port) {
 			if ((a.s_addr = inet_addr(hostname)) == INADDR_NONE) {
-				struct hostent *he;
+				struct in_addr *hn;
 	
-				if (!(he = gg_gethostbyname(hostname))) {
+				if (!(hn = gg_gethostbyname(hostname))) {
 					gg_debug(GG_DEBUG_MISC, "// gg_login() host \"%s\" not found\n", hostname);
 					goto fail;
 				} else {
-					memcpy((char*) &a, he->h_addr, sizeof(a));
-					free(he);
+					a.s_addr = hn->s_addr;
+					free(hn);
 				}
 			}
 		} else {
@@ -791,6 +833,9 @@
 
 		sess->hub_addr = a.s_addr;
 
+		if (gg_proxy_enabled)
+			sess->proxy_addr = a.s_addr;
+
 		if ((sess->fd = gg_connect(&a, port, 0)) == -1) {
 			gg_debug(GG_DEBUG_MISC, "// gg_login() connection failed (errno=%d, %s)\n", errno, strerror(errno));
 			goto fail;
@@ -1158,7 +1203,7 @@
 	}
 
 	/* wytnij ¶cie¿ki, zostaw tylko nazwê pliku */
-	while ((tmp = rindex(filename, '/')) || (tmp = rindex(filename, '\\')))
+	while ((tmp = strrchr(filename, '/')) || (tmp = strrchr(filename, '\\')))
 		filename = tmp + 1;
 
 	if (strlen(filename) < 1 || strlen(filename) > 1024) {
--- kdenetwork-3.3.1/kopete/protocols/gadu/libgadu/libgadu.h.tn	2004-07-17 21:10:28.000000000 +0200
+++ kdenetwork-3.3.1/kopete/protocols/gadu/libgadu/libgadu.h	2004-11-28 18:10:21.000000000 +0100
@@ -907,7 +907,7 @@
 char *gg_get_line(char **ptr);
 
 int gg_connect(void *addr, int port, int async);
-struct hostent *gg_gethostbyname(const char *hostname);
+struct in_addr *gg_gethostbyname(const char *hostname);
 char *gg_read_line(int sock, char *buf, int length);
 void gg_chomp(char *line);
 char *gg_urlencode(const char *str);
@@ -943,7 +943,7 @@
 #define GG_DEFAULT_PROTOCOL_VERSION 0x20
 #define GG_DEFAULT_TIMEOUT 30
 #define GG_HAS_AUDIO_MASK 0x40000000
-#define GG_LIBGADU_VERSION "1.4.20040512"
+#define GG_LIBGADU_VERSION "CVS"

 #define GG_DEFAULT_DCC_PORT 1550

--- kdenetwork-3.3.1/kopete/protocols/gadu/libgadu/pubdir.c.tn	2004-05-24 18:05:24.000000000 +0200
+++ kdenetwork-3.3.1/kopete/protocols/gadu/libgadu/pubdir.c	2004-11-28 18:10:21.000000000 +0100
@@ -476,7 +476,7 @@
 		"Pragma: no-cache\r\n"
 		"\r\n";
 
-	if (!(h = gg_http_connect(GG_APPMSG_HOST, GG_APPMSG_PORT, async, "POST", "/appsvc/regtoken.asp", query))) {
+	if (!(h = gg_http_connect(GG_REGISTER_HOST, GG_REGISTER_PORT, async, "POST", "/appsvc/regtoken.asp", query))) {
 		gg_debug(GG_DEBUG_MISC, "=> token, gg_http_connect() failed mysteriously\n");
 		return NULL;
 	}
@@ -564,7 +564,7 @@
 
 		free(url);
 	
-		if (!(h2 = gg_http_connect(GG_APPMSG_HOST, GG_APPMSG_PORT, h->async, "GET", path, "Host: " GG_APPMSG_HOST "\r\nUser-Agent: " GG_HTTP_USERAGENT "\r\n\r\n"))) {
+		if (!(h2 = gg_http_connect(GG_REGISTER_HOST, GG_REGISTER_PORT, h->async, "GET", path, "Host: " GG_REGISTER_HOST "\r\nUser-Agent: " GG_HTTP_USERAGENT "\r\n\r\n"))) {
 			gg_debug(GG_DEBUG_MISC, "=> token, gg_http_connect() failed mysteriously\n");
 			free(path);
 			free(tokenid);
--- kdenetwork-3.3.1/kopete/protocols/irc/ui/channellist.cpp.tn	2004-07-17 21:10:29.000000000 +0200
+++ kdenetwork-3.3.1/kopete/protocols/irc/ui/channellist.cpp	2004-11-28 18:10:23.000000000 +0100
@@ -103,7 +103,6 @@
 	QToolTip::add( channelSearch, i18n( "You may search for channels on the IRC server for a text string entered here." ) );
 	QWhatsThis::add( channelSearch, i18n( "You may search for channels on the IRC server for a text string entered here.  For instance, you may type 'linux' to find channels that have something to do with linux." ) );
 	mSearchButton->setText( i18n( "S&earch" ) );
-	mSearchButton->setAccel( QKeySequence( i18n( "Alt+E" ) ) );
 	QToolTip::add( mSearchButton, i18n( "Perform a channel search." ) );
 	QWhatsThis::add( mSearchButton, i18n( "Perform a channel search.  Please be patient, as this can be slow depending on the number of channels on the server." ) );
 	QToolTip::add( mChannelList, i18n( "Double click on a channel to select it." ) );
--- kdenetwork-3.3.1/kopete/protocols/oscar/oscarsocket/oscarconnection.cpp.tn	2004-07-17 21:10:33.000000000 +0200
+++ kdenetwork-3.3.1/kopete/protocols/oscar/oscarsocket/oscarconnection.cpp	2004-11-28 18:10:34.000000000 +0100
@@ -220,7 +220,12 @@
 #endif
 
 	kdDebug(14150) << k_funcinfo << "SOCKET ERROR: " << errornum << endl;
-	mSocket->closeNow();
+	// in case of a socket error, the socket may already be closed,
+	// and if it is, the closed() signal may not have been emitted.
+	//mSocket->closeNow();
+	// pretend this was expected, or else autoreconnect kicks in and
+	// we end up in an infinite loop if, say, DNS is failing.
+	emit socketClosed(connectionName(), true);
 	emit socketError(connectionName(), errornum);
 }
 
--- kdenetwork-3.3.1/kopete/protocols/oscar/oscarsocket/oscarsocket.aim.cpp.tn	2004-06-25 11:10:17.000000000 +0200
+++ kdenetwork-3.3.1/kopete/protocols/oscar/oscarsocket/oscarsocket.aim.cpp	2004-11-28 18:10:34.000000000 +0100
@@ -45,7 +45,7 @@
 	outbuf.addSnac(0x0017,0x0002,0x0000,0x00000000);
 	outbuf.addTLV(0x0001,getSN().length(),getSN().latin1());
 
-	char digest[16];
+	char digest[17];
 	encodePassword(&digest[0]);
 	digest[16] = '\0';  //do this so that addTLV sees a NULL-terminator
 
--- kdenetwork-3.3.1/kopete/protocols/gadu/gaduregisteraccount.cpp.tn	2005-07-21 14:44:03.000000000 +0200
+++ kdenetwork-3.3.1/kopete/protocols/gadu/gaduregisteraccount.cpp	2005-07-21 14:46:53.000000000 +0200
@@ -165,29 +165,22 @@
 GaduRegisterAccount::registrationError(  const QString& title,  const QString& what )
 {
 	updateStatus( i18n( "Registration failed: %1" ).arg( what ) );
-	KMessageBox::sorry( this, what, title );
+	KMessageBox::sorry( this, "Registration was unsucessful, please try again.", title ); 
 
 	disconnect( this, SLOT( displayToken( QPixmap, QString ) ) );
 	disconnect( this, SLOT( registrationDone(  const QString&,  const QString& ) ) );
 	disconnect( this, SLOT( registrationError(  const QString&,  const QString& ) ) );
 	disconnect( this, SLOT( updateStatus( const QString ) ) );
 
-// it is set to deleteLater, in case of error
-	cRegister = NULL;
 	ui->valueVerificationSequence->setDisabled( true );
 	ui->valueVerificationSequence->setText( "" );
 	enableButton( User1, false );
 	updateStatus( "" );
 
-	cRegister = new RegisterCommand( this );
-
-	connect( cRegister, SIGNAL( tokenRecieved( QPixmap, QString ) ), SLOT( displayToken( QPixmap, QString ) ) );
-	connect( cRegister, SIGNAL( done(  const QString&,  const QString& ) ), SLOT( registrationDone(  const QString&,  const QString& ) ) );
-	connect( cRegister, SIGNAL( error(  const QString&,  const QString& ) ), SLOT( registrationError(  const QString&,  const QString& ) ) );
-	connect( cRegister, SIGNAL( operationStatus( const QString ) ), SLOT( updateStatus( const QString ) ) );
-
-	updateStatus( i18n( "Retrieving token" ) );
-	cRegister->requestToken();
+	// emit UIN 0, to enable 'register new account' button again in dialog below 
+	emit registeredNumber( 0, QString( "" ) ); 
+	slotClose();
+	deleteLater(); 
 }
 
 void
--- kdenetwork-3.3.1/kopete/protocols/gadu/gadueditaccount.cpp.tn	2005-07-21 14:41:37.000000000 +0200
+++ kdenetwork-3.3.1/kopete/protocols/gadu/gadueditaccount.cpp	2005-07-21 14:43:35.000000000 +0200
@@ -100,10 +100,16 @@
 }
 
 void 
-GaduEditAccount::newUin( unsigned int uni, QString password )
+GaduEditAccount::newUin( unsigned int uin, QString password )
 {
-	loginEdit_->setText( QString::number( uni ) );
-	passwordEdit_->setText( password );
+	if ( uin ) {
+		loginEdit_->setText( QString::number( uin ) ); 
+		passwordEdit_->setText( password );
+	}
+	else {
+		// registration failed, enable button again
+		registerNew->setDisabled( false );
+	} 
 }
 
 bool 

post-3.3.2-kdenetwork-libgadu.patch:
 common.c   |  140 ++++++++++++++++++++++++++-----------------------
 compat.h   |    3 -
 dcc.c      |  114 +++++++++++++++++++++++++++++----------
 events.c   |  112 +++++++++++++++++++++++++++++----------
 http.c     |   35 ++++++------
 libgadu.c  |  159 +++++++++++++++++++++++++++++++++++--------------------
 libgadu.h  |   69 +++++++++++++-----------
 pubdir.c   |  174 +++++++++++++++++++++++++++++++++++++++----------------------
 pubdir50.c |    5 +
 9 files changed, 520 insertions(+), 291 deletions(-)

--- NEW FILE post-3.3.2-kdenetwork-libgadu.patch ---
Index: kopete/protocols/gadu/libgadu/libgadu.h
===================================================================
--- kopete/protocols/gadu/libgadu/libgadu.h	(.../KDE_3_3_BRANCH/kdenetwork/kopete/protocols/gadu/libgadu)	(revision 367579)
+++ kopete/protocols/gadu/libgadu/libgadu.h	(.../KDE/3.3/kdenetwork/kopete/protocols/gadu/libgadu)	(working copy)
@@ -19,7 +19,8 @@
  *
  *  You should have received a copy of the GNU Lesser General Public
  *  License along with this program; if not, write to the Free Software
- *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307,
+ *  USA.
  */
 
 #ifndef __GG_LIBGADU_H
@@ -32,15 +33,15 @@
 extern "C" {
 #endif
 
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
+#endif
+	
 #include <libgadu-config.h>
 #include <sys/types.h>
 #include <stdio.h>
 #include <stdarg.h>
 
-#ifdef HAVE_STDINT_H
-#include <stdint.h>
-#endif
-
 #ifdef __GG_LIBGADU_HAVE_OPENSSL
 #include <openssl/ssl.h>
 #endif
@@ -56,10 +57,10 @@
  * ogólna struktura opisuj±ca ró¿ne sesje. przydatna w klientach.
  */
 #define gg_common_head(x) \
-        int fd;                 /* podgl±dany deskryptor */ \
-        int check;              /* sprawdzamy zapis czy odczyt */ \
-        int state;              /* aktualny stan maszynki */ \
-        int error;              /* kod b³êdu dla GG_STATE_ERROR */ \
+	int fd;			/* podgl±dany deskryptor */ \
+	int check;		/* sprawdzamy zapis czy odczyt */ \
+	int state;		/* aktualny stan maszynki */ \
+	int error;		/* kod b³êdu dla GG_STATE_ERROR */ \
 	int type;		/* rodzaj sesji */ \
 	int id;			/* identyfikator */ \
 	int timeout;		/* sugerowany timeout w sekundach */ \
@@ -110,7 +111,7 @@
 
 	char *recv_buf;		/* bufor na otrzymywane pakiety */
 	int recv_done;		/* ile ju¿ wczytano do bufora */
-        int recv_left;		/* i ile jeszcze trzeba wczytaæ */
+	int recv_left;		/* i ile jeszcze trzeba wczytaæ */
 
 	int protocol_version;	/* wersja u¿ywanego protoko³u */
 	char *client_version;	/* wersja u¿ywanego klienta */
@@ -149,17 +150,17 @@
 struct gg_http {
 	gg_common_head(struct gg_http)
 
-        int async;              /* czy po³±czenie asynchroniczne */
+	int async;              /* czy po³±czenie asynchroniczne */
 	int pid;                /* pid procesu resolvera */
 	int port;               /* port, z którym siê ³±czymy */
 
-        char *query;            /* bufor zapytania http */
-        char *header;           /* bufor nag³ówka */
-        int header_size;        /* rozmiar wczytanego nag³ówka */
-        char *body;             /* bufor otrzymanych informacji */
-        unsigned int body_size; /* oczekiwana ilo¶æ informacji */
+	char *query;            /* bufor zapytania http */
+	char *header;           /* bufor nag³ówka */
+	int header_size;        /* rozmiar wczytanego nag³ówka */
+	char *body;             /* bufor otrzymanych informacji */
+	unsigned int body_size; /* oczekiwana ilo¶æ informacji */
 
-        void *data;             /* dane danej operacji http */
+	void *data;             /* dane danej operacji http */
 
 	char *user_data;	/* dane u¿ytkownika, nie s± zwalniane przez gg_http_free() */
 
@@ -264,27 +265,27 @@
  * opisuje stan asynchronicznej maszyny.
  */
 enum gg_state_t {
-        /* wspólne */
-        GG_STATE_IDLE = 0,		/* nie powinno wyst±piæ. */
-        GG_STATE_RESOLVING,             /* wywo³a³ gethostbyname() */
+		/* wspólne */
+	GG_STATE_IDLE = 0,		/* nie powinno wyst±piæ. */
+	GG_STATE_RESOLVING,             /* wywo³a³ gethostbyname() */
 	GG_STATE_CONNECTING,            /* wywo³a³ connect() */
 	GG_STATE_READING_DATA,		/* czeka na dane http */
 	GG_STATE_ERROR,			/* wyst±pi³ b³±d. kod w x->error */
 
-        /* gg_session */
+		/* gg_session */
 	GG_STATE_CONNECTING_HUB,	/* wywo³a³ connect() na huba */
 	GG_STATE_CONNECTING_GG,         /* wywo³a³ connect() na serwer */
 	GG_STATE_READING_KEY,           /* czeka na klucz */
 	GG_STATE_READING_REPLY,         /* czeka na odpowied¼ */
 	GG_STATE_CONNECTED,             /* po³±czy³ siê */
 
-        /* gg_http */
+		/* gg_http */
 	GG_STATE_SENDING_QUERY,		/* wysy³a zapytanie http */
 	GG_STATE_READING_HEADER,	/* czeka na nag³ówek http */
 	GG_STATE_PARSING,               /* przetwarza dane */
 	GG_STATE_DONE,                  /* skoñczy³ */
 
-	/* gg_dcc */
+		/* gg_dcc */
 	GG_STATE_LISTENING,		/* czeka na po³±czenia */
 	GG_STATE_READING_UIN_1,		/* czeka na uin peera */
 	GG_STATE_READING_UIN_2,		/* czeka na swój uin */
@@ -349,8 +350,9 @@
 	uint16_t external_port;		/* port widziany na zewnatrz */
 	int tls;			/* czy ³±czymy po TLS? */
 	int image_size;			/* maksymalny rozmiar obrazka w KiB */
+	int era_omnix;			/* czy udawaæ klienta era omnix? */
 
-	char dummy[7 * sizeof(int)];	/* miejsce na kolejnych 8 zmiennych,
+	char dummy[6 * sizeof(int)];	/* miejsce na kolejnych 6 zmiennych,
 					 * ¿eby z dodaniem parametru nie 
 					 * zmienia³ siê rozmiar struktury */
 };
@@ -499,8 +501,8 @@
  */
 struct gg_event {
 	int type;	/* rodzaj zdarzenia -- gg_event_t */
-        union {		/* @event */
-                struct gg_notify_reply *notify;	/* informacje o li¶cie kontaktów -- GG_EVENT_NOTIFY */
+	union {		/* @event */
+		struct gg_notify_reply *notify;	/* informacje o li¶cie kontaktów -- GG_EVENT_NOTIFY */
 
 		enum gg_failure_t failure;	/* b³±d po³±czenia -- GG_EVENT_FAILURE */
 
@@ -521,20 +523,20 @@
 			
 			int formats_length;	/* d³ugo¶æ informacji o formatowaniu tekstu */
 			void *formats;		/* informacje o formatowaniu tekstu */
-                } msg;
+		} msg;
 		
 		struct {			/* @notify_descr informacje o li¶cie kontaktów z opisami stanu -- GG_EVENT_NOTIFY_DESCR */
 			struct gg_notify_reply *notify;	/* informacje o li¶cie kontaktów */
 			char *descr;		/* opis stanu */
 		} notify_descr;
 		
-                struct {			/* @status zmiana stanu -- GG_EVENT_STATUS */
+		struct {			/* @status zmiana stanu -- GG_EVENT_STATUS */
 			uin_t uin;		/* numer */
 			uint32_t status;	/* nowy stan */
 			char *descr;		/* opis stanu */
 		} status;
 
-                struct {			/* @status60 zmiana stanu -- GG_EVENT_STATUS60 */
+		struct {			/* @status60 zmiana stanu -- GG_EVENT_STATUS60 */
 			uin_t uin;		/* numer */
 			int status;	/* nowy stan */
 			uint32_t remote_ip;	/* adres ip */
@@ -747,6 +749,7 @@
 /* przypomnienie has³a e-mailem */
 struct gg_http *gg_remind_passwd(uin_t uin, int async);
 struct gg_http *gg_remind_passwd2(uin_t uin, const char *tokenid, const char *tokenval, int async);
+struct gg_http *gg_remind_passwd3(uin_t uin, const char *email, const char *tokenid, const char *tokenval, int async);
 #define gg_remind_passwd_watch_fd gg_pubdir_watch_fd
 #define gg_remind_passwd_free gg_pubdir_free
 #define gg_free_remind_passwd gg_pubdir_free
@@ -812,6 +815,7 @@
 struct gg_dcc *gg_dcc_voice_chat(uint32_t ip, uint16_t port, uin_t my_uin, uin_t peer_uin);
 void gg_dcc_set_type(struct gg_dcc *d, int type);
 int gg_dcc_fill_file_info(struct gg_dcc *d, const char *filename);
+int gg_dcc_fill_file_info2(struct gg_dcc *d, const char *filename, const char *local_filename);
 int gg_dcc_voice_send(struct gg_dcc *d, char *buf, int length);
 
 #define GG_DCC_VOICE_FRAME_LENGTH 195
@@ -939,10 +943,11 @@
 #define GG_HTTPS_PORT 443
 #define GG_HTTP_USERAGENT "Mozilla/4.7 [en] (Win98; I)"
 
-#define GG_DEFAULT_CLIENT_VERSION "6, 0, 0, 132"
-#define GG_DEFAULT_PROTOCOL_VERSION 0x20
+#define GG_DEFAULT_CLIENT_VERSION "6, 1, 0, 158"
+#define GG_DEFAULT_PROTOCOL_VERSION 0x24
 #define GG_DEFAULT_TIMEOUT 30
 #define GG_HAS_AUDIO_MASK 0x40000000
+#define GG_ERA_OMNIX_MASK 0x04000000
 #define GG_LIBGADU_VERSION "CVS"
 
 #define GG_DEFAULT_DCC_PORT 1550
@@ -1204,8 +1209,10 @@
 
 #define GG_SEND_MSG_ACK 0x0005
 
+#define GG_ACK_BLOCKED 0x0001
 #define GG_ACK_DELIVERED 0x0002
[...1736 lines suppressed...]
 		return -1;
 	}
 
@@ -159,7 +177,7 @@
 	gg_dcc_fill_filetime(st.st_atime, d->file_info.atime);
 	gg_dcc_fill_filetime(st.st_mtime, d->file_info.mtime);
 	gg_dcc_fill_filetime(st.st_ctime, d->file_info.ctime);
-	
+
 	d->file_info.size = gg_fix32(st.st_size);
 	d->file_info.mode = gg_fix32(0x20);	/* FILE_ATTRIBUTE_ARCHIVE */
 
@@ -173,14 +191,40 @@
 
 	for (i = 0, p = name; i < 8 && p < ext; i++, p++)
 		d->file_info.short_filename[i] = toupper(name[i]);
-	
+
+	if (i == 8 && p < ext) {
+		d->file_info.short_filename[6] = '~';
+		d->file_info.short_filename[7] = '1';
+	}
+
 	if (strlen(ext) > 0) {
 		for (j = 0; *ext && j < 4; j++, p++)
 			d->file_info.short_filename[i + j] = toupper(ext[j]);
-		
 	}
 
-	gg_debug(GG_DEBUG_MISC, "// gg_dcc_fill_file_info() short name \"%s\", dos name \"%s\"\n", name, d->file_info.short_filename);
+	for (q = d->file_info.short_filename; *q; q++) {
+		if (*q == 185) {
+			*q = 165;
+		} else if (*q == 230) {
+			*q = 198;
+		} else if (*q == 234) {
+			*q = 202;
+		} else if (*q == 179) {
+			*q = 163;
+		} else if (*q == 241) {
+			*q = 209;
+		} else if (*q == 243) {
+			*q = 211;
+		} else if (*q == 156) {
+			*q = 140;
+		} else if (*q == 159) {
+			*q = 143;
+		} else if (*q == 191) {
+			*q = 175;
+		}
+	}
+	
+	gg_debug(GG_DEBUG_MISC, "// gg_dcc_fill_file_info2() short name \"%s\", dos name \"%s\"\n", name, d->file_info.short_filename);
 	strncpy(d->file_info.filename, name, sizeof(d->file_info.filename) - 1);
 
 	return 0;
@@ -345,9 +389,9 @@
 {
 	struct gg_dcc *c;
 	struct sockaddr_in sin;
-	int sock, bound = 0;
+	int sock, bound = 0, errno2;
 	
-        gg_debug(GG_DEBUG_FUNCTION, "** gg_create_dcc_socket(%d, %d);\n", uin, port);
+	gg_debug(GG_DEBUG_FUNCTION, "** gg_create_dcc_socket(%d, %d);\n", uin, port);
 	
 	if (!uin) {
 		gg_debug(GG_DEBUG_MISC, "// gg_create_dcc_socket() invalid arguments\n");
@@ -374,6 +418,7 @@
 		else {
 			if (++port == 65535) {
 				gg_debug(GG_DEBUG_MISC, "// gg_create_dcc_socket() no free port found\n");
+				close(sock);
 				return NULL;
 			}
 		}
@@ -381,6 +426,9 @@
 
 	if (listen(sock, 10)) {
 		gg_debug(GG_DEBUG_MISC, "// gg_create_dcc_socket() unable to listen (%s)\n", strerror(errno));
+		errno2 = errno;
+		close(sock);
+		errno = errno2;
 		return NULL;
 	}
 	
@@ -389,13 +437,13 @@
 	if (!(c = malloc(sizeof(*c)))) {
 		gg_debug(GG_DEBUG_MISC, "// gg_create_dcc_socket() not enough memory for struct\n");
 		close(sock);
-                return NULL;
+		return NULL;
 	}
 	memset(c, 0, sizeof(*c));
 
 	c->port = c->id = port;
 	c->fd = sock;
-        c->type = GG_SESSION_DCC_SOCKET;
+	c->type = GG_SESSION_DCC_SOCKET;
 	c->uin = uin;
 	c->timeout = -1;
 	c->state = GG_STATE_LISTENING;
@@ -403,7 +451,6 @@
 	c->callback = gg_dcc_callback;
 	c->destroy = gg_dcc_free;
 	
-	gg_dcc_ip = INADDR_ANY;	
 	return c;
 }
 
@@ -429,6 +476,7 @@
 	gg_debug(GG_DEBUG_FUNCTION, "++ gg_dcc_voice_send(%p, %p, %d);\n", d, buf, length);
 	if (!d || !buf || length < 0 || d->type != GG_SESSION_DCC_VOICE) {
 		gg_debug(GG_DEBUG_MISC, "// gg_dcc_voice_send() invalid argument\n");
+		errno = EINVAL;
 		return -1;
 	}
 
@@ -500,7 +548,7 @@
 	struct gg_event *e;
 	int foo;
 
-        gg_debug(GG_DEBUG_FUNCTION, "** gg_dcc_watch_fd(%p);\n", h);
+	gg_debug(GG_DEBUG_FUNCTION, "** gg_dcc_watch_fd(%p);\n", h);
 	
 	if (!h || (h->type != GG_SESSION_DCC && h->type != GG_SESSION_DCC_SOCKET && h->type != GG_SESSION_DCC_SEND && h->type != GG_SESSION_DCC_GET && h->type != GG_SESSION_DCC_VOICE)) {
 		gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() invalid argument\n");
@@ -508,12 +556,12 @@
 		return NULL;
 	}
 
-        if (!(e = (void*) calloc(1, sizeof(*e)))) {
+	if (!(e = (void*) calloc(1, sizeof(*e)))) {
 		gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() not enough memory\n");
-                return NULL;
-        }
+		return NULL;
+	}
 
-        e->type = GG_EVENT_NONE;
+	e->type = GG_EVENT_NONE;
 
 	if (h->type == GG_SESSION_DCC_SOCKET) {
 		struct sockaddr_in sin;
@@ -860,7 +908,6 @@
 					e->event.dcc_voice_data.length = h->chunk_size;
 					h->state = GG_STATE_READING_VOICE_HEADER;
 					h->voice_buf = NULL;
-				
 				}
 
 				h->check = GG_CHECK_READ;
@@ -1056,6 +1103,15 @@
 					utmp = sizeof(buf);
 				
 				gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() offset=%d, size=%d\n", h->offset, h->file_info.size);
+
+				/* koniec pliku? */
+				if (h->file_info.size == 0) {
+					gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() read() reached eof on empty file\n");
+					e->type = GG_EVENT_DCC_DONE;
+
+					return e;
+				}
+
 				lseek(h->file_fd, h->offset, SEEK_SET);
 
 				size = read(h->file_fd, buf, utmp);
@@ -1213,7 +1269,7 @@
  */
 void gg_dcc_free(struct gg_dcc *d)
 {
-        gg_debug(GG_DEBUG_FUNCTION, "** gg_dcc_free(%p);\n", d);
+	gg_debug(GG_DEBUG_FUNCTION, "** gg_dcc_free(%p);\n", d);
 	
 	if (!d)
 		return;
Index: kopete/protocols/gadu/libgadu/pubdir50.c
===================================================================
--- kopete/protocols/gadu/libgadu/pubdir50.c	(.../KDE_3_3_BRANCH/kdenetwork/kopete/protocols/gadu/libgadu)	(revision 367579)
+++ kopete/protocols/gadu/libgadu/pubdir50.c	(.../KDE/3.3/kdenetwork/kopete/protocols/gadu/libgadu)	(working copy)
@@ -14,7 +14,8 @@
  *
  *  You should have received a copy of the GNU Lesser General Public
  *  License along with this program; if not, write to the Free Software
- *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307,
+ *  USA.
  */
 
 #include <errno.h>
@@ -265,7 +266,7 @@
 
 	if (!e || !packet) {
 		gg_debug(GG_DEBUG_MISC, "// gg_pubdir50_handle_reply() invalid arguments\n");
-		errno = EINVAL;
+		errno = EFAULT;
 		return -1;
 	}
 


Index: kdenetwork.spec
===================================================================
RCS file: /cvs/dist/rpms/kdenetwork/FC-3/kdenetwork.spec,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -r1.45 -r1.46
--- kdenetwork.spec	4 Jul 2005 13:14:17 -0000	1.45
+++ kdenetwork.spec	21 Jul 2005 20:08:44 -0000	1.46
@@ -9,7 +9,7 @@
 
 Name: kdenetwork
 Version: 3.3.1
-Release: 3.1
+Release: 3.2
 Summary: K Desktop Environment - Network Applications
 Epoch: 7
 Group: Applications/Internet
@@ -30,6 +30,11 @@
 Patch5: kdenetwork-3.3.0-ksirc.patch
 Patch7: kdenetwork-3.3-cvs.patch
 Patch8: kdenetwork-3.3.1-kopete-msn-login.patch
+Patch9: kdenetwork-3.3.1-kopete-gadu.patch
+Patch10: kdenetwork-3.4.1-kopete-libgadu-va_copy.patch
+
+# CVE CAN-2005-1852, libgadu vulnerabilities
+Patch100: post-3.3.2-kdenetwork-libgadu.patch
 
 Requires: kdelibs >= 6:%{version}
 Requires: kdebase >= 6:%{version}
@@ -79,6 +84,9 @@
 %patch5 -p1 -b .ksirc
 %patch7 -p1 -b .cvs
 %patch8 -p1 -b .msn
+%patch8 -p1 -b .kopete-gadu
+%patch9 -p1 -b .libgadu-va_copy
+%patch100 -p0 -b .CAN-2005-1852
 
 find -name CVS | xargs rm -rf 
 
@@ -320,6 +328,13 @@
 
 
 %changelog
+* Thu Jul 21 2005 Than Ngo <than redhat com> 7:3.3.1-3.2 
+- fix crash in kopete
+- apply patch to fix libgadu vulnerabilities #163811, CVE CAN-2005-1852
+  thank to kde security team
+- backport patch to fix annoying problem with registration
+  dialog not able to register/retrieve token due to network problems.
+
 * Mon Jul 04 2005 Than Ngo <than redhat com> 7:3.3.1-3.1 
 - add backported patch to fix Kopete MSN login #161707
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]