From bdcb19e3441334f22fd6ea90e281aa702e0085aa Mon Sep 17 00:00:00 2001 From: rpimonitrbtch Date: Thu, 25 Aug 2011 19:07:30 -0300 Subject: [PATCH] Issue 2784: Cannot set server hostname Loosened the restrictions on the TLD to support custom private TLD's, as well as single label hostnames. Removed the localhost and localhost.localdomain exceptions, as they are now redundant. --- src/com/fsck/k9/helper/Utility.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/com/fsck/k9/helper/Utility.java b/src/com/fsck/k9/helper/Utility.java index d06734f5f..f9a555ff1 100644 --- a/src/com/fsck/k9/helper/Utility.java +++ b/src/com/fsck/k9/helper/Utility.java @@ -108,15 +108,13 @@ public class Utility { public static boolean domainFieldValid(EditText view) { if (view.getText() != null) { String s = view.getText().toString(); - if (s.matches("^([a-zA-Z0-9]([a-zA-Z0-9\\-]{0,61}[a-zA-Z0-9])?\\.)+[a-zA-Z]{2,6}$")) { + if (s.matches("^([a-zA-Z0-9]([a-zA-Z0-9\\-]{0,61}[a-zA-Z0-9])?\\.)*[a-zA-Z0-9]([a-zA-Z0-9\\-]{0,61}[a-zA-Z0-9])?$") && + s.length() <= 253) { return true; } if (s.matches("^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$")) { return true; } - if ((s.equalsIgnoreCase("localhost")) || (s.equalsIgnoreCase("localhost.localdomain"))) { - return true; - } } return false; }