Hi Lennart,
Reviewed the patch.
Ack.
/Neel.
On 2016/08/29 01:09 PM, Lennart Lund wrote:
> osaf/services/saf/smfsv/smfd/SmfCampaignXmlParser.cc | 36
> +++++++++++++------
> osaf/services/saf/smfsv/smfd/SmfUtils.cc | 29 +++++++++++-----
> osaf/services/saf/smfsv/smfd/smfd.h | 1 -
> osaf/services/saf/smfsv/smfd/smfd_cb.h | 1 +
> osaf/services/saf/smfsv/smfd/smfd_main.c | 2 +
> osaf/services/saf/smfsv/smfnd/smfnd_main.c | 3 +
> 6 files changed, 51 insertions(+), 21 deletions(-)
>
>
> Allow all IMM objects to have long DN
>
> diff --git a/osaf/services/saf/smfsv/smfd/SmfCampaignXmlParser.cc
> b/osaf/services/saf/smfsv/smfd/SmfCampaignXmlParser.cc
> --- a/osaf/services/saf/smfsv/smfd/SmfCampaignXmlParser.cc
> +++ b/osaf/services/saf/smfsv/smfd/SmfCampaignXmlParser.cc
> @@ -33,6 +33,7 @@
>
> #include "logtrace.h"
> #include "saImm.h"
> +#include "osaf_extended_name.h"
>
> #include "SmfUtils.hh"
>
> @@ -369,25 +370,38 @@ bool
> SmfCampaignXmlParser::parseUpgradeProcedure(SmfUpgradeProcedure * io_up,
> xmlNode * i_node)
> {
> TRACE_ENTER();
> - char *s;
> + char *procedure_name;
> xmlNsPtr ns = 0;
> xmlNode *cur = i_node->xmlChildrenNode;
>
> - if ((s = (char *)xmlGetProp(i_node, (const xmlChar
> *)"safSmfProcedure"))) {
> - int procLen = strlen (s);
> - if (procLen > OSAF_MAX_RDN_LENGTH) {
> - LOG_NO("SmfCampaignXmlParser::parseUpgradeProcedure:
> Procedure name too long %d (max %d), %s", procLen, OSAF_MAX_RDN_LENGTH, s);
> - xmlFree(s);
> + /* LLDCOM
> + * Run osaf_extended_name_init() in appropriate place.
> + * Use functions in osaf_extended_name.h for checks etc...
> + */
> +
> + TRACE("LLDTEST: osaf_is_extended_names_enabled() = %d",
> osaf_is_extended_names_enabled());
> + procedure_name = (char *)xmlGetProp(i_node, (const xmlChar
> *)"safSmfProcedure");
> + if (procedure_name != 0)
> + {
> + int procLen = strlen (procedure_name);
> + if (!osaf_is_extended_names_enabled() &&
> + procLen > OSAF_MAX_RDN_LENGTH) {
> + LOG_NO("SmfCampaignXmlParser::parseUpgradeProcedure:
> "
> + "Procedure name too long %d (max %d), %s",
> + procLen, OSAF_MAX_RDN_LENGTH, procedure_name);
> + xmlFree(procedure_name);
> TRACE_LEAVE();
> return false;
> }
>
> - io_up->setProcName(s);
> - xmlFree(s);
> + io_up->setProcName(procedure_name);
> + xmlFree(procedure_name);
> }
> - if ((s = (char *)xmlGetProp(i_node, (const xmlChar
> *)"saSmfExecLevel"))) {
> - io_up->setExecLevel(s);
> - xmlFree(s);
> +
> + procedure_name = (char *)xmlGetProp(i_node, (const xmlChar
> *)"saSmfExecLevel");
> + if (procedure_name != 0) {
> + io_up->setExecLevel(procedure_name);
> + xmlFree(procedure_name);
> }
>
> m_actionId = 1; // reset action id for init actions
> diff --git a/osaf/services/saf/smfsv/smfd/SmfUtils.cc
> b/osaf/services/saf/smfsv/smfd/SmfUtils.cc
> --- a/osaf/services/saf/smfsv/smfd/SmfUtils.cc
> +++ b/osaf/services/saf/smfsv/smfd/SmfUtils.cc
> @@ -751,7 +751,8 @@ SmfImmUtils::read_IMM_long_DN_config_and
> * since once it is enabled, is never turned off again.
> */
> if(cb->maxDnLength == maxDnLength) {
> - TRACE("read_IMM_long_DN_config_and_set_control_block(): Long
> DNs already enabled");
> + TRACE("read_IMM_long_DN_config_and_set_control_block(): "
> + "Long DNs already enabled");
> TRACE_LEAVE();
> return true;
> }
> @@ -760,25 +761,35 @@ SmfImmUtils::read_IMM_long_DN_config_and
> * to make sure that a value is set,
> * even if this function fails to get the config from IMM.
> */
> - cb->maxDnLength = DEFAULT_MAX_DN_LENGTH;
> + //cb->maxDnLength = DEFAULT_MAX_DN_LENGTH;
> + cb->maxDnLength = SA_MAX_UNEXTENDED_NAME_LENGTH - 1;
>
> SaImmAttrValuesT_2 **attributes;
>
> if(getObject(IMM_CONFIG_OBJECT_DN, &attributes) == false) {
> - LOG_ER("Could not get IMM config object from IMM %s",
> IMM_CONFIG_OBJECT_DN);
> + LOG_ER("Could not get IMM config object from IMM %s",
> + IMM_CONFIG_OBJECT_DN);
> TRACE_LEAVE();
> return false;
> }
>
> - const SaUint32T *longDnsAllowed = immutil_getUint32Attr((const
> SaImmAttrValuesT_2 **)attributes, IMM_LONG_DN_CONFIG_ATTRIBUTE_NAME, 0);
> + const SaUint32T *longDnsAllowed = immutil_getUint32Attr(
> + (const SaImmAttrValuesT_2 **)attributes,
> + IMM_LONG_DN_CONFIG_ATTRIBUTE_NAME, 0);
> if(longDnsAllowed) {
> TRACE("%s=%u", IMM_LONG_DN_CONFIG_ATTRIBUTE_NAME,
> *longDnsAllowed);
> - if(*longDnsAllowed == 0)
> - cb->maxDnLength = DEFAULT_MAX_DN_LENGTH;
> - else
> + if(*longDnsAllowed == 0) {
> + cb->maxDnLength = SA_MAX_UNEXTENDED_NAME_LENGTH - 1;
> + }
> + else {
> cb->maxDnLength = maxDnLength;
> - } else
> - LOG_NO("Could not get long DN config [%s %s], use default DN
> length", IMM_LONG_DN_CONFIG_ATTRIBUTE_NAME, IMM_CONFIG_OBJECT_DN);
> + }
> + } else {
> + LOG_NO("Could not get long DN config [%s %s], "
> + "use default DN length",
> + IMM_LONG_DN_CONFIG_ATTRIBUTE_NAME,
> IMM_CONFIG_OBJECT_DN);
> + }
> +
> TRACE_LEAVE();
> return true;
> }
> diff --git a/osaf/services/saf/smfsv/smfd/smfd.h
> b/osaf/services/saf/smfsv/smfd/smfd.h
> --- a/osaf/services/saf/smfsv/smfd/smfd.h
> +++ b/osaf/services/saf/smfsv/smfd/smfd.h
> @@ -48,7 +48,6 @@ extern "C" {
> * DEFINITIONS
> * ========================================================================
> */
> -#define DEFAULT_MAX_DN_LENGTH 255
> #define IMM_CONFIG_OBJECT_DN "opensafImm=opensafImm,safApp=safImmService"
> #define IMM_LONG_DN_CONFIG_ATTRIBUTE_NAME "longDnsAllowed"
> #define SMF_SAF_APP_DN "safApp=safSmfService"
> diff --git a/osaf/services/saf/smfsv/smfd/smfd_cb.h
> b/osaf/services/saf/smfsv/smfd/smfd_cb.h
> --- a/osaf/services/saf/smfsv/smfd/smfd_cb.h
> +++ b/osaf/services/saf/smfsv/smfd/smfd_cb.h
> @@ -75,6 +75,7 @@ typedef struct smfd_cb {
>
> SMF_MERGE_TO_SINGLE_STEP 1
>
> SMF_MERGE_TO_NODE_ROLLING 2
> */
> + bool long_dn_allowed;
>
> } smfd_cb_t;
>
> diff --git a/osaf/services/saf/smfsv/smfd/smfd_main.c
> b/osaf/services/saf/smfsv/smfd/smfd_main.c
> --- a/osaf/services/saf/smfsv/smfd/smfd_main.c
> +++ b/osaf/services/saf/smfsv/smfd/smfd_main.c
> @@ -251,6 +251,8 @@ static uint32_t initialize_smfd(void)
> goto done;
> }
>
> + osaf_extended_name_init();
> +
> /* Initialize smfd control block */
> if (smfd_cb_init(smfd_cb) != NCSCC_RC_SUCCESS) {
> TRACE("smfd_cb_init FAILED");
> diff --git a/osaf/services/saf/smfsv/smfnd/smfnd_main.c
> b/osaf/services/saf/smfsv/smfnd/smfnd_main.c
> --- a/osaf/services/saf/smfsv/smfnd/smfnd_main.c
> +++ b/osaf/services/saf/smfsv/smfnd/smfnd_main.c
> @@ -215,6 +215,9 @@ static void main_process(void)
> */
> int main(int argc, char *argv[])
> {
> + if(setenv("SA_ENABLE_EXTENDED_NAMES", "1", 1) != 0)
> + LOG_WA("smfd_main(): failed to setenv SA_ENABLE_EXTENDED_NAMES "
> + "- %s",strerror(errno));
> daemonize_as_user("root", argc, argv);
>
> if (ncs_agents_startup() != NCSCC_RC_SUCCESS) {
------------------------------------------------------------------------------
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel