From: praveen m. <pra...@or...> - 2014-07-03 12:18:34
|
One doubt: Description of osaf_extended_name_init(void) in osaf_extended_name.h says : ** * @brief Initialize the extended SaNameT functionality. * * This function reads the environment variable SA_ENABLE_EXTENDED_NAMES to * determine whether extended SaNameT shall be enabled or not. It shall be * called by all top-level saXxxInitialize() functions, so that it is * guaranteed to have been called before any other SAF API function. */ So do we need to call this in saNtfInitialize()? Thanks, Praveen On 02-Jul-14 11:20 AM, Minh Hon Chau wrote: > osaf/libs/agents/saf/ntfa/Makefile.am | 1 + > osaf/libs/agents/saf/ntfa/ntfa_api.c | 25 ++++++++++++++++--------- > osaf/libs/saf/libSaNtf/Makefile.am | 1 + > 3 files changed, 18 insertions(+), 9 deletions(-) > > > diff --git a/osaf/libs/agents/saf/ntfa/Makefile.am b/osaf/libs/agents/saf/ntfa/Makefile.am > --- a/osaf/libs/agents/saf/ntfa/Makefile.am > +++ b/osaf/libs/agents/saf/ntfa/Makefile.am > @@ -25,6 +25,7 @@ noinst_HEADERS = \ > noinst_LTLIBRARIES = libntfa.la > > libntfa_la_CPPFLAGS = \ > + -DSA_EXTENDED_NAME_SOURCE \ > $(AM_CPPFLAGS) \ > -I$(top_srcdir)/osaf/libs/common/ntfsv/include > > diff --git a/osaf/libs/agents/saf/ntfa/ntfa_api.c b/osaf/libs/agents/saf/ntfa/ntfa_api.c > --- a/osaf/libs/agents/saf/ntfa/ntfa_api.c > +++ b/osaf/libs/agents/saf/ntfa/ntfa_api.c > @@ -18,7 +18,8 @@ > #include <string.h> > #include "ntfa.h" > #include "ntfsv_mem.h" > - > +#include "osaf_extended_name.h" > +#include "saAis.h" > #define NCS_SAF_MIN_ACCEPT_TIME 10 > #define NTFS_WAIT_TIME 1000 > > @@ -304,9 +305,10 @@ static SaAisErrorT checkSecurityAlarmFil > static SaAisErrorT checkHeader(SaNtfNotificationHeaderT *nh) > { > int i =0; > - > - if (nh->notificationObject->length > SA_MAX_NAME_LENGTH || nh->notifyingObject->length > SA_MAX_NAME_LENGTH) { > - TRACE_1("SaNameT length too big"); > + > + if (!ntfsv_sanamet_is_valid(nh->notificationObject) || > + !ntfsv_sanamet_is_valid(nh->notifyingObject)) { > + TRACE_1("SaNameT is invaild"); > return SA_AIS_ERR_INVALID_PARAM; > } > > @@ -517,12 +519,17 @@ static SaAisErrorT fillSendStruct(SaNtfN > /* nodificationId set to zero means that this is a new notification */ > /* and not an sync message send from the server. */ > *(notificationHeader->notificationId) = 0; > + > + /* For long dn object, clone the string pointer */ > + ntfsv_sanamet_clone_strptr(notificationHeader->notificationObject); > > - if (notificationHeader->notifyingObject->length == 0) { > - notificationHeader->notifyingObject->length = notificationHeader->notificationObject->length; > - (void)memcpy(notificationHeader->notifyingObject->value, notificationHeader->notificationObject->value, > - notificationHeader->notifyingObject->length); > - } > + /* Copy notificationObject to notifyingObject if it's empty */ > + if (osaf_is_extended_name_empty(notificationHeader->notifyingObject)) > + rc = ntfsv_sanamet_copy(notificationHeader->notifyingObject, > + notificationHeader->notificationObject); > + else /* Not empty and it's long dn object, clone the string pointer */ > + ntfsv_sanamet_clone_strptr(notificationHeader->notifyingObject); > + > return rc; > } > > diff --git a/osaf/libs/saf/libSaNtf/Makefile.am b/osaf/libs/saf/libSaNtf/Makefile.am > --- a/osaf/libs/saf/libSaNtf/Makefile.am > +++ b/osaf/libs/saf/libSaNtf/Makefile.am > @@ -29,6 +29,7 @@ lib_LTLIBRARIES = libSaNtf.la > libSaNtf_la_SOURCES = > > libSaNtf_la_CPPFLAGS = \ > + -DSA_EXTENDED_NAME_SOURCE \ > $(AM_CPPFLAGS) > > if HAVE_LD_VERSION_SCRIPT |