Hi Praveen,
Normally the way using saNtfPTrValAllocate() is, passing
sizeof(SaNameT) to *dataSize*, and copying the memory block of SaNameT
to *dataPtr*
A mount *dataSize* of bytes is reserved in variable_data which the
content of SaNameT will be written on.
Thus the way saNtfPtrValAllocate() allocating memory is a problem for
extended SaNameT, the comprehensive SaNameT will not be in variable_data.
My initial thought is to re-arrange the variable_data in order to
include the entire SaNameT, still figuring out where the best place to
do that.
Do you have any ideas?
Thanks,
Minh
On 7/11/2014 4:47 PM, minhchau wrote:
> Apparently I have to add the test case for these APIs for ntftest, and
> will see if I can get the same issue.
>
> Thanks,
> Minh
> On 7/11/2014 4:15 PM, praveen malviya wrote:
>> 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
>>
>>
>
------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel