Ack for both the patches.
Thanks,
Praveen
On 08-Sep-14 1:05 PM, Hans Feldt wrote:
> osaf/services/saf/amf/amfd/ctcstype.cc | 24 ++++++++++++++++
> osaf/services/saf/amf/amfd/imm.cc | 7 ++--
> osaf/services/saf/amf/amfd/include/util.h | 1 +
> osaf/services/saf/amf/amfd/util.cc | 45
> +++++++++++++++++++++++++++++++
> 4 files changed, 74 insertions(+), 3 deletions(-)
>
>
> AMF allows to create a SaAmfCtCsType object although the SaAmfCSType object
> referred to does not exist.
>
> Fix by looking up the SaAmfCSType DN in the SaAmfCSType database.
>
> diff --git a/osaf/services/saf/amf/amfd/ctcstype.cc
> b/osaf/services/saf/amf/amfd/ctcstype.cc
> --- a/osaf/services/saf/amf/amfd/ctcstype.cc
> +++ b/osaf/services/saf/amf/amfd/ctcstype.cc
> @@ -20,8 +20,10 @@
> #include <immutil.h>
> #include <logtrace.h>
>
> +#include <include/util.h>
> #include <comp.h>
> #include <imm.h>
> +#include <include/csi.h>
>
> AmfDb<std::string, AVD_CTCS_TYPE> *ctcstype_db = NULL;
>
> @@ -35,6 +37,28 @@ static int is_config_valid(const SaNameT
> {
> SaUint32T uint32;
> char *parent;
> + SaNameT cstype_dn;
> +
> + if (get_child_dn_from_ass_dn(dn, &cstype_dn) != 0) {
> + report_ccb_validation_error(opdata, "malformed DN '%s'",
> dn->value);
> + return 0;
> + }
> +
> + if (cstype_db->find(Amf::to_string(&cstype_dn)) == NULL) {
> + if (opdata == NULL) {
> + report_ccb_validation_error(opdata,
> + "SaAmfCSType object '%s' does not exist in
> model",
> + cstype_dn.value);
> + return 0;
> + }
> +
> + if (ccbutil_getCcbOpDataByDN(opdata->ccbId, &cstype_dn) ==
> NULL) {
> + report_ccb_validation_error(opdata,
> + "SaAmfCSType object '%s' does not exist in
> model or CCB",
> + cstype_dn.value);
> + return 0;
> + }
> + }
>
> /* Second comma should be parent */
> if ((parent = strchr((char*)dn->value, ',')) == NULL) {
> diff --git a/osaf/services/saf/amf/amfd/imm.cc
> b/osaf/services/saf/amf/amfd/imm.cc
> --- a/osaf/services/saf/amf/amfd/imm.cc
> +++ b/osaf/services/saf/amf/amfd/imm.cc
> @@ -1363,6 +1363,10 @@ unsigned int avd_imm_config_get(void)
> ** reported either. Off line tools can do this better.
> */
>
> + /* SaAmfCSType needed by validation of SaAmfCtCsType */
> + if (avd_cstype_config_get() != SA_AIS_OK)
> + goto done;
> +
> /* SaAmfCompType indirectly needed by SaAmfSUType */
> if (avd_comptype_config_get() != SA_AIS_OK)
> goto done;
> @@ -1381,9 +1385,6 @@ unsigned int avd_imm_config_get(void)
> if (avd_svctype_config_get() != SA_AIS_OK)
> goto done;
>
> - if (avd_cstype_config_get() != SA_AIS_OK)
> - goto done;
> -
> if (avd_compglobalattrs_config_get() != SA_AIS_OK)
> goto done;
>
> diff --git a/osaf/services/saf/amf/amfd/include/util.h
> b/osaf/services/saf/amf/amfd/include/util.h
> --- a/osaf/services/saf/amf/amfd/include/util.h
> +++ b/osaf/services/saf/amf/amfd/include/util.h
> @@ -96,6 +96,7 @@ struct avd_comp_tag;
> struct avd_comp_csi_rel_tag;
> struct avd_csi_tag;
>
> +int get_child_dn_from_ass_dn(const SaNameT *ass_dn, SaNameT *child_dn);
> void avd_d2n_reboot_snd(struct avd_avnd_tag *node);
> void amflog(int priority, const char *format, ...);
> void d2n_msg_free(AVD_DND_MSG *msg);
> diff --git a/osaf/services/saf/amf/amfd/util.cc
> b/osaf/services/saf/amf/amfd/util.cc
> --- a/osaf/services/saf/amf/amfd/util.cc
> +++ b/osaf/services/saf/amf/amfd/util.cc
> @@ -1717,3 +1717,48 @@ void amflog(int priority, const char *fo
> saflog(priority, amfSvcUsrName, "%s", str);
> }
> }
> +
> +/**
> + * Gets child DN from an association DN
> + * "safDepend=safSi=SC2-NoRed\,safApp=OpenSAF,safSi=SC-2N,safApp=OpenSAF"
> + * @param ass_dn association DN [in]
> + * @param child_dn [out]
> + * @return 0 at success
> + */
> +int get_child_dn_from_ass_dn(const SaNameT *ass_dn, SaNameT *child_dn)
> +{
> + SaNameT _ass_dn = *ass_dn;
> +
> + /* find first comma and step past it */
> + char *p = strchr((char *)_ass_dn.value, ',');
> + if (p == NULL)
> + return -1;
> +
> + p++;
> +
> + /* find second comma, an error if not found */
> + p = strchr(p, ',');
> + if (p == NULL)
> + return -1;
> +
> + *p = '\0'; /* null terminate at comma before parent */
> +
> + /* Skip past the RDN tag */
> + p = strchr((char *)_ass_dn.value, '=');
> + if (p == NULL)
> + return -1;
> +
> + p++;
> +
> + /* copy and skip back slash */
> + int i = 0;
> + while (*p) {
> + if (*p != '\\')
> + child_dn->value[i++] = *p;
> + p++;
> + }
> +
> + child_dn->value[i] = '\0';
> + child_dn->length = i;
> + return 0;
> +}
>
> ------------------------------------------------------------------------------
> Want excitement?
> Manually upgrade your production database.
> When you want reliability, choose Perforce
> Perforce version control. Predictably reliable.
> http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk
> _______________________________________________
> Opensaf-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/opensaf-devel
>
------------------------------------------------------------------------------
Slashdot TV. Video for Nerds. Stuff that Matters.
http://pubads.g.doubleclick.net/gampad/clk?id=160591471&iu=/4140/ostg.clktrk
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel