details:   https://code.openbravo.com/erp/devel/pi/rev/a3230e6e4301
changeset: 17702:a3230e6e4301
user:      Augusto Mauch <augusto.mauch <at> openbravo.com>
date:      Fri Aug 17 13:57:11 2012 +0200
summary:   Related to issue 21169: Change logic to prevent wrong protocol 
detection

The logic to detect the web protocols has been changed to prevent false 
positives. Before the fix, if the user defined a URL like htmlcodetutorial.com, 
the web protocol would not have been added because the URL starts with html.

Now this has changed, and supports http, https and ftp protocols.

diffstat:

 src/org/openbravo/erpCommon/security/Login.java |  10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diffs (23 lines):

diff -r 28081bd3f4d0 -r a3230e6e4301 
src/org/openbravo/erpCommon/security/Login.java
--- a/src/org/openbravo/erpCommon/security/Login.java   Fri Aug 17 09:24:49 
2012 +0200
+++ b/src/org/openbravo/erpCommon/security/Login.java   Fri Aug 17 13:57:11 
2012 +0200
@@ -266,11 +266,17 @@
       showForgeLogo = !ActivationKey.getInstance().isActive()
           || (ActivationKey.getInstance().isActive() && 
sysInfo.isShowForgeLogoInLogin());
       itLink = sysInfo.getSupportContact() == null ? "" : 
sysInfo.getSupportContact();
-      if (!itLink.isEmpty() && !StringUtils.startsWithIgnoreCase(itLink, 
"http")) {
+      if (!itLink.isEmpty()
+          && !(StringUtils.startsWithIgnoreCase(itLink, "http://";)
+              || StringUtils.startsWithIgnoreCase(itLink, "https://";) || 
StringUtils
+                .startsWithIgnoreCase(itLink, "ftp://";))) {
         itLink = "http://"; + itLink;
       }
       companyLink = sysInfo.getYourCompanyURL() == null ? "" : 
sysInfo.getYourCompanyURL();
-      if (!companyLink.isEmpty() && 
!StringUtils.startsWithIgnoreCase(companyLink, "http")) {
+      if (!companyLink.isEmpty()
+          && !(StringUtils.startsWithIgnoreCase(companyLink, "http://";)
+              || StringUtils.startsWithIgnoreCase(companyLink, "https://";) || 
StringUtils
+                .startsWithIgnoreCase(companyLink, "ftp://";))) {
         companyLink = "http://"; + companyLink;
       }
     }

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to