pidgin: 7bc0b080: XMPP domains can also be IPv4 or IPv6 ad...

darkrain42 at pidgin.im darkrain42 at pidgin.im
Fri Jul 10 22:00:46 EDT 2009


-----------------------------------------------------------------
Revision: 7bc0b08014d8d13ff8ee8c61c280e4d963b578d2
Ancestor: f5fb11c018f4f93600f9f9bf28ec9274e43c377d
Author: darkrain42 at pidgin.im
Date: 2009-07-11T01:57:14
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/7bc0b08014d8d13ff8ee8c61c280e4d963b578d2

Modified files:
        libpurple/protocols/jabber/jutil.c
        libpurple/protocols/jabber/jutil.h
        libpurple/tests/test_jabber_jutil.c

ChangeLog: 

XMPP domains can also be IPv4 or IPv6 addresses

We don't have an IPv6 validation function and I didn't feel
like writing one, so I left those checks commented out and
added a note to jabber_nameprep_validate (which is
increasingly misnamed).

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/jutil.c	da14263cc75547fb5e1027b6c07a1bf2907dcbba
+++ libpurple/protocols/jabber/jutil.c	8cff93dea2f6105c3497fc5d4d9ac91664751c3f
@@ -65,9 +65,8 @@ gboolean jabber_nameprep_validate(const 
 		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.
+	 * TODO: An IPv6 address of the form [2001:470:1f05:d58::2] is also
+	 * a valid XMPP domain portion.
 	 */
 	c = str;
 	while(c && *c) {
============================================================
--- libpurple/protocols/jabber/jutil.h	13f9a4cbf361a93b07b1afda63ebe220dc33bafb
+++ libpurple/protocols/jabber/jutil.h	4e4ee2cce668f54474866c4db1a5501527bc2d6d
@@ -45,6 +45,7 @@ gboolean jabber_nodeprep_validate(const 
 gboolean jabber_is_own_account(JabberStream *js, const char *jid);
 
 gboolean jabber_nodeprep_validate(const char *);
+/* TODO: This needs to be named jabber_domain_validate and handle IPv6/IDNA. */
 gboolean jabber_nameprep_validate(const char *);
 gboolean jabber_resourceprep_validate(const char *);
 
============================================================
--- libpurple/tests/test_jabber_jutil.c	66de5c9b6cb7e55901e33e54457eec1865acaf19
+++ libpurple/tests/test_jabber_jutil.c	bfaed25538482aed17a715318349decdecab1e05
@@ -99,6 +99,12 @@ START_TEST(test_jabber_id_new)
 	assert_valid_jid("stuart at n?d?tX?YZ.se/?????");
 	assert_valid_jid("mark.doliner@???.org");
 	assert_valid_jid("nick@??.????.net");
+	assert_valid_jid("paul at 10.0.42.230/s");
+#if 0
+/* Uncomment these when jabber_domain_validate supports IPv6 addresses */
+	assert_valid_jid("paul@[::1]"); /* IPv6 */
+	assert_valid_jid("paul@[2001:470:1f05:d58::2]");
+#endif
 
 	assert_invalid_jid("@gmail.com");
 	assert_invalid_jid("@@gmail.com");


More information about the Commits mailing list