Ack, code review only, one minor comment, use strncmp instead of strcmp. /Thanks HansN
-----Original Message----- From: nagendr...@oracle.com [mailto:nagendr...@oracle.com] Sent: den 20 februari 2015 09:24 To: Hans Nordebäck; praveen.malv...@oracle.com Cc: opensaf-devel@lists.sourceforge.net Subject: [PATCH 1 of 1] amfd: validate parent name of SI and its protecting SG [#1161] osaf/services/saf/amf/amfd/si.cc | 13 ++++++++++++- 1 files changed, 12 insertions(+), 1 deletions(-) If SI and its protecting SG belong to different application, then Amf throws errors while assigning SIs to SUs. This is because there will not be any compcsi matching with SI and its protecting SG. SO, now added validation for making sure SI and its protecting SG belong to the same application, else throws errors during SI creation. diff --git a/osaf/services/saf/amf/amfd/si.cc b/osaf/services/saf/amf/amfd/si.cc --- a/osaf/services/saf/amf/amfd/si.cc +++ b/osaf/services/saf/amf/amfd/si.cc @@ -472,7 +472,7 @@ static int is_config_valid(const SaNameT SaAisErrorT rc; SaNameT aname; SaAmfAdminStateT admstate; - char *parent; + char *parent, *app; if ((parent = strchr((char*)dn->value, ',')) == NULL) { report_ccb_validation_error(opdata, "No parent to '%s' ", dn->value); @@ -518,6 +518,17 @@ static int is_config_valid(const SaNameT } } + /* saAmfSIProtectedbySG and SI should belong to the same applicaion. */ + if ((app = strchr((char*)aname.value, ',')) == NULL) { + report_ccb_validation_error(opdata, "No parent to '%s' ", aname.value); + return 0; + } + if (strcmp(parent, ++app)) { + report_ccb_validation_error(opdata, "SI '%s' and SG '%s' belong to different application", + dn->value, aname.value); + return 0; + } + if ((immutil_getAttr(const_cast<SaImmAttrNameT>("saAmfSIAdminState"), attributes, 0, &admstate) == SA_AIS_OK) && !avd_admin_state_is_valid(admstate)) { report_ccb_validation_error(opdata, "Invalid saAmfSIAdminState %u for '%s'", admstate, dn->value); ------------------------------------------------------------------------------ Dive into the World of Parallel Programming The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ _______________________________________________ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel