From 5b9fba747a1c7beba15982fe00f9fbcb8e2bef0d Mon Sep 17 00:00:00 2001 From: Rob Crittenden Date: Sat, 3 Mar 2012 19:50:21 -0500 Subject: 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 --- ipapython/nsslib.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'ipapython') 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: -- cgit