Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 1056199 - apps get "SEC_ERROR_BAD_DATABASE: security library: bad database." error when they set db type by "sql:${DIR}" (but work fine when type is set by NSS_DEFAULT_DB_TYPE env var)
Summary: apps get "SEC_ERROR_BAD_DATABASE: security library: bad database." error when...
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: nss
Version: 20
Hardware: Unspecified
OS: Unspecified
unspecified
urgent
Target Milestone: ---
Assignee: Elio Maldonado Batiz
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-01-21 16:53 UTC by David Jaša
Modified: 2014-01-21 19:43 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-01-21 19:43:06 UTC


Attachments (Terms of Use)

Description David Jaša 2014-01-21 16:53:58 UTC
Description of problem:
apps get "SEC_ERROR_BAD_DATABASE: security library: bad database." error when they set db type by "sql:${DIR}" (but work fine when type is set by NSS_DEFAULT_DB_TYPE env var)

Version-Release number of selected component (if applicable):
nss-3.15.4-1.fc20.x86_64

How reproducible:
always on my system

Steps to Reproduce:
1. certutil -d sql:~/.pki/nssdb -K
2. NSS_DEFAULT_DB_TYPE=sql certutil -d ~/.pki/nssdb -K
3. nss-gui --dbdir sql:~/.pki/nssdb; go to Certificates
4. NSS_DEFAULT_DB_TYPE=sql nss-gui --dbdir ~/.pki/nssdb; go to Certificates

Actual results:
1. certutil: function failed: SEC_ERROR_BAD_DATABASE: security library: bad database.
2. successful listing of private keys
3. some error in gui and this in cli: NS_ERROR_XPC_GS_RETURNED_FAILURE: Component returned failure code: 0x80570016 (NS_ERROR_XPC_GS_RETURNED_FAILURE) [nsIJSCID.getService]
4. successful display of certificates

Expected results:
actions are successful in 1. and 3. as well

Additional info:

Comment 1 Kai Engert (:kaie) (inactive account) 2014-01-21 19:43:06 UTC
> 1. certutil -d sql:~/.pki/nssdb -K
...
> 1. certutil: function failed: SEC_ERROR_BAD_DATABASE: security library: bad
> database.

This is incorrect use of ~ and is caused by shell expansion.

$ echo sql:~/.pki/nssdb
sql:~/.pki/nssdb
$ echo ~/.pki/nssdb
/home/kaie/.pki/nssdb

You must use the full path with sql:/home/...

The application doesn't know how to expand "~", only the shell does, and apparently, it only expands ~ if it's found at the beginning of a string.

Alternatively you could type 
  certutil -d sql:$HOME/.pki/nssdb -K
which probably works.


> 3. nss-gui --dbdir sql:~/.pki/nssdb; go to Certificates
...
> 3. some error in gui and this in cli: NS_ERROR_XPC_GS_RETURNED_FAILURE:
> Component returned failure code: 0x80570016
> (NS_ERROR_XPC_GS_RETURNED_FAILURE) [nsIJSCID.getService]

Same problem.


Note You need to log in before you can comment on or make changes to this bug.