Menu

#1097 imm: using invalid iterator in migrateObj

4.3.3
fixed
None
defect
imm
nd
major
2015-01-14
2014-09-16
No

Schema change from single value to multi value attribute, iterator is incorrectly used.

/* Adjust existing attributes.*/
ImmAttrValueMap::iterator oavi; 
for(oavi = object->mAttrValueMap.begin(); 
   oavi != object->mAttrValueMap.end(); ++oavi) {
    /*
       TRACE_5("CHECKING existing attribute %s:%s for object %s",
       className.c_str(), oavi->first.c_str(), objectDn.c_str());
    */

    /* Change from single to multi-value requires change of value rep.*/
    ai = changedAttrs.find(oavi->first);
    if(ai != changedAttrs.end()) {
        if((ai->second->mFlags & SA_IMM_ATTR_MULTI_VALUE) &&
            (!oavi->second->isMultiValued())) {
            attrValue = new ImmAttrMultiValue(*(oavi->second));
            TRACE_5("Schema change adjusted attribute %s in object:%s "
                "to be multivalued", oavi->first.c_str(), objectDn.c_str());
            delete oavi->second;
            object->mAttrValueMap.erase(oavi);
            object->mAttrValueMap[ai->first] = attrValue;
        }
    }

    /* Correct object->mAdminOwnerAttrVal. */
    if(oavi->first == std::string(SA_IMM_ATTR_ADMIN_OWNER_NAME)) {
        object->mAdminOwnerAttrVal = oavi->second;
        TRACE_5("Schema change corrected attr %s in object:%s",
            oavi->first.c_str(), objectDn.c_str());
    }
}

Related

Tickets: #1097
Wiki: ChangeLog-4.3.3
Wiki: ChangeLog-4.4.1

Discussion

  • Anders Bjornerstedt

    • status: unassigned --> accepted
    • assigned_to: Anders Bjornerstedt
     
  • Anders Bjornerstedt

    • status: accepted --> review
     
  • Neelakanta Reddy

    • assigned_to: Anders Bjornerstedt --> Neelakanta Reddy
     
  • Neelakanta Reddy

    • status: review --> fixed
     

Log in to post a comment.