pidgin: 63b644ac: jabber: Exclude ASCII 127 (Delete) from ...

darkrain42 at pidgin.im darkrain42 at pidgin.im
Thu Jun 17 17:25:32 EDT 2010


-----------------------------------------------------------------
Revision: 63b644ac7791059c9fad6128d17bccebca8ad71a
Ancestor: 36a2252d33b7a01e01f00ac7599f91059951e47e
Author: darkrain42 at pidgin.im
Date: 2010-06-17T21:21:30
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/63b644ac7791059c9fad6128d17bccebca8ad71a

Modified files:
        libpurple/protocols/jabber/jutil.c
        libpurple/tests/test_jabber_scram.c

ChangeLog: 

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).

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/jutil.c	e235b25d5f555565bc0dc271b36aa49633e86337
+++ libpurple/protocols/jabber/jutil.c	46a9ecb1259d7c6faae8b27a3eff569172a67acd
@@ -303,8 +303,10 @@ char *jabber_saslprep(const char *in)
 
 	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;
 	}
 
============================================================
--- libpurple/tests/test_jabber_scram.c	5c76e6cb39a12cd0ec17ad2658af55ac4a184351
+++ libpurple/tests/test_jabber_scram.c	706c0804fce2556818a6568708190eae99da1209
@@ -89,11 +89,13 @@ START_TEST(test_mech)
 			"c=biws,r=H7yDYKAWBCrM2Fa5SxGa4iezFPVDPpDUcGxPkH3RzP,p=pXkak78EuwwOEwk2/h/OzD7NkEI=",
 			"v=ldX4EBNnOgDnNTOCmbSfBHAUCOs=");
 
+#ifdef USE_IDN
 	assert_successful_exchange("pass 1/2 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
 


More information about the Commits mailing list