diff options
author | Rob Crittenden <rcritten@redhat.com> | 2012-03-03 19:50:21 -0500 |
---|---|---|
committer | Rob Crittenden <rcritten@redhat.com> | 2012-03-04 17:23:01 -0500 |
commit | 55f89dc68940e3a4376fb80e97dbd0f2773c6ed1 (patch) | |
tree | cd47a00d33f641bae0e1281046c74deaec843155 /ipapython/nsslib.py | |
parent | 356823d270a33b65ef4a34133f5d65100b5f59e4 (diff) | |
download | freeipa-55f89dc68940e3a4376fb80e97dbd0f2773c6ed1.tar.gz freeipa-55f89dc68940e3a4376fb80e97dbd0f2773c6ed1.tar.xz freeipa-55f89dc68940e3a4376fb80e97dbd0f2773c6ed1.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/nsslib.py')
-rw-r--r-- | ipapython/nsslib.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/ipapython/nsslib.py b/ipapython/nsslib.py index 225551932..cc6ab1de0 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: |