コード例 #1
0
 def test_setup_secretsdb(self):
     path = os.path.join(self.tempdir, "secrets.ldb")
     paths = ProvisionPaths()
     paths.secrets = path
     paths.private_dir = os.path.dirname(path)
     paths.keytab = "no.keytab"
     paths.dns_keytab = "no.dns.keytab"
     ldb = setup_secretsdb(paths, None, None, lp=env_loadparm())
     try:
         self.assertEquals("LSA Secrets", ldb.searchone(basedn="CN=LSA Secrets", attribute="CN"))
     finally:
         del ldb
         os.unlink(path)
コード例 #2
0
ファイル: provision.py プロジェクト: fendouzhe660/dd-wrt
 def test_setup_secretsdb(self):
     path = os.path.join(self.tempdir, "secrets.ldb")
     paths = ProvisionPaths()
     paths.secrets = path
     paths.private_dir = os.path.dirname(path)
     paths.keytab = "no.keytab"
     paths.dns_keytab = "no.dns.keytab"
     ldb = setup_secretsdb(paths, None, None, lp=env_loadparm())
     try:
         self.assertEquals(
             "LSA Secrets",
             ldb.searchone(basedn="CN=LSA Secrets", attribute="CN"))
     finally:
         del ldb
         os.unlink(path)
コード例 #3
0
ファイル: provision.py プロジェクト: DanilKorotenko/samba
def create_dummy_secretsdb(path, lp=None):
    """Create a dummy secrets database for use in tests.

    :param path: Path to store the secrets db
    :param lp: Optional loadparm context. A simple one will
        be generated if not specified.
    """
    if lp is None:
        lp = env_loadparm()
    paths = ProvisionPaths()
    paths.secrets = path
    paths.private_dir = os.path.dirname(path)
    paths.keytab = "no.keytab"
    paths.dns_keytab = "no.dns.keytab"
    secrets_ldb = setup_secretsdb(paths, None, None, lp=lp)
    secrets_ldb.transaction_commit()
    return secrets_ldb
コード例 #4
0
ファイル: provision.py プロジェクト: fendouzhe660/dd-wrt
def create_dummy_secretsdb(path, lp=None):
    """Create a dummy secrets database for use in tests.

    :param path: Path to store the secrets db
    :param lp: Optional loadparm context. A simple one will
        be generated if not specified.
    """
    if lp is None:
        lp = env_loadparm()
    paths = ProvisionPaths()
    paths.secrets = path
    paths.private_dir = os.path.dirname(path)
    paths.keytab = "no.keytab"
    paths.dns_keytab = "no.dns.keytab"
    secrets_ldb = setup_secretsdb(paths, None, None, lp=lp)
    secrets_ldb.transaction_commit()
    return secrets_ldb