2

We have developed the tools to read the emails from the Domino mailboxes and write those into the separate file in local disk(Its look like a backup). Recently we have created a new domino 9 test environment with our lab. But, our tools not working properly with our new domino work environment. To identify the problem about this issue, I have added some debug logs and it seems to look like the control hanged with the function "NAMELookup2". Here, I have added the code snippet,

DHANDLE  hLookup;
char   *pLookup;
if (NAMELookup2("Local", 0, 1, "$users", 1, dominoUser, 2, "FullName", &hLookup) == NOERROR) // hunged with this line
{
     pLookup = (char *) OSLockObject(hLookup);
}

The same tool working fine with our other test environment. So, I think there is no problem with the code. I suspect that maybe the problem with our new work environment setup creation, or maybe missed to provide some kind permission to the users, or maybe I missed to add the mailboxes somewhere, etc.

Note:

  1. I have run the tool with admin privilege user.

It would be great if anyone gives some direction on this.

Thanks,

Ramachandran
  • 103
  • 12
  • 1
    Maybe it's trying to resolve `"Local"` to an actual server address. Do you see the same behavior when the first argument is `NULL`? Also, why is `NumItems` equal to 2? It looks like you are only requesting the `FullName` item. – Dave Delay Mar 13 '19 at 18:13
  • There are definitely cases where, as long as the name passed to the API resolves to a server address, Notes doesn't actually care if the name actually matches the ID of the server that it connects to. So taking Dave's comment one step further, one possibility is that your old test environment had a hosts file entry for "Local" that returned the IP address of a Domino server, or even a connection document in names.nsf that does the same. If your old test environment still exists, run the Notes client and try out the trace function using 'Local' as the server name. – Richard Schwartz Mar 14 '19 at 01:29

1 Answers1

0

See this NAMELookup2 page for reference. The function is declared as:

STATUS LNPUBLIC NAMELookup2(const char far *ServerName, DWORD Flags,
    WORD NumNameSpaces, const char far *NameSpaces,
    WORD NumNames, const char far *Names,
    WORD NumItems, const char far *Items,
    DHANDLE far *rethBuffer);

where NumItems is the number of null-terminated item names starting at the Items address. The code snippet in your question is passing a single item name ("FullName"), but is setting NumItems to 2. That is clearly wrong and could explain the hang. NumItems should be 1.

I am also suspicious of the ServerName argument. The documentation recommends passing NULL when you want to do a local lookup. Passing "Local" may be another way to accomplish the same, but you need to change your code in any case. I recommend changing the first argument to NULL.

Dave Delay
  • 1,292
  • 8
  • 12