def __init__(self):
        self._proc = None
        self._port = self._avail_tcp_port()
        self.server_id = self._port % 4096
        self.testrundir = os.path.join(self.TMPDIR,
                                       'python-ldap-test-%d' % self._port)
        self._schema_prefix = os.path.join(self.testrundir, 'schema')
        self._slapd_conf = os.path.join(self.testrundir, 'slapd.conf')
        self._db_directory = os.path.join(self.testrundir, "openldap-data")
        self.ldap_uri = "ldap://%s:%d/" % (self.local_host, self._port)
        if HAVE_LDAPI:
            ldapi_path = os.path.join(self.testrundir, 'ldapi')
            self.ldapi_uri = "ldapi://%s" % quote_plus(ldapi_path)
            self.default_ldap_uri = self.ldapi_uri
            # use SASL/EXTERNAL via LDAPI when invoking OpenLDAP CLI tools
            self.cli_sasl_external = ldap.SASL_AVAIL
        else:
            self.ldapi_uri = None
            self.default_ldap_uri = self.ldap_uri
            # Use simple bind via LDAP uri
            self.cli_sasl_external = False

        self._find_commands()

        if self.SCHEMADIR is None:
            raise ValueError('SCHEMADIR is None, ldap schemas are missing.')

        # TLS certs
        self.cafile = os.path.join(HERE, 'certs/ca.pem')
        self.servercert = os.path.join(HERE, 'certs/server.pem')
        self.serverkey = os.path.join(HERE, 'certs/server.key')
        self.clientcert = os.path.join(HERE, 'certs/client.pem')
        self.clientkey = os.path.join(HERE, 'certs/client.key')
Exemple #2
0
 def __init__(self):
     self._log = combined_logger('python-ldap-test')
     self._proc = None
     self._port = self._avail_tcp_port()
     self.server_id = self._port % 4096
     self.testrundir = os.path.join(self.TMPDIR, 'python-ldap-test-%d' % self._port)
     self._schema_prefix = os.path.join(self.testrundir, 'schema')
     self._slapd_conf = os.path.join(self.testrundir, 'slapd.conf')
     self._db_directory = os.path.join(self.testrundir, "openldap-data")
     self.ldap_uri = "ldap://%s:%d/" % (LOCALHOST, self._port)
     ldapi_path = os.path.join(self.testrundir, 'ldapi')
     self.ldapi_uri = "ldapi://%s" % quote_plus(ldapi_path)
Exemple #3
0
 def __init__(self):
     self._proc = None
     self._port = self._avail_tcp_port()
     self.server_id = self._port % 4096
     self.testrundir = os.path.join(self.TMPDIR,
                                    'python-ldap-test-%d' % self._port)
     self._schema_prefix = os.path.join(self.testrundir, 'schema')
     self._slapd_conf = os.path.join(self.testrundir, 'slapd.conf')
     self._db_directory = os.path.join(self.testrundir, "openldap-data")
     self.ldap_uri = "ldap://%s:%d/" % (LOCALHOST, self._port)
     ldapi_path = os.path.join(self.testrundir, 'ldapi')
     self.ldapi_uri = "ldapi://%s" % quote_plus(ldapi_path)
     # TLS certs
     capath = os.path.abspath(os.path.join(os.getcwd(), 'Tests/certs'))
     self.cafile = os.path.join(capath, 'ca.pem')
     self.servercert = os.path.join(capath, 'server.pem')
     self.serverkey = os.path.join(capath, 'server.key')
     self.clientcert = os.path.join(capath, 'client.pem')
     self.clientkey = os.path.join(capath, 'client.key')