summaryrefslogtreecommitdiffstats
path: root/ipapython
diff options
context:
space:
mode:
authorRob Crittenden <rcritten@redhat.com>2012-03-03 19:50:21 -0500
committerRob Crittenden <rcritten@redhat.com>2012-03-04 17:23:15 -0500
commit5b9fba747a1c7beba15982fe00f9fbcb8e2bef0d (patch)
tree5ce5801939a3d69fc841b54a86f11bab08abb44a /ipapython
parentd18ea5f52246ca1a7e071fb1dde04ef13d85fa71 (diff)
downloadfreeipa.git-5b9fba747a1c7beba15982fe00f9fbcb8e2bef0d.tar.gz
freeipa.git-5b9fba747a1c7beba15982fe00f9fbcb8e2bef0d.tar.xz
freeipa.git-5b9fba747a1c7beba15982fe00f9fbcb8e2bef0d.zip
Do kinit in client before connecting to backend
The client installer was failing because a backend connection could be created before a kinit was done. Allow multiple simultaneous connections. This could fail with an NSS shutdown error when the second connection was created (objects still in use). If all connections currently use the same database then there is no need to initialize, let it be skipped. Add additional logging to client installer. https://fedorahosted.org/freeipa/ticket/2478
Diffstat (limited to 'ipapython')
-rw-r--r--ipapython/nsslib.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/ipapython/nsslib.py b/ipapython/nsslib.py
index 22555193..cc6ab1de 100644
--- a/ipapython/nsslib.py
+++ b/ipapython/nsslib.py
@@ -190,7 +190,16 @@ class NSSConnection(httplib.HTTPConnection, NSSAddressFamilyFallback):
default_port = httplib.HTTPSConnection.default_port
def __init__(self, host, port=None, strict=None,
- dbdir=None, family=socket.AF_UNSPEC):
+ dbdir=None, family=socket.AF_UNSPEC, no_init=False):
+ """
+ :param host: the server to connect to
+ :param port: the port to use (default is set in HTTPConnection)
+ :param dbdir: the NSS database directory
+ :param family: network family to use (default AF_UNSPEC)
+ :param no_init: do not initialize the NSS database. This requires
+ that the database has already been initialized or
+ the request will fail.
+ """
httplib.HTTPConnection.__init__(self, host, port, strict)
NSSAddressFamilyFallback.__init__(self, family)
@@ -198,7 +207,7 @@ class NSSConnection(httplib.HTTPConnection, NSSAddressFamilyFallback):
raise RuntimeError("dbdir is required")
root_logger.debug('%s init %s', self.__class__.__name__, host)
- if nss.nss_is_initialized():
+ if not no_init and nss.nss_is_initialized():
# close any open NSS database and use the new one
ssl.clear_session_cache()
try: