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
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel