python: Support --no-pass.
authorJelmer Vernooij <jelmer@samba.org>
Thu, 24 Jan 2008 00:05:57 +0000 (01:05 +0100)
committerJelmer Vernooij <jelmer@samba.org>
Thu, 24 Jan 2008 00:05:57 +0000 (01:05 +0100)
source/scripting/python/samba/getopt.py

index dfcf2c457e8bc278ea8343a0f3b75517e6592523..088a5acf6fc84f5fe48c58880499a4b2eb083169 100644 (file)
@@ -50,6 +50,7 @@ class VersionOptions(optparse.OptionGroup):
 
 class CredentialsOptions(optparse.OptionGroup):
     def __init__(self, parser):
+        self.no_pass = False
         optparse.OptionGroup.__init__(self, parser, "Credentials Options")
         self.add_option("--simple-bind-dn", metavar="DN", action="callback",
                         callback=self._set_simple_bind_dn, type=str,
@@ -62,6 +63,8 @@ class CredentialsOptions(optparse.OptionGroup):
         self.add_option("-W", "--workgroup", metavar="WORKGROUP", 
                         action="callback", type=str,
                         help="Workgroup", callback=self._parse_workgroup)
+        self.add_option("-N", "--no-pass", action="store_true",
+                        help="Don't ask for a password")
         self.creds = Credentials()
 
     def _parse_username(self, option, opt_str, arg, parser):
@@ -77,4 +80,7 @@ class CredentialsOptions(optparse.OptionGroup):
         self.creds.set_bind_dn(arg)
 
     def get_credentials(self):
+        self.creds.guess()
+        if not self.no_pass:
+            self.creds.set_cmdline_callbacks()
         return self.creds