ACK, not tested.

On 04/27/2017 03:10 PM, Lennart Lund wrote:
> SMF has an IMM applier to track changes of attribute longDnsAllowed in 
> OpensafImm class.
> Fix that the applier does not find the value if the list of attributes to be 
> handled in the
> apply callback contains more than one attribute. Also if the found attribute 
> is not the serached
> one the cached attribute value is set to invalid
> ---
>   src/smf/smfd/SmfImmApplierHdl.cc | 28 +++++++++++++++-------------
>   1 file changed, 15 insertions(+), 13 deletions(-)
>
> diff --git a/src/smf/smfd/SmfImmApplierHdl.cc 
> b/src/smf/smfd/SmfImmApplierHdl.cc
> index d325ec4..693446b 100644
> --- a/src/smf/smfd/SmfImmApplierHdl.cc
> +++ b/src/smf/smfd/SmfImmApplierHdl.cc
> @@ -436,15 +436,12 @@ static void CcbApplyCallback(SaImmOiHandleT 
> immOiHandle, SaImmOiCcbIdT ccbId) {
>   
>     objName = osaf_extended_name_borrow(&opdata->objectName);
>     if (object_name_.compare(objName) != 0) {
> -    TRACE("%s: Object \"%s\" not an OpensafConfig object", __FUNCTION__,
> -          objName);
> +    LOG_NO("%s: Object \"%s\" wrong object", __FUNCTION__, objName);
>       goto done;
>     }
>   
> -  /* Read value in opensafNetworkName
> -   * Note: This is implemented as a loop in case more attributes are
> -   *       added in the class in the future. For now the only
> -   *       attribute of interest here is opensafNetworkName
> +  /* Read value
> +   * Note: For now the only attribute of interest here is opensafNetworkName
>      */
>     TRACE("%s: Read value in attributes", __FUNCTION__);
>     attrMod = opdata->param.modify.attrMods[0];
> @@ -455,21 +452,26 @@ static void CcbApplyCallback(SaImmOiHandleT 
> immOiHandle, SaImmOiCcbIdT ccbId) {
>       if (attribute_name_.compare(attribute.attrName) != 0) {
>         // Not found
>         attrMod = opdata->param.modify.attrMods[i];
> +      attribute = attrMod->modAttr;
>         continue;
>       }
>   
>       // Attribute found
>       value = static_cast<SaUint32T *>(attribute.attrValues[0]);
> +    TRACE("Attribute found: attrName '%s', value = %d",
> +          attribute.attrName, *value);
>       break;
>     }
>   
> -  if (value == nullptr) {
> -    TRACE("%s: Value is nullptr", __FUNCTION__);
> -    SetAttributeValue("");
> -    attribute_value_is_valid_ = false;
> -  } else {
> -    SetAttributeValue(std::to_string(*value));
> -    attribute_value_is_valid_ = true;
> +  if (attrMod != nullptr) {
> +    if (value == nullptr) {
> +      TRACE("%s: Value is nullptr", __FUNCTION__);
> +      SetAttributeValue("");
> +      attribute_value_is_valid_ = false;
> +    } else {
> +      SetAttributeValue(std::to_string(*value));
> +      attribute_value_is_valid_ = true;
> +    }
>     }
>   
>   done:


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to