Closed Bug 71889 Opened 25 years ago Closed 25 years ago

SECMOD doesn't intialize properly after calling NSS_Shutdown

Categories

(NSS :: Libraries, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: javi, Assigned: javi)

Details

Attachments

(1 file)

In PSM 2.0, we're trying to add the ability to change the user profile without exiting the application. I ran into one problem in NSS that prevents this from working. The function nss_OpenSecModDB keeps a static variable secmodname which it uses to determine whether or not the SECMOD libraries have been initialized. A call to NSS_Shutdown does not reset that variable to NULL, so a later call to NSS_InitReadWrite doesn't correctly initialize the SECMOD libraries even though the return value is SECSuccess. I'll be attaching a patch which is the "quick" fix for this problem. It makes secmodname a global variable so that NSS_Shutdown can NULL it out and free the memory so that the next nss_OpenSecModDB is called, the function will go ahead and initialize the libraries. Is this solution acceptable or should I come up with a better one?
I was thinking maybe a fake 'get_current_module_name' function might be cleaner, but we need also need to free the secmodname as well. BTW while we're fixing this, we should fix the memory leak in nss_OpenKeyDB(). We never free 'name' (which doesn't make much difference when we call nss_OpenKeyDB once, but we should probably fix it now that we may be calling it multiple times.
Should I add the free for the name in nss_OpenKeyDB and leave the rest of the patch as is?
Patch checked in.
Status: NEW → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: