changeset 30631:738741a7a692

jabber: Exclude ASCII 127 (Delete) from allowed SASLprep characters Tested with libidn, so changed it for the non-libidn code. Also, disable a test that cannot succeed without libidn (since it contains a vulgar 1/2).
author Paul Aurich <paul@darkrain42.org>
date Thu, 17 Jun 2010 21:21:30 +0000
parents 7227c51730b0
children 545ce15b619f 51d5ec7b1699
files libpurple/protocols/jabber/jutil.c libpurple/tests/test_jabber_scram.c
diffstat 2 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/jabber/jutil.c	Thu Jun 17 19:17:32 2010 +0000
+++ b/libpurple/protocols/jabber/jutil.c	Thu Jun 17 21:21:30 2010 +0000
@@ -303,8 +303,10 @@
 
 	c = (const guchar *)in;
 	for ( ; *c; ++c) {
-		if (*c > 0x7f ||
+		if (*c > 0x7f || /* Non-ASCII characters */
+				*c == 0x7f || /* ASCII Delete character */
 				(*c < 0x20 && *c != '\t' && *c != '\n' && *c != '\r'))
+					/* ASCII control characters */
 			return NULL;
 	}
 
--- a/libpurple/tests/test_jabber_scram.c	Thu Jun 17 19:17:32 2010 +0000
+++ b/libpurple/tests/test_jabber_scram.c	Thu Jun 17 21:21:30 2010 +0000
@@ -89,11 +89,13 @@
 			"c=biws,r=H7yDYKAWBCrM2Fa5SxGa4iezFPVDPpDUcGxPkH3RzP,p=pXkak78EuwwOEwk2/h/OzD7NkEI=",
 			"v=ldX4EBNnOgDnNTOCmbSfBHAUCOs=");
 
+#ifdef USE_IDN
 	assert_successful_exchange("pass½word", "GNb2HsNI7VnTv8ABsE5AnY8W",
 			"n=paul,r=GNb2HsNI7VnTv8ABsE5AnY8W",
 			"r=GNb2HsNI7VnTv8ABsE5AnY8W/w/I3eRKM0I7jxFWOH,s=ysAriUjPzFqOXnMQ,i=4096",
 			"c=biws,r=GNb2HsNI7VnTv8ABsE5AnY8W/w/I3eRKM0I7jxFWOH,p=n/CtgdWjOYnLQ4m9Na+wPn9D2uY=",
 			"v=4TkZwKWy6JHNmrUbU2+IdAaXtos=");
+#endif
 }
 END_TEST