# HG changeset patch # User Mark Doliner # Date 1247270316 0 # Node ID 7e79102cda405c69583aaa4b077887c11529de29 # Parent 8f2dfa6ef2f70565f06d1c78d7d3bc177be6fec9 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 diff -r 8f2dfa6ef2f7 -r 7e79102cda40 libpurple/protocols/jabber/jutil.c --- a/libpurple/protocols/jabber/jutil.c Fri Jul 10 23:05:20 2009 +0000 +++ b/libpurple/protocols/jabber/jutil.c Fri Jul 10 23:58:36 2009 +0000 @@ -64,16 +64,25 @@ 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; }