Mercurial > pidgin.yaz
changeset 27537:7e79102cda40
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
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Fri, 10 Jul 2009 23:58:36 +0000 |
parents | 8f2dfa6ef2f7 |
children | 2eba2794423d |
files | libpurple/protocols/jabber/jutil.c |
diffstat | 1 files changed, 11 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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; }