[cpp-sp COMMIT] /branches/REL_2/plugins/TransformAttributeResolver.cpp

noreply at shibboleth.net noreply at shibboleth.net
Fri Nov 2 16:22:00 EDT 2012


Author: scantor
Date: Fri Nov  2 16:22:00 2012
New Revision: 3819

URL: http://svn.shibboleth.net/view/cpp-sp?rev=3819&view=rev
Log:
https://issues.shibboleth.net/jira/browse/SSPCPP-522

Modified:
    branches/REL_2/plugins/TransformAttributeResolver.cpp

Modified: branches/REL_2/plugins/TransformAttributeResolver.cpp
URL: http://svn.shibboleth.net/view/cpp-sp/branches/REL_2/plugins/TransformAttributeResolver.cpp?rev=3819&r1=3818&r2=3819&view=diff
==============================================================================
--- branches/REL_2/plugins/TransformAttributeResolver.cpp (original)
+++ branches/REL_2/plugins/TransformAttributeResolver.cpp Fri Nov  2 16:22:00 2012
@@ -227,7 +227,10 @@
                 try {
                     auto_arrayptr<XMLCh> srcval(fromUTF8((*a)->getSerializedValues()[i].c_str()));
                     XMLCh* destval = r->get<1>()->replace(srcval.get(), r->get<2>());
-                    if (destval) {
+                    if (!destval)
+                        continue;
+                    // For some reason, it returns the source string if the match doesn't succeed.
+                    if (!XMLString::equals(destval, srcval.get())) {
                         auto_arrayptr<char> narrow(toUTF8(destval));
                         XMLString::release(&destval);
                         if (dest) {
@@ -241,6 +244,9 @@
                             trim(destwrapper->getValues().back());
                         }
                     }
+                    else {
+                        XMLString::release(&destval);
+                    }
                 }
                 catch (XMLException& ex) {
                     auto_ptr_char msg(ex.getMessage());



More information about the commits mailing list