diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2008-07-30 13:29:29 +0200 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2008-07-30 13:29:29 +0200 |
commit | ee505f36dddfe04a10fdc8fd8a8bd40d5fbfa218 (patch) | |
tree | 0586d340f470092eed871af74fd073663dbf3187 /source4/scripting/bin | |
parent | 72d2bea916c19405f4fa996b7f781d73e3ee87c8 (diff) | |
download | samba-ee505f36dddfe04a10fdc8fd8a8bd40d5fbfa218.tar.gz samba-ee505f36dddfe04a10fdc8fd8a8bd40d5fbfa218.tar.bz2 samba-ee505f36dddfe04a10fdc8fd8a8bd40d5fbfa218.zip |
Be more pythonic.
(This used to be commit 20d40e31942f96ca9d077e57c6dd4c1d38f79b4b)
Diffstat (limited to 'source4/scripting/bin')
-rwxr-xr-x | source4/scripting/bin/mymachinepw | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/source4/scripting/bin/mymachinepw b/source4/scripting/bin/mymachinepw index 49a4245a3a..3a843b5947 100755 --- a/source4/scripting/bin/mymachinepw +++ b/source4/scripting/bin/mymachinepw @@ -40,8 +40,7 @@ if not loaded: path=conf.get("private dir") + "/secrets.ldb" netbios=conf.get("netbios name") -secrets = ldb.Ldb() -secrets.connect(path) +secrets = ldb.Ldb(path) search = "(&(objectclass=primaryDomain)(samaccountname=" + \ netbios + "$))" @@ -49,13 +48,12 @@ search = "(&(objectclass=primaryDomain)(samaccountname=" + \ msg = secrets.search(expression=search, attrs=['secret']) if not msg: - error = "Error:\n" - error += "Password for host[" + netbios + "] not found in path[" + path + "].\n" - error += "You may want to pass the smb.conf location via the -s option." - print error + print "Error:" + print "Password for host[%s] not found in path[%s]." % (netbios, path) + print "You may want to pass the smb.conf location via the -s option." exit(1) -password=msg[0]['secret'][0]; +password=msg[0]['secret'][0] print(password) exit(0) |