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); - } + /* If notifyingObject is empty, its default value is notificationObject */ + 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 ------------------------------------------------------------------------------ Want fast and easy access to all the code in your enterprise? Index and search up to 200,000 lines of code with a free copy of Black Duck Code Sight - the same software that powers the world's largest code search on Ohloh, the Black Duck Open Hub! Try it now. http://p.sf.net/sfu/bds _______________________________________________ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel