summaryrefslogtreecommitdiff
path: root/source4/scripting/bin/machineaccountccache
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2010-02-20 11:44:41 +1100
committerAndrew Bartlett <abartlet@samba.org>2010-02-20 17:58:07 +1100
commita9d9447d5a448e13d4373c3c4b48f0edd49dc38a (patch)
tree3b7b54d9bae10efa5481672b081660e3f7c0ef0a /source4/scripting/bin/machineaccountccache
parentda1970c0ff4cd3556102e9357b2e0cf65728c8d6 (diff)
downloadsamba-a9d9447d5a448e13d4373c3c4b48f0edd49dc38a.tar.gz
samba-a9d9447d5a448e13d4373c3c4b48f0edd49dc38a.tar.bz2
samba-a9d9447d5a448e13d4373c3c4b48f0edd49dc38a.zip
s4:credentials Add hooks to extract a named Kerberos credentials cache
This allows the integration of external tools that can't be linked into C or python, but need to authenticate as the local machine account. The machineaccountccache script demonstrates this, and debugging has been improved in cli_credentials_set_secrets() by passing back and error string. Andrew Bartlett
Diffstat (limited to 'source4/scripting/bin/machineaccountccache')
-rwxr-xr-xsource4/scripting/bin/machineaccountccache30
1 files changed, 30 insertions, 0 deletions
diff --git a/source4/scripting/bin/machineaccountccache b/source4/scripting/bin/machineaccountccache
new file mode 100755
index 0000000000..5458851360
--- /dev/null
+++ b/source4/scripting/bin/machineaccountccache
@@ -0,0 +1,30 @@
+#!/usr/bin/python
+import optparse
+import sys
+
+# Find right directory when running from source tree
+sys.path.insert(0, "bin/python")
+
+
+import samba
+from samba import getopt as options
+from samba.credentials import Credentials
+parser = optparse.OptionParser("machineaccountccache <ccache name>")
+sambaopts = options.SambaOptions(parser)
+parser.add_option_group(sambaopts)
+parser.add_option_group(options.VersionOptions(parser))
+opts, args = parser.parse_args()
+
+if len(args) != 1:
+ parser.print_usage()
+ sys.exit(1)
+
+ccachename = args[0]
+
+lp_ctx = sambaopts.get_loadparm()
+
+creds = Credentials()
+
+creds.guess(lp_ctx)
+creds.set_machine_account(lp_ctx)
+creds.get_named_ccache(lp_ctx, ccachename)