Help using secretsdb_setup_dns like approach to export keytab for service account

Gémes Géza geza at kzsdabas.hu
Sun Nov 20 04:25:02 MST 2011


Hi,

First of all sorry for asking well known things, but I'm still learning
the inner workings of the code.

I've been almost :-( successful in extending
source4/scripting/python/samba/netcmd/spn.py with a create command which
would create a user account by reading an ldif generated. Much like
secretsdb_setup_dns() from
source4/scripting/python/samba/provision/sambadns.py does.
I've got stuck with what parameters shall I give to the setup_ldb()
function.
Currently I have:
...
lp = sambaopts.get_loadparm()
creds = credopts.get_credentials(lp)
realm = lp.get("realm")
paths = provision.provision_paths_from_lp(lp, realm)
secretsdb = Ldb(paths.secrets, session_info=system_session(), lp=lp)
...
setup_ldb(secretsdb, "/path/to/the/generated.ldif", {})

And it failes with:
# samba-tool spn create www /tmp/www.keytab
ltdb: tdb(/usr/local/samba/private/secrets.ldb): tdb_transaction_commit:
no transaction

ERROR(ldb): uncaught exception - None
  File
"/usr/local/samba/lib/python2.6/site-packages/samba/netcmd/__init__.py",
line 167, in _run
    return self.run(*args, **kwargs)
  File
"/usr/local/samba/lib/python2.6/site-packages/samba/netcmd/spn.py", line
273, in run
    setup_ldb(secretsdb, fpath[1], {})
  File
"/usr/local/samba/lib/python2.6/site-packages/samba/provision/__init__.py",
line 520, in setup_ldb
    ldb.transaction_commit()


Thanks in advance!

Cheers


Geza


More information about the samba-technical mailing list