source: vendor/current/source4/scripting/devel/chgkrbtgtpass

Last change on this file was 988, checked in by Silvan Scherrer, 9 years ago

Samba Server: update vendor to version 4.4.3

File size: 2.0 KB
Line 
1#!/usr/bin/env python
2#
3# Copyright (C) Matthieu Patou <mat@matws.net> 2010
4# Copyright (C) Andrew Bartlett <abartlet@samba.org> 2015
5#
6#
7# This program is free software; you can redistribute it and/or modify
8# it under the terms of the GNU General Public License as published by
9# the Free Software Foundation; either version 3 of the License, or
10# (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU General Public License for more details.
16#
17# You should have received a copy of the GNU General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19
20
21__docformat__ = "restructuredText"
22
23
24import optparse
25import sys
26# Allow to run from s4 source directory (without installing samba)
27sys.path.insert(0, "bin/python")
28
29import samba.getopt as options
30from samba.credentials import DONT_USE_KERBEROS
31from samba.auth import system_session
32from samba import param
33from samba.provision import find_provision_key_parameters
34from samba.upgradehelpers import (get_paths,
35 get_ldbs,
36 update_krbtgt_account_password)
37
38parser = optparse.OptionParser("chgkrbtgtpass [options]")
39sambaopts = options.SambaOptions(parser)
40parser.add_option_group(sambaopts)
41parser.add_option_group(options.VersionOptions(parser))
42credopts = options.CredentialsOptions(parser)
43parser.add_option_group(credopts)
44
45opts = parser.parse_args()[0]
46
47lp = sambaopts.get_loadparm()
48smbconf = lp.configfile
49creds = credopts.get_credentials(lp)
50creds.set_kerberos_state(DONT_USE_KERBEROS)
51
52
53paths = get_paths(param, smbconf=smbconf)
54session = system_session()
55
56ldbs = get_ldbs(paths, creds, session, lp)
57ldbs.startTransactions()
58
59names = find_provision_key_parameters(ldbs.sam, ldbs.secrets, ldbs.idmap,
60 paths, smbconf, lp)
61
62update_krbtgt_account_password(ldbs.sam, names)
63ldbs.groupedCommit()
Note: See TracBrowser for help on using the repository browser.