2 Samba Unix/Linux SMB client library
3 Distributed SMB/CIFS Server Management Utility
4 Copyright (C) Gerald (Jerry) Carter 2004
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
21 #include "utils/net.h"
23 /********************************************************************
24 ********************************************************************/
26 static NTSTATUS rpc_rights_list_internal( const DOM_SID *domain_sid, const char *domain_name,
27 struct cli_state *cli, TALLOC_CTX *mem_ctx,
28 int argc, const char **argv )
33 /********************************************************************
34 ********************************************************************/
36 static NTSTATUS rpc_rights_grant_internal( const DOM_SID *domain_sid, const char *domain_name,
37 struct cli_state *cli, TALLOC_CTX *mem_ctx,
38 int argc, const char **argv )
43 /********************************************************************
44 ********************************************************************/
46 static NTSTATUS rpc_rights_revoke_internal( const DOM_SID *domain_sid, const char *domain_name,
47 struct cli_state *cli, TALLOC_CTX *mem_ctx,
48 int argc, const char **argv )
53 /********************************************************************
54 ********************************************************************/
56 static int rpc_rights_list( int argc, const char **argv )
58 return run_rpc_command( NULL, PI_LSARPC, 0,
59 rpc_rights_list_internal, argc, argv );
62 /********************************************************************
63 ********************************************************************/
65 static int rpc_rights_grant( int argc, const char **argv )
67 return run_rpc_command( NULL, PI_LSARPC, 0,
68 rpc_rights_grant_internal, argc, argv );
71 /********************************************************************
72 ********************************************************************/
74 static int rpc_rights_revoke( int argc, const char **argv )
76 return run_rpc_command( NULL, PI_LSARPC, 0,
77 rpc_rights_revoke_internal, argc, argv );
80 /********************************************************************
81 ********************************************************************/
83 static int net_help_rights( int argc, const char **argv )
85 d_printf("net rpc rights list View available privileges\n");
86 d_printf("net rpc rights grant View available privileges\n");
87 d_printf("net rpc rights revoke View available privileges\n");
89 d_printf("Both 'grant' and 'revoke' require a SID and a commaa separated\n");
90 d_printf("list of privilege names. For example\n");
91 d_printf(" net rpc grant S-1-5-32-550 SePrintOperatorsPrivilege\n");
92 d_printf("would grant the printer admin right to the 'BUILTIN\\Print Operators' group\n");
98 /********************************************************************
99 ********************************************************************/
101 int net_rpc_rights(int argc, const char **argv)
103 struct functable func[] = {
104 {"list", rpc_rights_list},
105 {"grant", rpc_rights_grant},
106 {"revoke", rpc_rights_revoke},
111 return net_run_function( argc, argv, func, net_help_rights );
113 return net_help_rights( argc, argv );