setup_ldb howto? (was: Re: Help using secretsdb_setup_dns like approach to export keytab for service account)

Gémes Géza geza at kzsdabas.hu
Sun Nov 20 10:16:21 MST 2011


Hi,

Maybe a subject better describing the problem.
I've done small modifications to the code (class attached), replacing
setup_ldb with setup_add_ldif, the error becomes:
ERROR(ldb): uncaught exception - Failed to update keytab from entry
samAccountName=www,CN=Principals in
/usr/local/samba/private/secrets.ldb: Failed to add enctype 1 entry for
www at KZSDABAS.HU(kvno 1) to keytab: No such file or directory

  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
275, in run
    setup_add_ldif(ldb=secretsdb, ldif_path=fpath[1], subst_vars=None)
  File
"/usr/local/samba/lib/python2.6/site-packages/samba/provision/__init__.py",
line 488, in setup_add_ldif
    ldb.add_ldif(data, controls)
  File "/usr/local/samba/lib/python2.6/site-packages/samba/__init__.py",
line 221, in add_ldif
    self.add(msg, controls)
A transaction is still active in ldb context [0x1fc1930] on
/usr/local/samba/private/secrets.ldb

Thanks for any idea!

Cheers

Geza
> 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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: cmd_spn_create.py
Type: text/x-python
Size: 4068 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20111120/0fef8a2f/attachment.py>


More information about the samba-technical mailing list