Hi Gary,
I have some reply below.
Thanks !
Best Regards,
Phuc Chau
-----------------------------------------
Amfd crashes when su is unlocked, The reason for the crash is in the
function avd_snd_susi_msg(),get_comp_capability() is called
with csi and comp as input parameter.
In the function, get_comp_capability(), there is no CtCs object available
so ctcstype_db->find returns NULL to ctcs_type.
While accessing ctcs_type->saAmfCtCompCapability,
AMfd crashes because ctcs_type is NULL.
---
src/amf/amfd/ctcstype.cc | 66
+++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 65 insertions(+), 1 deletion(-)
diff --git a/src/amf/amfd/ctcstype.cc b/src/amf/amfd/ctcstype.cc
index 5dffdae..b2524b2 100644
--- a/src/amf/amfd/ctcstype.cc
+++ b/src/amf/amfd/ctcstype.cc
@@ -27,6 +27,8 @@
#include "amf/amfd/csi.h"
AmfDb<std::string, AVD_CTCS_TYPE> *ctcstype_db = nullptr;
+void find_ct_name_from_association(const std::string &haystack,
+ std::string *dn, const char *needle);
static void ctcstype_db_add(AVD_CTCS_TYPE *ctcstype) {
unsigned int rc = ctcstype_db->insert(ctcstype->name, ctcstype);
@@ -187,16 +189,78 @@ static SaAisErrorT
ctcstype_ccb_completed_cb(CcbUtilOperationData_t *opdata) {
opdata, "Modification of SaAmfCtCsType not supported");
break;
case CCBUTIL_DELETE:
+ AVD_CTCS_TYPE *ctcstype;
+ AVD_COMP_TYPE *comp_type;
+ AVD_COMP *comp;
+ CcbUtilOperationData_t *t_opData;
+
+ ctcstype = ctcstype_db->find(Amf::to_string(&opdata->objectName));
+ if (ctcstype != nullptr) {
+ std::string ct_name;
+ find_ct_name_from_association(Amf::to_string(&opdata->objectName),
+ &ct_name, ",safVersion");
+ TRACE("'%s'", ct_name.c_str());
+ comp_type = comptype_db->find(ct_name);
+ if ((comp_type) && (nullptr != comp_type->list_of_comp)) {
+ /* check whether there exists a delete operation for
+ * each of the Comp in the comp_type list in the current CCB
+ */
+ bool comp_exist = false;
+ TRACE("SaAmfCompType '%s' has components",
comp_type->name.c_str());
+ comp = comp_type->list_of_comp;
+ while (comp != nullptr) {
+ TRACE("%s", osaf_extended_name_borrow(&comp->comp_info.name));
+ t_opData = ccbutil_getCcbOpDataByDN(opdata->ccbId,
+ &comp->comp_info.name);
+ TRACE("%p", t_opData);
+ if ((t_opData == nullptr) ||
+ (t_opData->operationType != CCBUTIL_DELETE)) {
+ TRACE("OperationType: %p", t_opData);
[Gary] Maybe replace "Here" with a more useful description.
[Phuc Chau] I replaced "Here" --> "OperationType"
+ comp_exist = true;
+ break;
+ }
+ comp = comp->comp_type_list_comp_next;
+ }
+ if (comp_exist == true) {
+ rc = SA_AIS_ERR_BAD_OPERATION;
+ report_ccb_validation_error(opdata, "SaAmfCompType '%s' is in
use",
+ comp_type->name.c_str());
+ goto done;
+ }
+ } else {
+ TRACE("SaAmfCompType '%p'. SaAmfCompType '%s' has no
components",
+ comp_type, ct_name.c_str());
+ }
+ }
rc = SA_AIS_OK;
break;
default:
osafassert(0);
break;
}
-
+done:
TRACE_LEAVE2("%u", rc);
return rc;
}
[Gary] avsv_sanamet_init() should already do what you need below.
[Phuc Chau] I have tried but Amf still crashes because avsv_sanamet_init()
still allow delete Ctcs object.
find_ct_name_from_association() can find where two times safVersion comes
but avsv_sanamet_init() only find one times safVersion
+/**
+* Initialize a DN by searching for needle in haystack
+* where two times safVersion comes.
+* @param haystack
+* @param dn
+* @param needle
+* @note: "safSupportedCsType=safVersion=1\,
+* safCSType=AmfDemo1,safVersion=1,safCompType=AmfDemo1"
+*/
+void find_ct_name_from_association(const std::string &haystack,
+ std::string *dn, const char *needle) {
+ TRACE_ENTER();
+
+ std::string::size_type pos = haystack.find(needle);
+ *dn = haystack.substr(pos + 1); ---> avsv_sanamet_init() dn =
haystack.substr(pos);
+ TRACE("dn %s", (*dn).c_str());
+
+ TRACE_LEAVE();
+}
static void ctcstype_ccb_apply_cb(CcbUtilOperationData_t *opdata) {
AVD_CTCS_TYPE *ctcstype;
--
2.7.4
---
This email has been checked for viruses by AVG.
https://www.avg.com
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel