I'm using the NWDSReadReferences(DS_ATTRUBUTE_VALUES) call to read the
references of eDirectory objects. The function seems to return invalid data
as soon as the size of the returned data exceeds MAX_MESSAGE_LEN (= 63k) bytes.
The different functions used to read data from the buffer most of the time
return error code 0xFFFFFECD (ERR_BUFFER_EMPTY) once the first 63k has been
parsed.
Anyone out there seen this behavior?
This is the code I'm executing to parse the references:
########################################################
long iIteration = NO_MORE_ITERATIONS;
do
{
Buf_T *pObjInfo = NULL;
nuint32 nObjs = 0;
if ( rc = NWDSAllocBuf(DEFAULT_MESSAGE_LEN, &pObjInfo) )
{
Log(TEXT("ERR: NWDSAllocBuf() - error %p\n"), rc);
}
else if ( rc = NWDSReadReferences(Ctxt, ServerDN, Object,
DS_ATTRUBUTE_VALUES, true, NULL, 1, &iIteration, pObjInfo) )
{
Log(TEXT("ERR: NWDSReadReferences() - error %p\n"), rc);
}
else if ( rc = NWDSGetObjectCount(Ctxt, pObjInfo, &nObjs) )
{
Log(TEXT("ERR: NWDSGetObjectCount() - error %p\n"), rc);
}
else
{
for ( nuint32 iObj = 0 ; iObj < nObjs && rc == 0 ; iObj++ )
{
Object_Info_T OI;
TCHAR strObjName[MAX_DN_CHARS+1];
nuint32 AttrCount = 0;
if ( rc = NWDSGetObjectName(Ctxt, pObjInfo, (char *)strObjName,
&AttrCount, &OI) )
{
Log(TEXT("ERR: NWDSGetObjectName() - error %p\n"), rc);
}
else
{
for ( nuint32 iAttr = 0 ; iAttr < AttrCount && rc == 0 ; iAttr++ )
{
TCHAR strAttrName[MAX_DN_CHARS+1];
nuint32 AttrValCount = 0;
nuint32 SyntaxID = 0;
if ( rc = NWDSGetAttrName(Ctxt, pObjInfo, (char *)strAttrName,
&AttrValCount, &SyntaxID) )
{
Log(TEXT("ERR: NWDSGetAttrName() failed - error %p\n"), rc);
}
else
{
for ( nuint32 iVal = 0 ; iVal < AttrValCount && rc == 0 ; iVal++ )
{
nuint32 AttrValSize = 0;
if ( rc = NWDSComputeAttrValSize(Ctxt, pObjInfo, SyntaxID,
&AttrValSize) )
{
Log(TEXT("ERR: NWDSComputeAttrValSize() - error %p\n"), rc);
}
else if ( LPTSTR pAttrVal = (LPTSTR)malloc(AttrValSize + 1) )
{
if ( rc = NWDSGetAttrVal(Ctxt, pObjInfo, SyntaxID, pAttrVal) )
{
Log(TEXT("ERR: NWDSGetAttrVal() - error %p\n"), rc);
}
else
{
// Handle the data
}
free(pAttrVal);
}
else
{
Log(TEXT("ERR: malloc() failed\n"));
rc = ERR_NOT_ENOUGH_MEMORY;
}
}
}
}
}
}
}
if ( pObjInfo ) NWDSFreeBuf(pObjInfo);
}
while ( rc == 0 && iIteration != NO_MORE_ITERATIONS );
########################################################
Regards, Vincent
I had lots of problem with this funtion too. Have you tried a smaller
buffer like 15*DEFAULT_MESSAGE_LEN. This works for me.
Kind regards,
Hans Boone
Hans,
I just tried it - doesn't help :-(
Vincent
Sorry for the long delay, had to write a small program to test this.
I can't reproduce the problem with client based program (My NLM
programming skills aren't good enough :( ).
Have you tried to read the information from the master replica? (only
collecting the link information for the "master-server" will fail).
Have you tried to run the program with DS_ATTRUBUTE_NAMES? Does it fail too?
Hans
When using DS_ATTRUBUTE_NAMES only, I have no problems.
I only have problems when running it from windows. I tested it with a
client running on Windows XP SP2 interrogating eDir 8.7.x on Netware 6.5
and eDir 8.7.x and 8.8 on Windows 2000.
Vincent