python/getopt: Add --krb5-ccache (for samba-tool etc) to match the C binaries
authorAndrew Bartlett <abartlet@samba.org>
Thu, 6 Jul 2017 02:52:39 +0000 (14:52 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 27 Jul 2017 22:25:14 +0000 (00:25 +0200)
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
python/samba/getopt.py

index 9e1fb83167a5944d4a0953559c487f666d0cb02b..4f1c6020f0660e23473dff963699be582cdbe6e8 100644 (file)
@@ -158,6 +158,10 @@ class CredentialsOptions(optparse.OptionGroup):
                         action="callback",
                         help="Use stored machine account password",
                         callback=self._set_machine_pass)
+        self._add_option("--krb5-ccache", metavar="KRB5CCNAME",
+                         action="callback", type=str,
+                         help="Kerberos Credentials cache",
+                         callback=self._set_krb5_ccache)
         self.creds = Credentials()
 
     def _add_option(self, *args1, **kwargs):
@@ -198,6 +202,9 @@ class CredentialsOptions(optparse.OptionGroup):
     def _set_simple_bind_dn(self, option, opt_str, arg, parser):
         self.creds.set_bind_dn(arg)
 
+    def _set_krb5_ccache(self, option, opt_str, arg, parser):
+        self.creds.set_named_ccache(arg)
+
     def get_credentials(self, lp, fallback_machine=False):
         """Obtain the credentials set on the command-line.