Exemplo n.º 1
0
def delete_test_accounts():
    
    kadmin_local = subprocess.Popen(['kadmin.local'], shell=False, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)

    command = u''

    for account in TEST_ACCOUNTS:
        command += u'delprinc -force {0}\n'.format(account)

    kadmin_local.communicate(command.encode())
    kadmin_local.wait()
Exemplo n.º 2
0
def database_size():

    kadmin_local = subprocess.Popen(['kadmin.local'], shell=False, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)

    (stdoutdata, stderrdata) = kadmin_local.communicate(u'listprincs\n'.encode())

    kadmin_local.wait()

    # We subtract two because the pipe contains the following in addition to the principals
    #
    # kadmin.local:  listprincs
    # kadmin.local: 
    #

    return stdoutdata.decode().count('\n') - 2
Exemplo n.º 3
0
def delete_test_accounts():

    kadmin_local = subprocess.Popen(['kadmin.local'],
                                    shell=False,
                                    stdin=subprocess.PIPE,
                                    stdout=subprocess.PIPE,
                                    stderr=subprocess.PIPE)

    command = u''

    for account in TEST_ACCOUNTS:
        command += u'delprinc -force {0}\n'.format(account)

    kadmin_local.communicate(command.encode())
    kadmin_local.wait()
Exemplo n.º 4
0
def database_size():

    kadmin_local = subprocess.Popen(['kadmin.local'],
                                    shell=False,
                                    stdin=subprocess.PIPE,
                                    stdout=subprocess.PIPE,
                                    stderr=subprocess.PIPE)

    (stdoutdata,
     stderrdata) = kadmin_local.communicate(u'listprincs\n'.encode())

    kadmin_local.wait()

    # We subtract two because the pipe contains the following in addition to the principals
    #
    # kadmin.local:  listprincs
    # kadmin.local:
    #

    return stdoutdata.decode().count('\n') - 2