changeset 30192:bb835d43f29f

merge of '04b459a0054fec05e338c8cb5cdafb9d3feb12b5' and '4dfc05ac6d6ae070920c029799fb08b7e3b08973'
author Paul Aurich <paul@darkrain42.org>
date Tue, 15 Jun 2010 01:33:28 +0000
parents b8782b02330d (diff) e4c57ecc54ee (current diff)
children b3c4f33643a6 92a5d4b38f21
files
diffstat 2 files changed, 8 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/tests/test_util.c	Tue Jun 15 01:32:14 2010 +0000
+++ b/libpurple/tests/test_util.c	Tue Jun 15 01:33:28 2010 +0000
@@ -109,13 +109,13 @@
 	"colonButNoPort@127.0.0.1:",
 	""
 	/* "someone-else@127.0.0.1.26", */
-	/* ".localStartsWithDot@domain.com", */
-	/* "localEndsWithDot.@domain.com", */
-	/* "two..consecutiveDots@domain.com", */
-	/* "domainStartsWithDash@-domain.com", */
+	".localStartsWithDot@domain.com",
+	/* "localEndsWithDot.@domain.com", */ /* I don't think this is invalid -- Stu */
+	/* "two..consecutiveDots@domain.com", */ /* I don't think this is invalid -- Stu */
+	"domainStartsWithDash@-domain.com",
 	"domainEndsWithDash@domain-.com",
 	/* "numbersInTLD@domain.c0m", */
-	/* "missingTLD@domain.", */
+	/* "missingTLD@domain.", */ /* This certainly isn't invalid -- Stu */
 	"! \"#$%(),/;<>[]`|@invalidCharsInLocal.org",
 	"invalidCharsInDomain@! \"#$%(),/;<>_[]`|.org",
 	/* "local@SecondLevelDomainNamesAreInvalidIfTheyAreLongerThan64Charactersss.org" */
--- a/libpurple/util.c	Tue Jun 15 01:32:14 2010 +0000
+++ b/libpurple/util.c	Tue Jun 15 01:33:28 2010 +0000
@@ -4271,6 +4271,8 @@
 
 	g_return_val_if_fail(address != NULL, FALSE);
 
+	if (*address == '.') return FALSE;
+
 	/* first we validate the name portion (name@domain) (rfc822)*/
 	for (c = address;  *c;  c++) {
 		if (*c == '\"' && (c == address || *(c - 1) == '.' || *(c - 1) == '\"')) {
@@ -4304,7 +4306,7 @@
 	do {
 		if (*c == '.' && (c == domain || *(c - 1) == '.' || *(c - 1) == '-'))
 			return FALSE;
-		if (*c == '-' && *(c - 1) == '.') return FALSE;
+		if (*c == '-' && (*(c - 1) == '.' || *(c - 1) == '@')) return FALSE;
 		if ((*c < '0' && *c != '-' && *c != '.') || (*c > '9' && *c < 'A') ||
 			(*c > 'Z' && *c < 'a') || (*c > 'z')) return FALSE;
 	} while (*++c);