Hi all, I've tested the attached patch, which seems to do the right thing. Can I ask for a review and application please?
This does not fix the issue with no result row being returned - that looks like a separate problem to me. Thanks, Shaheed On 25 January 2012 18:04, Shaheed Haque <srha...@theiet.org> wrote: > Hi, > > I'm having a little difficulty with the usage of nspi_SeekEntries. I an > calling it apparently successfully in that it does not return an error, but > a subsequent call to GetGalTable always seems to return data from the > beginning. FWIW, the code is equivalent to: > > key.ulPropTag = (MAPITAGS)PR_DISPLAY_NAME_UNICODE; > key.dwAlignPad = 0; > key.value.lpszW = talloc_strdup(mem.ctx(), displayName.toUtf8().data()); > if (MAPI_E_SUCCESS != nspi_SeekEntries(nspi, mem.ctx(), > SortTypeDisplayName, &key, tags, NULL, results)) { > error() << "cannot seek to GAL entry" << displayName << mapiError(); > return false; > } > if (MAPI_E_SUCCESS != GetGALTable(m_session, tags, results, > requestedCount, TABLE_CUR)) { > error() << "cannot read GAL entries" << mapiError(); > return false; > } > > [ Interestingly, note that the "results" value from the first call is > always NULL, rather than the relevant row, but I'm not sure if that is > another problem or not. ] > > Now, looking at the implementation of GetGALTable, when TABLE_CUR is > specified, I think it expects to use the values previously stored in > the nspi->pStat to do the fetch. And indeed, after the fetch, it updates > the stored value. But AFAICS, nspi_SeekEntries does not update the stored > value - that seems like the problem to me. In other words, the bottom of > this function should look like the bottom of GetGALTable: > > OPENCHANGE_RETVAL_IF(!NT_STATUS_IS_OK(status), retval, NULL); > OPENCHANGE_RETVAL_IF(retval, retval, NULL); > > + nspi_ctx->pStat->CurrentRec = r.out.pStat->CurrentRec; > + nspi_ctx->pStat->Delta = r.out.pStat->Delta; > + nspi_ctx->pStat->NumPos = r.out.pStat->NumPos; > + nspi_ctx->pStat->TotalRecs = r.out.pStat->TotalRecs; > > return MAPI_E_SUCCESS; > > Assuming that sounds reasonable, would a patch be acceptable? > > Thanks, Shaheed > >
diff -p -r -C 5 openchange-0.11-TRANSPORTER/libmapi/nspi.c openchange-0.11-TRANSPORTER-fixed/libmapi/nspi.c *** openchange-0.11-TRANSPORTER/libmapi/nspi.c 2011-06-19 01:47:21.000000000 +0100 --- openchange-0.11-TRANSPORTER-fixed/libmapi/nspi.c 2012-01-25 21:39:35.120230908 +0000 *************** _PUBLIC_ enum MAPISTATUS nspi_SeekEntrie *** 377,386 **** --- 377,391 ---- status = dcerpc_NspiSeekEntries_r(nspi_ctx->rpc_connection->binding_handle, mem_ctx, &r); retval = r.out.result; OPENCHANGE_RETVAL_IF(!NT_STATUS_IS_OK(status), retval, pStat); OPENCHANGE_RETVAL_IF(retval, retval, pStat); + nspi_ctx->pStat->CurrentRec = r.out.pStat->CurrentRec; + nspi_ctx->pStat->Delta = r.out.pStat->Delta; + nspi_ctx->pStat->NumPos = r.out.pStat->NumPos; + nspi_ctx->pStat->TotalRecs = r.out.pStat->TotalRecs; + return MAPI_E_SUCCESS; } /**
_______________________________________________ devel mailing list devel@lists.openchange.org http://mailman.openchange.org/listinfo/devel