Hi Minh,
This is regarding saNtfPtrValAllocate() and saNtfPtrValGet().
These APIs will have to handle SA_NTF_VALUE_LDAP_NAME of SaNameT type also.
When saNtfPtrValAllocate() API is used with for sending long DN for
SA_NTF_VALUE_STRING of string type , receiver is getting the sent value
using saNtfPtrValGet(). But the same API does not work for
SA_NTF_VALUE_LDAP_NAME , notification send
is successful, but saNtfPtrValGet() does not give the sent value and
application (ntfsubscribe utility) crashes while
accessing the value in ntfs_sanamet_strdup().
I am trying to understand/debug if some changes are needed in these
APIs or in ntfs_sanamet_strdup() or the way we need to fill
long DN values in the memory allocated using saNtfPtrValAllocate(). If
you have some information please share.
Thanks
Praveen
On 09-Jul-14 10:42 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);
> - }
> + /* 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
------------------------------------------------------------------------------
Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 and Gartner awards
http://p.sf.net/sfu/Bonitasoft
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel