2011-07-20 11:07:35 +04:00
#!/usr/bin/env python
# Unix SMB/CIFS implementation.
2011-08-01 22:45:18 +04:00
# Copyright (C) Amitay Isaacs <amitay@gmail.com> 2011
# Copyright (C) Giampaolo Lauria <lauria2@yahoo.com> 2011
2011-07-20 11:07:35 +04:00
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
import sys
2011-07-21 03:48:30 +04:00
# Find right direction when running from source tree
sys.path.insert(0, "bin/python")
2011-07-20 11:07:35 +04:00
from samba import netcmd
2011-07-29 05:44:06 +04:00
from samba.netcmd import SuperCommand
2011-08-01 22:45:18 +04:00
from samba.netcmd.dbcheck import cmd_dbcheck
from samba.netcmd.delegation import cmd_delegation
from samba.netcmd.domain import cmd_domain
from samba.netcmd.drs import cmd_drs
2011-08-31 01:09:53 +04:00
from samba.netcmd.dsacl import cmd_dsacl
2011-08-01 22:45:18 +04:00
from samba.netcmd.fsmo import cmd_fsmo
from samba.netcmd.gpo import cmd_gpo
from samba.netcmd.group import cmd_group
from samba.netcmd.ldapcmp import cmd_ldapcmp
2011-08-31 01:19:59 +04:00
from samba.netcmd.ntacl import cmd_ntacl
2011-08-01 22:45:18 +04:00
from samba.netcmd.rodc import cmd_rodc
from samba.netcmd.spn import cmd_spn
from samba.netcmd.testparm import cmd_testparm
from samba.netcmd.time import cmd_time
from samba.netcmd.user import cmd_user
from samba.netcmd.vampire import cmd_vampire
2011-07-20 11:07:35 +04:00
2011-07-21 06:30:38 +04:00
2011-07-29 05:44:06 +04:00
class cmd_sambatool(SuperCommand):
"""samba-tool SuperCommand"""
2011-08-01 22:45:18 +04:00
subcommands = {}
subcommands["dbcheck"] = cmd_dbcheck()
subcommands["delegation"] = cmd_delegation()
subcommands["domain"] = cmd_domain()
subcommands["drs"] = cmd_drs()
2011-08-31 01:09:53 +04:00
subcommands["dsacl"] = cmd_dsacl()
2011-08-01 22:45:18 +04:00
subcommands["fsmo"] = cmd_fsmo()
subcommands["gpo"] = cmd_gpo()
subcommands["group"] = cmd_group()
subcommands["ldapcmp"] = cmd_ldapcmp()
2011-08-31 01:19:59 +04:00
subcommands["ntacl"] = cmd_ntacl()
2011-08-01 22:45:18 +04:00
subcommands["rodc"] = cmd_rodc()
subcommands["spn"] = cmd_spn()
subcommands["testparm"] = cmd_testparm()
subcommands["time"] = cmd_time()
subcommands["user"] = cmd_user()
subcommands["vampire"] = cmd_vampire()
2011-07-20 11:07:35 +04:00
if __name__ == '__main__':
2011-07-21 06:30:38 +04:00
cmd = cmd_sambatool()
2011-08-01 22:45:18 +04:00
subcommand = None
2011-07-21 06:30:38 +04:00
args = ()
2011-07-20 11:07:35 +04:00
2011-07-21 06:30:38 +04:00
if len(sys.argv) > 1:
2011-08-01 22:45:18 +04:00
subcommand = sys.argv[1]
2011-07-21 06:30:38 +04:00
if len(sys.argv) > 2:
args = sys.argv[2:]
2011-07-20 11:07:35 +04:00
2011-07-21 06:32:53 +04:00
try:
2011-08-01 22:45:18 +04:00
retval = cmd._run("samba-tool", subcommand, *args)
2011-07-21 06:32:53 +04:00
sys.exit(retval)
2011-09-07 22:31:05 +04:00
except Exception, e:
2011-07-21 06:32:53 +04:00
cmd.show_command_error(e)