samba-tool: Remove "domain machinepassword" command
authorGiampaolo Lauria <lauria2@yahoo.com>
Fri, 11 Nov 2011 15:37:39 +0000 (10:37 -0500)
committerAmitay Isaacs <amitay@gmail.com>
Tue, 15 Nov 2011 00:12:07 +0000 (11:12 +1100)
As per Andrew Bartlett's comment:
"we should remove it.  This was originally a script to support some
interactions between samba3 and samba4, when they were in distinct build
systems.  We now can call between the two systems without difficulty at
runtime, so this command has no value."

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
source4/scripting/python/samba/netcmd/domain.py

index 35e9d29f2c494f4d9f83897c3c36c515cb449370..f1ebf7e2bad933213f9f26c084e493b3c0f89b7e 100644 (file)
@@ -336,33 +336,6 @@ class cmd_domain_level(Command):
 
 
 
-class cmd_domain_machinepassword(Command):
-    """Gets a machine password out of our SAM"""
-
-    synopsis = "%prog <accountname> [options]"
-
-    takes_args = ["accountname"]
-
-    def run(self, accountname, sambaopts=None, credopts=None, versionopts=None):
-        lp = sambaopts.get_loadparm()
-        creds = credopts.get_credentials(lp, fallback_machine=True)
-        url = lp.private_path("secrets.ldb")
-        if not os.path.exists(url):
-            raise CommandError("secrets database not found at %s " % url)
-        if not accountname.endswith('$'):
-            accountname += '$'
-        secretsdb = Ldb(url=url, session_info=system_session(),
-            credentials=creds, lp=lp)
-        result = secretsdb.search(attrs=["secret"],
-            expression="(&(objectclass=primaryDomain)(samaccountname=%s))" % ldb.binary_encode(accountname))
-
-        if len(result) != 1:
-            raise CommandError("search returned %d records, expected 1" % len(result))
-
-        self.outf.write("%s\n" % result[0]["secret"])
-
-
-
 class cmd_domain_passwordsettings(Command):
     """Sets password settings
 
@@ -640,6 +613,5 @@ class cmd_domain(SuperCommand):
     subcommands["exportkeytab"] = cmd_domain_export_keytab()
     subcommands["join"] = cmd_domain_join()
     subcommands["level"] = cmd_domain_level()
-    subcommands["machinepassword"] = cmd_domain_machinepassword()
     subcommands["passwordsettings"] = cmd_domain_passwordsettings()
     subcommands["samba3upgrade"] = cmd_domain_samba3upgrade()