Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions firefed/feature/logins.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import base64
import ctypes
from ctypes import CDLL, byref, c_char_p, c_void_p, cast, string_at
from ctypes.util import find_library
import getpass

import attr
Expand Down Expand Up @@ -38,7 +39,15 @@ def __init__(self, libnss='libnss3.so', path='.'):
try:
self.nss = nss = CDLL(libnss)
except OSError as e:
fatal('Can\'t open libnss: %s' % e)
auto = find_library('nss3')
if auto is None:
fatal("Can't open libnss: %s" % e)

try:
self.nss = nss = CDLL(auto)
except OSError as e2:
fatal("Can't open auto-detected libnss '%s': %s" % (auto, e2))

nss.PR_ErrorToString.restype = c_char_p
nss.PR_ErrorToName.restype = c_char_p
nss.PK11_GetInternalKeySlot.restype = c_void_p
Expand Down Expand Up @@ -94,7 +103,7 @@ class Logins(Feature):
"""

libnss = arg('-l', '--libnss', default='libnss3.so',
help='path to libnss3')
help='path to NSS library (auto-detected if default fails)')
password = arg('-p', '--master-password',
help='profile\'s master password (If not set, an empty '
'password is tried. If that fails, you\'re prompted.)')
Expand Down