Hi Zoran,

The basic problem that must be solved is to make loading possible if the 
data that is loaded contains long-DNs.
The patch/fix does solve that problem by the added line in 
getLongDnsAllowed()

But the patch also tries to check if the database is consistent between 
the value of attribute longDnsAllowed and the
presence of long Dns in the loaded data.

This means checking all SaNameT attributes (incluidnging RDN if it is of 
SaNameT type) for being long.
This is done.
But it also means actually cheking if any DN is long.
As far as I can see that is missing.

So I have to NACK this patch.

It needs a correction to also check the DN.

/AndersBj


Zoran Milinkovic wrote:
>  osaf/services/saf/immsv/immnd/ImmModel.cc |  80 
> ++++++++++++++++++++++--------
>  1 files changed, 57 insertions(+), 23 deletions(-)
>
>
> The patch fix loading SaNameT attributes with long DNs before 
> opensafImm=opensafImm,safApp=safImmService is created.
>
> diff --git a/osaf/services/saf/immsv/immnd/ImmModel.cc 
> b/osaf/services/saf/immsv/immnd/ImmModel.cc
> --- a/osaf/services/saf/immsv/immnd/ImmModel.cc
> +++ b/osaf/services/saf/immsv/immnd/ImmModel.cc
> @@ -453,6 +453,7 @@ static const std::string saImmOiTimeout(
>  static SaImmRepositoryInitModeT immInitMode = SA_IMM_INIT_FROM_FILE;
>  
>  static SaUint32T ccbIdLongDnGuard  = 0; /* Disallow long DN creates if 
> longDnsAllowed is being changed in ccb*/
> +static bool      sIsLongDnLoaded   = false; /* track long DNs before 
> opensafImm=opensafImm,safApp=safImmService is created */
>  
>  struct AttrFlagIncludes
>  {
> @@ -2633,7 +2634,7 @@ ImmModel::getLongDnsAllowed(ObjectInfo* 
>          oi = sObjectMap.find(immObjectDn);
>          if(oi == sObjectMap.end()) {
>              TRACE_LEAVE();
> -            return false;
> +            return sImmNodeState == IMM_NODE_LOADING;
>          }
>          immObject =  oi->second;
>      }
> @@ -6776,6 +6777,12 @@ SaAisErrorT ImmModel::ccbObjectCreate(Im
>                  goto ccbObjectCreateExit;
>              }
>  
> +            if(isLoading && !sIsLongDnLoaded
> +                    && attrValues->n.attrValueType == SA_IMM_ATTR_SANAMET
> +                    && attrValues->n.attrValue.val.x.size >= 
> SA_MAX_UNEXTENDED_NAME_LENGTH) {
> +                sIsLongDnLoaded = true;
> +            }
> +
>              /* size includes null termination byte. */
>              if(((size_t)attrValues->n.attrValue.val.x.size > 65) &&  
>                  (i4->second->mValueType == SA_IMM_ATTR_SASTRINGT) && 
> !longDnsPermitted)
> @@ -6800,33 +6807,47 @@ SaAisErrorT ImmModel::ccbObjectCreate(Im
>              objectName.append((const 
> char*)attrValues->n.attrValue.val.x.buf, 
>                  strnlen((const char*)attrValues->n.attrValue.val.x.buf,
>                      (size_t)attrValues->n.attrValue.val.x.size));
> -        } else if (attrValues->n.attrValueType == SA_IMM_ATTR_SANAMET
> -                && !longDnsPermitted) {
> -            AttrMap::iterator it = classInfo->mAttrMap.find(attrName);
> -            if(it == classInfo->mAttrMap.end()) {
> -                LOG_ER("ERR_INVALID_PARAM: Cannot find attribute '%s'",
> -                    attrName.c_str());
> -                err = SA_AIS_ERR_INVALID_PARAM;     //Should never happen!
> -                goto ccbObjectCreateExit;
> -            }
> -            if(attrValues->n.attrValue.val.x.size >= 
> SA_MAX_UNEXTENDED_NAME_LENGTH) {
> -                LOG_NO("ERR_NAME_TOO_LONG: Attribute '%s' has long name. "
> -                    "Not allowed by IMM service or extended names are 
> disabled",
> -                    attrName.c_str());
> -                err = SA_AIS_ERR_NAME_TOO_LONG;
> -                goto ccbObjectCreateExit;
> -            }
> -
> -            IMMSV_EDU_ATTR_VAL_LIST *value = attrValues->n.attrMoreValues;
> -            while(value) {
> -                if(value->n.val.x.size >= SA_MAX_UNEXTENDED_NAME_LENGTH) {
> -                    LOG_NO("ERR_NAME_TOO_LONG: Attribute '%s' has long DN. "
> +        } else if (attrValues->n.attrValueType == SA_IMM_ATTR_SANAMET) {
> +            if(!longDnsPermitted) {
> +                AttrMap::iterator it = classInfo->mAttrMap.find(attrName);
> +                if(it == classInfo->mAttrMap.end()) {
> +                    LOG_ER("ERR_INVALID_PARAM: Cannot find attribute '%s'",
> +                        attrName.c_str());
> +                    err = SA_AIS_ERR_INVALID_PARAM;     //Should never 
> happen!
> +                    goto ccbObjectCreateExit;
> +                }
> +                if(attrValues->n.attrValue.val.x.size >= 
> SA_MAX_UNEXTENDED_NAME_LENGTH) {
> +                    LOG_NO("ERR_NAME_TOO_LONG: Attribute '%s' has long name. 
> "
>                          "Not allowed by IMM service or extended names are 
> disabled",
>                          attrName.c_str());
>                      err = SA_AIS_ERR_NAME_TOO_LONG;
>                      goto ccbObjectCreateExit;
>                  }
> -                value = value->next;
> +
> +                IMMSV_EDU_ATTR_VAL_LIST *value = 
> attrValues->n.attrMoreValues;
> +                while(value) {
> +                    if(value->n.val.x.size >= SA_MAX_UNEXTENDED_NAME_LENGTH) 
> {
> +                        LOG_NO("ERR_NAME_TOO_LONG: Attribute '%s' has long 
> DN. "
> +                            "Not allowed by IMM service or extended names 
> are disabled",
> +                            attrName.c_str());
> +                        err = SA_AIS_ERR_NAME_TOO_LONG;
> +                        goto ccbObjectCreateExit;
> +                    }
> +                    value = value->next;
> +                }
> +            } else if (isLoading && !sIsLongDnLoaded) {
> +                if(attrValues->n.attrValue.val.x.size >= 
> SA_MAX_UNEXTENDED_NAME_LENGTH) {
> +                    sIsLongDnLoaded = true;
> +                } else {
> +                    IMMSV_EDU_ATTR_VAL_LIST *value = 
> attrValues->n.attrMoreValues;
> +                    while(value) {
> +                        if(value->n.val.x.size >= 
> SA_MAX_UNEXTENDED_NAME_LENGTH) {
> +                            sIsLongDnLoaded = true;
> +                            break;
> +                        }
> +                        value = value->next;
> +                    }
> +                }
>              }
>          }
>  
> @@ -7340,6 +7361,19 @@ SaAisErrorT ImmModel::ccbObjectCreate(Im
>                          LOG_WA("Imm loading encountered bogus object '%s' of 
> class '%s'",
>                              objectName.c_str(), immClassName.c_str());
>                      }
> +                    if(sIsLongDnLoaded) {
> +                        i6 = object->mAttrValueMap.find(immLongDnsAllowed);
> +                        if(i6 == object->mAttrValueMap.end() || !i6->second) 
> {
> +                            LOG_ER("ERR_LIBRARY: Long DN is used during the 
> loading initial data, "
> +                                    "but longDnsAllowed is not specified");
> +                            err = SA_AIS_ERR_LIBRARY;
> +                        } else if(i6->second->getValue_int() != 1) {
> +                            LOG_ER("ERR_LIBRARY: Long DN is used during the 
> loading initial data, "
> +                                    "but longDnsAllowed is set to %d",
> +                                    i6->second->getValue_int());
> +                            err = SA_AIS_ERR_LIBRARY;
> +                        }
> +                    }
>                  } else {
>                      setCcbErrorString(ccb,
>                          "ERR_BAD_OPERATION: Imm not allowing creates of 
> instances of class '%s'",
>
> ------------------------------------------------------------------------------
> Slashdot TV.  
> Video for Nerds.  Stuff that matters.
> http://tv.slashdot.org/
> _______________________________________________
> Opensaf-devel mailing list
> Opensaf-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/opensaf-devel
>   


------------------------------------------------------------------------------
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to