The default bug view has changed. See this FAQ.

The fix for bug 641052 was partially lost when bug 753116 was fixed

RESOLVED FIXED in 3.14.1

Status

NSS
Libraries
P1
normal
RESOLVED FIXED
4 years ago
4 years ago

People

(Reporter: Wan-Teh Chang, Assigned: Wan-Teh Chang)

Tracking

({regression})

3.14
3.14.1
regression

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Assignee)

Description

4 years ago
Created attachment 682298 [details] [diff] [review]
Patch

When Bob fixed bug 753116 (softoken needs to split out common components to util),
he moved lib/softoken/sftkmod.c to lib/util/utilmod.c, and lib/softoken/sftkpars.c
to lib/util/utilpars.c. During that move, my fix for bug 641052 (NSS_NoDB_Init
should not try to open /pkcs11.txt and /secmod.db) was partially lost.

(I don't know how this happened. Perhaps Bob moved an old version of
lib/softoken/sftkmod.c and lib/softoken/sftkpars.c and recreated some of my changes.
Perhaps Bob deliberately removed some of my changes.)

I adapted my patch to utilmod.c and utilpars.c. Some of the code I modified in
utilmod.c has been removed, so I am not sure if I adapted my patch correctly.

Notes on the patch:

1. The most important change is the change in nssutil_ReadSecmodDB to allow
the 'dbname' argument to be NULL. Please check that change carefully.

2. I changed the comment "old one doesn't exist" to "old one exists" because
the original code was:

        /* old one doesn't exist */
        status = PR_Access(olddbname, PR_ACCESS_EXISTS);
        if (status != PR_SUCCESS) {
            goto bail;
        }

But the new code is:

	/* old one doesn't exist */
 	status = PR_Access(olddbname, PR_ACCESS_EXISTS);
 	if (status == PR_SUCCESS) {
 	    PR_smprintf_free(olddbname);
 	    PORT_SetError(SEC_ERROR_LEGACY_DATABASE);
 	    return NULL;
 	}

So the old comment doesn't match the new code.
Attachment #682298 - Flags: review?(rrelyea)
(Assignee)

Comment 1

4 years ago
I confirmed the regression. With the current NSS trunk, the strace output
of a program calling NSS_NoDB_Init() on Linux contains:

open("/pkcs11.txt", O_RDONLY)           = -1 ENOENT (No such file or directory)
access("/secmod.db", F_OK)              = -1 ENOENT (No such file or directory)

Those lines are gone if I apply the patch.

NOTE: I am not convinced this bug could cause NSS_NoDB_Init to fail though.
I created /pkcs11.txt and /secmod.db on my Linux computer with garbage contents,
but NSS_NoDB_Init still returns SECSuccess. The strace output shows NSS opens
/pkcs11.txt, reads its contents, and closes the it.

Comment 2

4 years ago
Comment on attachment 682298 [details] [diff] [review]
Patch

r+ rrelyea
Attachment #682298 - Flags: review?(rrelyea) → review+
(Assignee)

Comment 3

4 years ago
I figured out a way for this bug to cause NSS_NoDB_Init to fail.

1. /pkcs11.txt does not exist.

2. /secmod.db exists.

3. libnssdbm3.so does not exist.

I missed the third condition when I tried to cause NSS_NoDB_Init to fail
last night. Now I think this bug is very likely the cause of bug 811928.

Patch checked in on the NSS trunk (NSS 3.14.1).

Checking in utilmod.c;
/cvsroot/mozilla/security/nss/lib/util/utilmod.c,v  <--  utilmod.c
new revision: 1.8; previous revision: 1.7
done
Checking in utilpars.c;
/cvsroot/mozilla/security/nss/lib/util/utilpars.c,v  <--  utilpars.c
new revision: 1.6; previous revision: 1.5
done
Status: ASSIGNED → RESOLVED
Last Resolved: 4 years ago
Resolution: --- → FIXED
(Assignee)

Updated

4 years ago
Duplicate of this bug: 811928
You need to log in before you can comment on or make changes to this bug.