Blob Blame History Raw
commit f97b417d964fd163f6231de5a12e26ef4215aa7a
Author: Christina Fu <cfu@redhat.com>
Date:   Tue Jul 28 11:47:27 2015 -0700

    Ticket 1307 issue: FilterMappingResolver always returns target
    
    (cherry picked from commit b68fc753775cf49dcd3bafe046c71dda08ca6b9a)

diff --git a/base/tps/src/org/dogtagpki/server/tps/channel/SecureChannel.java b/base/tps/src/org/dogtagpki/server/tps/channel/SecureChannel.java
index 95cf26c..598e99a 100644
--- a/base/tps/src/org/dogtagpki/server/tps/channel/SecureChannel.java
+++ b/base/tps/src/org/dogtagpki/server/tps/channel/SecureChannel.java
@@ -393,7 +393,7 @@ public class SecureChannel {
 
             if (!response.checkResult()) {
                 throw new TPSException(
-                        "SecureChannel.eternalAuthenticate SCP01. Failed to external authenticate to token.",
+                        "SecureChannel.externalAuthenticate SCP01. Failed to external authenticate to token.",
                         TPSStatus.STATUS_ERROR_SECURE_CHANNEL);
             }
 
diff --git a/base/tps/src/org/dogtagpki/server/tps/mapping/FilterMappingResolver.java b/base/tps/src/org/dogtagpki/server/tps/mapping/FilterMappingResolver.java
index 38ea29c..45cd203 100644
--- a/base/tps/src/org/dogtagpki/server/tps/mapping/FilterMappingResolver.java
+++ b/base/tps/src/org/dogtagpki/server/tps/mapping/FilterMappingResolver.java
@@ -42,6 +42,7 @@ public class FilterMappingResolver extends BaseMappingResolver {
         String extKeySet = null;
 
         String targetMappedName = null;
+        String selectedMappedName = null;
 
         CMS.debug(method + " starts");
 
@@ -52,6 +53,7 @@ public class FilterMappingResolver extends BaseMappingResolver {
         CMS.debug(method + " param minor_version =" + minor_version);
 
         cuid =  mappingParams.getString(FilterMappingParams.FILTER_PARAM_CUID);
+        CMS.debug(method + " param cuid =" + cuid);
         // msn = (String) mappingParams.get(FilterMappingParams.FILTER_PARAM_MSN);
 
         // they don't necessarily have extension
@@ -225,7 +227,8 @@ public class FilterMappingResolver extends BaseMappingResolver {
                     continue;
                 }
 
-                if (cuid.compareTo(tokenCUIDStart) < 0) {
+                if (cuid.compareToIgnoreCase(tokenCUIDStart) < 0) {
+                    CMS.debug(method + " cuid < tokenCUIDStart ... out of range");
                     continue;
                 }
 
@@ -255,7 +258,8 @@ public class FilterMappingResolver extends BaseMappingResolver {
                     continue;
                 }
 
-                if (cuid.compareTo(tokenCUIDEnd) > 0) {
+                if (cuid.compareToIgnoreCase(tokenCUIDEnd) > 0) {
+                    CMS.debug(method + " cuid > tokenCUIDEnd ... out of range");
                     continue;
                 }
 
@@ -309,17 +313,18 @@ public class FilterMappingResolver extends BaseMappingResolver {
             }
 
             //if we make it this far, we have a mapped name
-            CMS.debug(method + " Selected Token type: " + targetMappedName);
+            selectedMappedName = targetMappedName;
+            CMS.debug(method + " Selected mapped name: " + selectedMappedName);
             break;
         }
 
-        if (targetMappedName == null) {
-            CMS.debug(method + " ends, found: " + targetMappedName);
+        if (selectedMappedName == null) {
+            CMS.debug(method + " ends, found: " + selectedMappedName);
             throw new TPSException(method + " Can't map to target name!",
                     TPSStatus.STATUS_ERROR_MAPPING_RESOLVER_FAILED);
         }
 
-        return targetMappedName;
+        return selectedMappedName;
 
     }