This repository was archived by the owner on Feb 20, 2020. It is now read-only.
File tree 3 files changed +17
-0
lines changed
main/java/javax/mail/internet
test/resources/javax/mail/internet
3 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ GH 315 empty Content-Transfer-Encoding header causes IOException
28
28
GH 316 starttls.enable documentation should reference starttls.required prop
29
29
GH 317 use System.lineSeparator() instead of System.getProperty(...)
30
30
GH 321 URLName.getURL() returns incorrect url.
31
+ GH 322 Dots in local part of emails not handled properly
31
32
32
33
33
34
CHANGES IN THE 1.6.1 RELEASE
Original file line number Diff line number Diff line change @@ -1343,12 +1343,22 @@ private static void checkAddress(String addr,
1343
1343
throw new AddressException (
1344
1344
"Quoted local address contains newline without whitespace" ,
1345
1345
addr );
1346
+ } else if (c == '.' ) {
1347
+ if (i == start )
1348
+ throw new AddressException (
1349
+ "Local address starts with dot" , addr );
1350
+ if (lastc == '.' )
1351
+ throw new AddressException (
1352
+ "Local address contains dot-dot" , addr );
1346
1353
}
1347
1354
if (inquote )
1348
1355
continue ;
1349
1356
if (c == '@' ) {
1350
1357
if (i == 0 )
1351
1358
throw new AddressException ("Missing local name" , addr );
1359
+ if (lastc == '.' )
1360
+ throw new AddressException (
1361
+ "Local address ends with dot" , addr );
1352
1362
break ; // done with local part
1353
1363
}
1354
1364
if (c <= 040 || c == 0177 )
Original file line number Diff line number Diff line change @@ -395,6 +395,12 @@ To: a@com.
395
395
Expect: Exception javax.mail.internet.AddressException: Domain ends with dot in string ``a@com.''
396
396
To: a@b..com
397
397
Expect: Exception javax.mail.internet.AddressException: Domain contains dot-dot in string ``a@b..com''
398
+ To: .a@b.com
399
+ Expect: Exception javax.mail.internet.AddressException: Local address starts with dot in string ``.a@b.com''
400
+ To: a.@b.com
401
+ Expect: Exception javax.mail.internet.AddressException: Local address ends with dot in string ``a.@b.com''
402
+ To: a..b@b.com
403
+ Expect: Exception javax.mail.internet.AddressException: Local address contains dot-dot in string ``a..b@b.com''
398
404
To: a@com
399
405
Expect: Exception javax.mail.internet.AddressException: Domain contains control or whitespace in string ``a@com''
400
406
To: a@b.com
You can’t perform that action at this time.
0 commit comments