I am trying to get a list of...
Articles and Tips: qna
01 Jan 2003
Q.
I am trying to get a list of all of the NLMs running on a NetWare server. I try to get a list of loaded NLM sequence numbers by performing the following:
ccode = NWGetNLMLoadedList(HConn, startNum, &NLMList);
This returns
error 35270 0x89C6 NO_CONSOLE_PRIVILEGES
I have setup the user who is logging in with Console operator rights. Why would I be getting an error stating NO_CONSOLE_PRIVILEGES when the console privileges are set for the user?
A.
What is the starting NLM number that you are asking for? You are supposed to start at zero and then iterate through as many calls as are necessary to retrieve all of the blocks of information about all of the NLMs that are loaded on the server.
The key thing here is to check whether or not the connection handle has been authenticated. If you connect to the server but don't authenticate your connection handle, then the server won't know who you are and thus you will get the NO_CONSOLE_PRIVILEGES error. The connection does not need to be licensed.
Here's a snippet of code from a program that uses NWGetNLMLoadedList(). You will need to replace the calls to REPORTERROR() and XAllocPrintf() with calls to printf() or just eliminate them; these two functions are helper functions from other parts of my program and they aren't defined here.
NWFSE_NLM_LOADED_LIST fseNLMLoadedList; nuint32 uNextNLMNum = 0; LPSTR szItemBuf = NULL; LONG nItemBufSize = 0; LONG i = 0; // Assume that we have an authenticated connection handle to the server. // Get some information about the server that can only be // obtained from NetWare 4.x and newer servers. while (TRUE) { ccode = NWGetNLMLoadedList ( hConn, uNextNLMNum, &fseNLMLoadedList ); if ((ccode) && (ccode != NWE_FAILURE)) { if (szItemBuf) free(szItemBuf); NWCCCloseConn(hConn); REPORTERROR(ccode,"NWGetNLMLoadedList() : WWNWX_GetServerNLMInfo()"); switch (ccode) { case NO_CONSOLE_PRIVILEGES: return WWNW_EC_NO_CONSOLE_PRIVS; default: return WWNW_EC_FUNCTION_FAILED; } } if (ccode == NWE_FAILURE) break; for (i = 0; (nuint32) i < fseNLMLoadedList.NLMsInList; i++) { nItemBufSize = xAllocPrintf ( &szItemBuf, "%s%u%s", xNullToEmpty(szItemBuf), fseNLMLoadedList.NLMNums[i], g_szValueDelim ); if (!szItemBuf) { NWCCCloseConn(hConn); REPORTERROR(0,"calloc() : WWNWX_GetServerNLMInfo()"); return WWNW_EC_OUT_OF_MEMORY; } } uNextNLMNum = fseNLMLoadedList.NLMNums[fseNLMLoadedList. NLMsInList - 1] + 1; }
* Originally published in Novell AppNotes
Disclaimer
The origin of this information may be internal or external to Novell. While Novell makes all reasonable efforts to verify this information, Novell does not make explicit or implied claims to its validity.