diff options
author | Matthieu Patou <mat@matws.net> | 2011-04-17 14:15:40 +0400 |
---|---|---|
committer | Matthieu Patou <mat@samba.org> | 2011-04-17 13:12:27 +0200 |
commit | 7cc02cf870aa6301c55a78cff630d46d86abf434 (patch) | |
tree | 357e281d7e61b5643681e325ca37892db901cb28 /source4 | |
parent | 0bf7c9646413673e24cfea94eb74dce88f79c470 (diff) | |
download | samba-7cc02cf870aa6301c55a78cff630d46d86abf434.tar.gz samba-7cc02cf870aa6301c55a78cff630d46d86abf434.tar.bz2 samba-7cc02cf870aa6301c55a78cff630d46d86abf434.zip |
samba-tool: fix machinepw command so that we use the full path to the secret database and raise an error if secret can't be found
Autobuild-User: Matthieu Patou <mat@samba.org>
Autobuild-Date: Sun Apr 17 13:12:27 CEST 2011 on sn-devel-104
Diffstat (limited to 'source4')
-rw-r--r-- | source4/scripting/python/samba/netcmd/machinepw.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/source4/scripting/python/samba/netcmd/machinepw.py b/source4/scripting/python/samba/netcmd/machinepw.py index d822b22794..75338d95ef 100644 --- a/source4/scripting/python/samba/netcmd/machinepw.py +++ b/source4/scripting/python/samba/netcmd/machinepw.py @@ -18,7 +18,7 @@ # import samba.getopt as options - +import os from samba import Ldb from samba.auth import system_session from samba.netcmd import Command, CommandError @@ -40,10 +40,13 @@ class cmd_machinepw(Command): def run(self, secret, sambaopts=None, credopts=None, versionopts=None): lp = sambaopts.get_loadparm() creds = credopts.get_credentials(lp, fallback_machine=True) - url = lp.get("secrets database") + name = lp.get("secrets database") + path = lp.get("private dir") + url = os.path.join(path, name) + if not os.path.exists(url): + raise CommandError("secret database not found at %s " % url) secretsdb = Ldb(url=url, session_info=system_session(), credentials=creds, lp=lp) - result = secretsdb.search(attrs=["secret"], expression="(&(objectclass=primaryDomain)(samaccountname=%s))" % secret) |