-/*
- * Copyright 2001-2010 Internet2
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+/**
+ * Licensed to the University Corporation for Advanced Internet
+ * Development, Inc. (UCAID) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for
+ * additional information regarding copyright ownership.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * UCAID licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the
+ * License at
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific
+ * language governing permissions and limitations under the License.
*/
/**
#include <xmltooling/util/XMLHelper.h>
using namespace shibsp;
+using namespace xmltooling;
using namespace std;
-using xmltooling::XMLHelper;
namespace shibsp {
class SHIBSP_DLLLOCAL AttributeValueStringFunctor : public MatchFunctor
{
string m_attributeID;
- char* m_value;
+ auto_arrayptr<char> m_value;
bool hasValue(const FilteringContext& filterContext) const;
bool matches(const Attribute& attribute, size_t index) const;
public:
AttributeValueStringFunctor(const DOMElement* e)
: m_attributeID(XMLHelper::getAttrString(e, nullptr, attributeID)),
- m_value(e ? xmltooling::toUTF8(e->getAttributeNS(nullptr,value)) : nullptr) {
- if (!m_value || !*m_value) {
- delete[] m_value;
+ m_value(e ? toUTF8(e->getAttributeNS(nullptr, value)) : nullptr) {
+ if (!m_value.get() || !*m_value.get()) {
throw ConfigurationException("AttributeValueString MatchFunctor requires non-empty value attribute.");
}
- if (e && e->hasAttributeNS(nullptr,ignoreCase)) {
- xmltooling::logging::Category::getInstance(SHIBSP_LOGCAT".AttributeFilter").warn(
+ if (e && e->hasAttributeNS(nullptr, ignoreCase)) {
+ Category::getInstance(SHIBSP_LOGCAT ".AttributeFilter").warn(
"ignoreCase property ignored by AttributeValueString MatchFunctor in favor of attribute's caseSensitive property"
);
}
}
- virtual ~AttributeValueStringFunctor() {
- delete[] m_value;
- }
+ virtual ~AttributeValueStringFunctor() {}
bool evaluatePolicyRequirement(const FilteringContext& filterContext) const {
if (m_attributeID.empty())
}
};
- MatchFunctor* SHIBSP_DLLLOCAL AttributeValueStringFactory(const std::pair<const FilterPolicyContext*,const DOMElement*>& p)
+ MatchFunctor* SHIBSP_DLLLOCAL AttributeValueStringFactory(const pair<const FilterPolicyContext*,const DOMElement*>& p)
{
return new AttributeValueStringFunctor(p.second);
}
if (!val)
return false;
if (attribute.isCaseSensitive())
- return !strcmp(m_value, val);
+ return !strcmp(m_value.get(), val);
#ifdef HAVE_STRCASECMP
- return !strcasecmp(m_value, val);
+ return !strcasecmp(m_value.get(), val);
#else
- return !stricmp(m_value, val);
+ return !stricmp(m_value.get(), val);
#endif
}