pidgin: 015071cf: Be more restrictive in the characters al...

markdoliner at pidgin.im markdoliner at pidgin.im
Fri Jul 10 20:00:34 EDT 2009


-----------------------------------------------------------------
Revision: 015071cfc67540c35cc4a2c76f3d4b6c955464c9
Ancestor: fa71a7a687030aa37b9e028c1f3fbbfcd7a85bc9
Author: markdoliner at pidgin.im
Date: 2009-07-10T23:58:36
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/015071cfc67540c35cc4a2c76f3d4b6c955464c9

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

ChangeLog: 

Be more restrictive in the characters allowed by jabber_nameprep_validate()
The list of characters allowed in the domain name by
http://xmpp.org/internet-drafts/draft-ietf-xmpp-3920bis-00.html#addressing-overview
is pretty small

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/jutil.c	228d3e3db1fcf2914988453415ba72c2cf5c6a6a
+++ libpurple/protocols/jabber/jutil.c	9f7390ba07a0f4af05f8d605655f7dbb10e171ec
@@ -64,16 +64,25 @@ gboolean jabber_nameprep_validate(const 
 	if(strlen(str) > 1023)
 		return FALSE;
 
+	/*
+	 * This should be more similar to purple_email_is_valid().  Maybe
+	 * that function should even be split up and we should call the part
+	 * that validates the domain name.
+	 */
 	c = str;
 	while(c && *c) {
 		gunichar ch = g_utf8_get_char(c);
-		if(!g_unichar_isgraph(ch))
+		/* The list of characters allowed in domain names is pretty small */
+		if (!( (ch >= 'a' && *c <= 'z')
+				|| (ch >= '0' && ch <= '9')
+				|| (ch >= 'A' && ch <= 'Z')
+				|| ch == '.'
+				|| ch == '-' ))
 			return FALSE;
 
 		c = g_utf8_next_char(c);
 	}
 
-
 	return TRUE;
 }
 


More information about the Commits mailing list