summaryrefslogtreecommitdiff
path: root/source4/scripting/bin/machineaccountccache
blob: 7731f5af359207a440b39403be8434c65d31022a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/env 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)