Nack.

In general, not only instantiate, but other clc commands has to be validated at 
amfd.
Logic should be 
if (saAmfCtSwBundle is configured), then clc commands should not start with /.
Else
if (saAmfCtSwBundle is not configured), then clc commands should start with /.

Thanks
-Nagu

> -----Original Message-----
> From: Hans Feldt [mailto:osafde...@gmail.com]
> Sent: 07 January 2014 02:07
> To: Nagendra Kumar
> Cc: opensaf-devel@lists.sourceforge.net
> Subject: [PATCH 1 of 2] amfd: require saAmfCtSwBundle when relpath in CLC-
> CLI cmds [#662]
> 
>  osaf/services/saf/amf/amfd/comptype.cc |  24 +++++++++++++-----------
>  1 files changed, 13 insertions(+), 11 deletions(-)
> 
> 
> diff --git a/osaf/services/saf/amf/amfd/comptype.cc
> b/osaf/services/saf/amf/amfd/comptype.cc
> --- a/osaf/services/saf/amf/amfd/comptype.cc
> +++ b/osaf/services/saf/amf/amfd/comptype.cc
> @@ -108,11 +108,6 @@ static AVD_COMP_TYPE *comptype_create(co
> 
> 
>       (void)immutil_getAttr(const_cast<SaImmAttrNameT>("saAmfCtSwBun
> dle"), attributes, 0, &compt->saAmfCtSwBundle);
> 
> -     if (!IS_COMP_PROXIED(compt->saAmfCtCompCategory) &&
> IS_COMP_LOCAL(compt->saAmfCtCompCategory)) {
> -        error =
> immutil_getAttr(const_cast<SaImmAttrNameT>("saAmfCtSwBundle"),
> attributes, 0, &compt->saAmfCtSwBundle);
> -             osafassert(error == SA_AIS_OK);
> -     }
> -
>       if ((str = immutil_getStringAttr(attributes, "saAmfCtDefCmdEnv", 0)) !=
> NULL)
>               strcpy(compt->saAmfCtDefCmdEnv, str);
> 
>       (void)immutil_getAttr(const_cast<SaImmAttrNameT>("saAmfCtDefClcC
> liTimeout"), attributes, 0, &compt->saAmfCtDefClcCliTimeout);
> @@ -231,16 +226,23 @@ static int is_config_valid(const SaNameT
>       ** non-proxied local components".
>       */
>       if (!(IS_COMP_PROXIED(category) ||
> IS_COMP_PROXIED_NPI(category)) && IS_COMP_LOCAL(category)) {
> +             const char *cmd = immutil_getStringAttr(attributes,
> "saAmfCtRelPathInstantiateCmd", 0);
> 
> -             if
> (immutil_getAttr(const_cast<SaImmAttrNameT>("saAmfCtSwBundle"),
> attributes, 0, &name) != SA_AIS_OK) {
> -                     report_ccb_validation_error(opdata, "Required
> attribute saAmfCtSwBundle not configured for '%s'",
> -                                     dn->value);
> +             if (cmd == NULL) {
> +                     report_ccb_validation_error(opdata,
> +                                     "Required attribute
> saAmfCtRelPathInstantiateCmd not configured"
> +                                     " for '%s'", dn->value);
>                       return 0;
>               }
> 
> -             if (immutil_getStringAttr(attributes,
> "saAmfCtRelPathInstantiateCmd", 0) == NULL) {
> -                     report_ccb_validation_error(opdata, "Required
> attribute saAmfCtRelPathInstantiateCmd not configured"
> -                                     " for '%s'", dn->value);
> +             // saAmfCtSwBundle required but only if cmd is a relative path
> +             if ((cmd[0] != '/') &&
> +
>       (immutil_getAttr(const_cast<SaImmAttrNameT>("saAmfCtSwBundle"),
> +                                                      attributes, 0, &name)
> != SA_AIS_OK)) {
> +                     report_ccb_validation_error(opdata,
> +                                     "saAmfCtRelPathInstantiateCmd is not
> an absolute path and"
> +                                     "attribute saAmfCtSwBundle is not
> configured for '%s'",
> +                                     dn->value);
>                       return 0;
>               }
>       }

------------------------------------------------------------------------------
WatchGuard Dimension instantly turns raw network data into actionable 
security intelligence. It gives you real-time visual feedback on key
security issues and trends.  Skip the complicated setup - simply import
a virtual appliance and go from zero to informed in seconds.
http://pubads.g.doubleclick.net/gampad/clk?id=123612991&iu=/4140/ostg.clktrk
_______________________________________________
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to