Mercurial > pidgin
comparison libpurple/protocols/jabber/jutil.c @ 27461: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 |
comparison
equal
deleted
inserted
replaced
27460:8f2dfa6ef2f7 | 27461:7e79102cda40 |
---|---|
62 return TRUE; | 62 return TRUE; |
63 | 63 |
64 if(strlen(str) > 1023) | 64 if(strlen(str) > 1023) |
65 return FALSE; | 65 return FALSE; |
66 | 66 |
67 /* | |
68 * This should be more similar to purple_email_is_valid(). Maybe | |
69 * that function should even be split up and we should call the part | |
70 * that validates the domain name. | |
71 */ | |
67 c = str; | 72 c = str; |
68 while(c && *c) { | 73 while(c && *c) { |
69 gunichar ch = g_utf8_get_char(c); | 74 gunichar ch = g_utf8_get_char(c); |
70 if(!g_unichar_isgraph(ch)) | 75 /* The list of characters allowed in domain names is pretty small */ |
76 if (!( (ch >= 'a' && *c <= 'z') | |
77 || (ch >= '0' && ch <= '9') | |
78 || (ch >= 'A' && ch <= 'Z') | |
79 || ch == '.' | |
80 || ch == '-' )) | |
71 return FALSE; | 81 return FALSE; |
72 | 82 |
73 c = g_utf8_next_char(c); | 83 c = g_utf8_next_char(c); |
74 } | 84 } |
75 | |
76 | 85 |
77 return TRUE; | 86 return TRUE; |
78 } | 87 } |
79 | 88 |
80 gboolean jabber_resourceprep_validate(const char *str) | 89 gboolean jabber_resourceprep_validate(const char *str) |