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

Proposed change to ekg



Hi,

Attached is an interdiff of changes in ekg which I plan to upload to
sarge-proposed-updates.

Basically, the problem is that:
 - recent change in GG servers behavior,
 - together with two bugs in ekg,
completly broke new account registration and password changes in ekg
(libgadu is unaffected). More info in the bug report mentioned in
changelog.

The changes mitigate the problem for the users, while being relatively
unintrusive. (The set/longjmp stuff, while strange, was taken directly
from libjpeg manual as recommended.)

Do you think it would be a good idea to upload such changes to
stable-proposed-updates?

Marcin
-- 
Marcin Owsiany <porridge@debian.org>             http://marcin.owsiany.pl/
GnuPG: 1024D/60F41216  FE67 DA2D 0ACA FC5E 3F75  D6F6 3A0D 8AA0 60F4 1216
diff -u ekg-1.5+20050411/debian/changelog ekg-1.5+20050411/debian/changelog
--- ekg-1.5+20050411/debian/changelog	2005-07-19 01:22:50.530519304 +0200
+++ ekg-1.5+20050411/debian/changelog	2006-03-07 20:20:52.928886120 +0100
@@ -1,3 +1,13 @@
+ekg (1:1.5+20050411-6) stable; urgency=medium
+
+  * An upload to mitigate changes in tokens sent by GG servers Closes: #355257
+    - use better libjpeg error handling than the default exit()
+    - fix preprocessor commands to make it possible to download the token when
+      built with libjpeg
+    - add a note to README.Debian on how to use tokens
+
+ -- Marcin Owsiany <porridge@debian.org>  Tue,  7 Mar 2006 20:12:05 +0100
+
 ekg (1:1.5+20050411-5) stable-security; urgency=high
 
   * Security upload
diff -u ekg-1.5+20050411/debian/README.Debian ekg-1.5+20050411/debian/README.Debian
--- ekg-1.5+20050411/debian/README.Debian	2005-07-19 01:08:36.629332016 +0200
+++ ekg-1.5+20050411/debian/README.Debian	2006-03-07 20:25:32.474388744 +0100
@@ -61,0 +62,13 @@
+
+Token support
+-------------
+
+ At the beginning of 2006 the GG servers changed from JPEG tokens to GIFs, which
+ breaks token OCR support in ekg.  You should now view them with an external
+ program, after disabling OCR with:
+ 
+ /set display_token 0
+ /save
+
+ -- Marcin Owsiany <porridge@debian.org>, Tue, 07 Mar 2006 20:21:28 +0100
+
only in patch2:
unchanged:
--- ekg-1.5+20050411.orig/src/events.c	2005-04-09 23:08:36.000000000 +0200
+++ ekg-1.5+20050411/src/events.c	2006-03-07 20:11:55.752549336 +0100
@@ -33,6 +33,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <setjmp.h>
 #include <unistd.h>
 
 #include "commands.h"
@@ -1499,6 +1500,21 @@
 	return NULL;
 }
 
+#ifdef HAVE_LIBJPEG
+
+struct ekg_jpeg_error_mgr {
+	struct jpeg_error_mgr pub;
+	jmp_buf setjmp_buffer;
+};
+
+void ekg_jpeg_error_exit(j_common_ptr j)
+{
+	struct ekg_jpeg_error_mgr *e = (struct ekg_jpeg_error_mgr *) j->err;
+	/* Return control to the setjmp point */
+	longjmp(e->setjmp_buffer, 1);
+}
+#endif
+
 /*
  * handle_token()
  *
@@ -1552,7 +1568,7 @@
 #ifdef HAVE_LIBJPEG
 	if (config_display_token) {
 		struct jpeg_decompress_struct j;
-		struct jpeg_error_mgr e;
+		struct ekg_jpeg_error_mgr e;
 		JSAMPROW buf[1];
 		int size;
 		char *token, *tmp;
@@ -1564,7 +1580,18 @@
 			goto fail;
 		}
 
-		j.err = jpeg_std_error(&e);
+		j.err = jpeg_std_error(&e.pub);
+		e.pub.error_exit = ekg_jpeg_error_exit;
+		/* Establish the setjmp return context for ekg_jpeg_error_exit to use. */
+		if (setjmp(e.setjmp_buffer)) {
+			char buf[JMSG_LENGTH_MAX];
+			/* If we ended up over here, then it means some call below called longjmp. */
+			(e.pub.format_message)((j_common_ptr)&j, buf);
+			print("token_failed", buf);
+			jpeg_destroy_decompress(&j);
+			fclose(f);
+			goto fail;
+		}
 		jpeg_create_decompress(&j);
 		jpeg_stdio_src(&j, f);
 		jpeg_read_header(&j, TRUE);
@@ -1606,7 +1633,7 @@
 		
 		unlink(file);
 	} else
-#else	/* HAVE_LIBJPEG */
+#endif	/* HAVE_LIBJPEG */
 	{
 		char *file2 = saprintf("%s.jpg", file);
 
@@ -1617,7 +1644,6 @@
 
 		xfree(file2);
 	}
-#endif	/* HAVE_LIBJPEG */
 
 #else	/* HAVE_MKSTEMP */
 	print("token_unsupported");

Attachment: signature.asc
Description: Digital signature


Reply to: