s3-rpc: Avoid including every pipe's client and server stubs everywhere in samba.
[nivanova/samba-autobuild/.git] / source3 / utils / net_rpc_rights.c
1 /*
2    Samba Unix/Linux SMB client library
3    Distributed SMB/CIFS Server Management Utility
4    Copyright (C) Gerald (Jerry) Carter          2004
5    Copyright (C) Guenther Deschner              2008
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 #include "includes.h"
21 #include "utils/net.h"
22 #include "../librpc/gen_ndr/cli_lsa.h"
23
24 /********************************************************************
25 ********************************************************************/
26
27 static NTSTATUS sid_to_name(struct rpc_pipe_client *pipe_hnd,
28                                 TALLOC_CTX *mem_ctx,
29                                 DOM_SID *sid,
30                                 fstring name)
31 {
32         struct policy_handle pol;
33         enum lsa_SidType *sid_types = NULL;
34         NTSTATUS result;
35         char **domains = NULL, **names = NULL;
36
37         result = rpccli_lsa_open_policy(pipe_hnd, mem_ctx, true,
38                 SEC_FLAG_MAXIMUM_ALLOWED, &pol);
39
40         if ( !NT_STATUS_IS_OK(result) )
41                 return result;
42
43         result = rpccli_lsa_lookup_sids(pipe_hnd, mem_ctx, &pol, 1, sid, &domains, &names, &sid_types);
44
45         if ( NT_STATUS_IS_OK(result) ) {
46                 if ( *domains[0] )
47                         fstr_sprintf( name, "%s\\%s", domains[0], names[0] );
48                 else
49                         fstrcpy( name, names[0] );
50         }
51
52         rpccli_lsa_Close(pipe_hnd, mem_ctx, &pol);
53         return result;
54 }
55
56 /********************************************************************
57 ********************************************************************/
58
59 static NTSTATUS name_to_sid(struct rpc_pipe_client *pipe_hnd,
60                             TALLOC_CTX *mem_ctx,
61                             DOM_SID *sid, const char *name)
62 {
63         struct policy_handle pol;
64         enum lsa_SidType *sid_types;
65         NTSTATUS result;
66         DOM_SID *sids;
67
68         /* maybe its a raw SID */
69         if ( strncmp(name, "S-", 2) == 0 && string_to_sid(sid, name) ) {
70                 return NT_STATUS_OK;
71         }
72
73         result = rpccli_lsa_open_policy(pipe_hnd, mem_ctx, true,
74                 SEC_FLAG_MAXIMUM_ALLOWED, &pol);
75
76         if ( !NT_STATUS_IS_OK(result) )
77                 return result;
78
79         result = rpccli_lsa_lookup_names(pipe_hnd, mem_ctx, &pol, 1, &name,
80                                          NULL, 1, &sids, &sid_types);
81
82         if ( NT_STATUS_IS_OK(result) )
83                 sid_copy( sid, &sids[0] );
84
85         rpccli_lsa_Close(pipe_hnd, mem_ctx, &pol);
86         return result;
87 }
88
89 /********************************************************************
90 ********************************************************************/
91
92 static NTSTATUS enum_privileges(struct rpc_pipe_client *pipe_hnd,
93                                 TALLOC_CTX *ctx,
94                                 struct policy_handle *pol )
95 {
96         NTSTATUS result;
97         uint32 enum_context = 0;
98         uint32 pref_max_length=0x1000;
99         int i;
100         uint16 lang_id=0;
101         uint16 lang_id_sys=0;
102         uint16 lang_id_desc;
103         struct lsa_StringLarge *description = NULL;
104         struct lsa_PrivArray priv_array;
105
106         result = rpccli_lsa_EnumPrivs(pipe_hnd, ctx,
107                                       pol,
108                                       &enum_context,
109                                       &priv_array,
110                                       pref_max_length);
111
112         if ( !NT_STATUS_IS_OK(result) )
113                 return result;
114
115         /* Print results */
116
117         for (i = 0; i < priv_array.count; i++) {
118
119                 struct lsa_String lsa_name;
120
121                 d_printf("%30s  ",
122                         priv_array.privs[i].name.string ? priv_array.privs[i].name.string : "*unknown*" );
123
124                 /* try to get the description */
125
126                 init_lsa_String(&lsa_name, priv_array.privs[i].name.string);
127
128                 result = rpccli_lsa_LookupPrivDisplayName(pipe_hnd, ctx,
129                                                           pol,
130                                                           &lsa_name,
131                                                           lang_id,
132                                                           lang_id_sys,
133                                                           &description,
134                                                           &lang_id_desc);
135
136                 if (!NT_STATUS_IS_OK(result)) {
137                         d_printf("??????\n");
138                         continue;
139                 }
140
141                 d_printf("%s\n", description->string);
142         }
143
144         return NT_STATUS_OK;
145 }
146
147 /********************************************************************
148 ********************************************************************/
149
150 static NTSTATUS check_privilege_for_user(struct rpc_pipe_client *pipe_hnd,
151                                         TALLOC_CTX *ctx,
152                                         struct policy_handle *pol,
153                                         DOM_SID *sid,
154                                         const char *right)
155 {
156         NTSTATUS result;
157         struct lsa_RightSet rights;
158         int i;
159
160         result = rpccli_lsa_EnumAccountRights(pipe_hnd, ctx,
161                                               pol,
162                                               sid,
163                                               &rights);
164
165         if (!NT_STATUS_IS_OK(result)) {
166                 return result;
167         }
168
169         if (rights.count == 0) {
170                 return NT_STATUS_OBJECT_NAME_NOT_FOUND;
171         }
172
173         for (i = 0; i < rights.count; i++) {
174                 if (StrCaseCmp(rights.names[i].string, right) == 0) {
175                         return NT_STATUS_OK;
176                 }
177         }
178
179         return NT_STATUS_OBJECT_NAME_NOT_FOUND;
180 }
181
182 /********************************************************************
183 ********************************************************************/
184
185 static NTSTATUS enum_privileges_for_user(struct rpc_pipe_client *pipe_hnd,
186                                         TALLOC_CTX *ctx,
187                                         struct policy_handle *pol,
188                                         DOM_SID *sid )
189 {
190         NTSTATUS result;
191         struct lsa_RightSet rights;
192         int i;
193
194         result = rpccli_lsa_EnumAccountRights(pipe_hnd, ctx,
195                                               pol,
196                                               sid,
197                                               &rights);
198
199         if (!NT_STATUS_IS_OK(result))
200                 return result;
201
202         if (rights.count == 0) {
203                 d_printf(_("No privileges assigned\n"));
204         }
205
206         for (i = 0; i < rights.count; i++) {
207                 printf("%s\n", rights.names[i].string);
208         }
209
210         return NT_STATUS_OK;
211 }
212
213 /********************************************************************
214 ********************************************************************/
215
216 static NTSTATUS enum_accounts_for_privilege(struct rpc_pipe_client *pipe_hnd,
217                                                 TALLOC_CTX *ctx,
218                                                 struct policy_handle *pol,
219                                                 const char *privilege)
220 {
221         NTSTATUS result;
222         uint32 enum_context=0;
223         uint32 pref_max_length=0x1000;
224         struct lsa_SidArray sid_array;
225         int i;
226         fstring name;
227
228         result = rpccli_lsa_EnumAccounts(pipe_hnd, ctx,
229                                          pol,
230                                          &enum_context,
231                                          &sid_array,
232                                          pref_max_length);
233
234         if (!NT_STATUS_IS_OK(result))
235                 return result;
236
237         d_printf("%s:\n", privilege);
238
239         for ( i=0; i<sid_array.num_sids; i++ ) {
240
241                 result = check_privilege_for_user(pipe_hnd, ctx, pol,
242                                                   sid_array.sids[i].sid,
243                                                   privilege);
244
245                 if ( ! NT_STATUS_IS_OK(result)) {
246                         if ( ! NT_STATUS_EQUAL(result, NT_STATUS_OBJECT_NAME_NOT_FOUND)) {
247                                 return result;
248                         }
249                         continue;
250                 }
251
252                 /* try to convert the SID to a name.  Fall back to
253                    printing the raw SID if necessary */
254                 result = sid_to_name( pipe_hnd, ctx, sid_array.sids[i].sid, name );
255                 if ( !NT_STATUS_IS_OK (result) )
256                         sid_to_fstring(name, sid_array.sids[i].sid);
257
258                 d_printf("  %s\n", name);
259         }
260
261         return NT_STATUS_OK;
262 }
263
264 /********************************************************************
265 ********************************************************************/
266
267 static NTSTATUS enum_privileges_for_accounts(struct rpc_pipe_client *pipe_hnd,
268                                                 TALLOC_CTX *ctx,
269                                                 struct policy_handle *pol)
270 {
271         NTSTATUS result;
272         uint32 enum_context=0;
273         uint32 pref_max_length=0x1000;
274         struct lsa_SidArray sid_array;
275         int i;
276         fstring name;
277
278         result = rpccli_lsa_EnumAccounts(pipe_hnd, ctx,
279                                          pol,
280                                          &enum_context,
281                                          &sid_array,
282                                          pref_max_length);
283
284         if (!NT_STATUS_IS_OK(result))
285                 return result;
286
287         for ( i=0; i<sid_array.num_sids; i++ ) {
288
289                 /* try to convert the SID to a name.  Fall back to
290                    printing the raw SID if necessary */
291
292                 result = sid_to_name(pipe_hnd, ctx, sid_array.sids[i].sid, name);
293                 if ( !NT_STATUS_IS_OK (result) )
294                         sid_to_fstring(name, sid_array.sids[i].sid);
295
296                 d_printf("%s\n", name);
297
298                 result = enum_privileges_for_user(pipe_hnd, ctx, pol,
299                                                   sid_array.sids[i].sid);
300                 if ( !NT_STATUS_IS_OK(result) )
301                         return result;
302
303                 d_printf("\n");
304         }
305
306         return NT_STATUS_OK;
307 }
308
309 /********************************************************************
310 ********************************************************************/
311
312 static NTSTATUS rpc_rights_list_internal(struct net_context *c,
313                                         const DOM_SID *domain_sid,
314                                         const char *domain_name,
315                                         struct cli_state *cli,
316                                         struct rpc_pipe_client *pipe_hnd,
317                                         TALLOC_CTX *mem_ctx,
318                                         int argc,
319                                         const char **argv )
320 {
321         struct policy_handle pol;
322         NTSTATUS result;
323         DOM_SID sid;
324         fstring privname;
325         struct lsa_String lsa_name;
326         struct lsa_StringLarge *description = NULL;
327         uint16 lang_id = 0;
328         uint16 lang_id_sys = 0;
329         uint16 lang_id_desc;
330
331         result = rpccli_lsa_open_policy(pipe_hnd, mem_ctx, true,
332                 SEC_FLAG_MAXIMUM_ALLOWED, &pol);
333
334         if ( !NT_STATUS_IS_OK(result) )
335                 return result;
336
337         /* backwards compatibility; just list available privileges if no arguement */
338
339         if (argc == 0) {
340                 result = enum_privileges(pipe_hnd, mem_ctx, &pol );
341                 goto done;
342         }
343
344         if (strequal(argv[0], "privileges")) {
345                 int i = 1;
346
347                 if (argv[1] == NULL) {
348                         result = enum_privileges(pipe_hnd, mem_ctx, &pol );
349                         goto done;
350                 }
351
352                 while ( argv[i] != NULL ) {
353                         fstrcpy(privname, argv[i]);
354                         init_lsa_String(&lsa_name, argv[i]);
355                         i++;
356
357                         /* verify that this is a valid privilege for error reporting */
358                         result = rpccli_lsa_LookupPrivDisplayName(pipe_hnd, mem_ctx,
359                                                                   &pol,
360                                                                   &lsa_name,
361                                                                   lang_id,
362                                                                   lang_id_sys,
363                                                                   &description,
364                                                                   &lang_id_desc);
365
366                         if ( !NT_STATUS_IS_OK(result) ) {
367                                 if ( NT_STATUS_EQUAL( result, NT_STATUS_NO_SUCH_PRIVILEGE ) ) 
368                                         d_fprintf(stderr, _("No such privilege "
369                                                   "exists: %s.\n"), privname);
370                                 else
371                                         d_fprintf(stderr, _("Error resolving "
372                                                   "privilege display name "
373                                                   "[%s].\n"),
374                                                   nt_errstr(result));
375                                 continue;
376                         }
377
378                         result = enum_accounts_for_privilege(pipe_hnd, mem_ctx, &pol, privname);
379                         if (!NT_STATUS_IS_OK(result)) {
380                                 d_fprintf(stderr, _("Error enumerating "
381                                           "accounts for privilege %s [%s].\n"),
382                                           privname, nt_errstr(result));
383                                 continue;
384                         }
385                 }
386                 goto done;
387         }
388
389         /* special case to enumerate all privileged SIDs with associated rights */
390
391         if (strequal( argv[0], "accounts")) {
392                 int i = 1;
393
394                 if (argv[1] == NULL) {
395                         result = enum_privileges_for_accounts(pipe_hnd, mem_ctx, &pol);
396                         goto done;
397                 }
398
399                 while (argv[i] != NULL) {
400                         result = name_to_sid(pipe_hnd, mem_ctx, &sid, argv[i]);
401                         if (!NT_STATUS_IS_OK(result)) {
402                                 goto done;
403                         }
404                         result = enum_privileges_for_user(pipe_hnd, mem_ctx, &pol, &sid);
405                         if (!NT_STATUS_IS_OK(result)) {
406                                 goto done;
407                         }
408                         i++;
409                 }
410                 goto done;
411         }
412
413         /* backward comaptibility: if no keyword provided, treat the key
414            as an account name */
415         if (argc > 1) {
416                 d_printf(_("Usage: net rpc rights list [[accounts|privileges] "
417                            "[name|SID]]\n"));
418                 result = NT_STATUS_OK;
419                 goto done;
420         }
421
422         result = name_to_sid(pipe_hnd, mem_ctx, &sid, argv[0]);
423         if (!NT_STATUS_IS_OK(result)) {
424                 goto done;
425         }
426         result = enum_privileges_for_user(pipe_hnd, mem_ctx, &pol, &sid );
427
428 done:
429         rpccli_lsa_Close(pipe_hnd, mem_ctx, &pol);
430
431         return result;
432 }
433
434 /********************************************************************
435 ********************************************************************/
436
437 static NTSTATUS rpc_rights_grant_internal(struct net_context *c,
438                                         const DOM_SID *domain_sid,
439                                         const char *domain_name,
440                                         struct cli_state *cli,
441                                         struct rpc_pipe_client *pipe_hnd,
442                                         TALLOC_CTX *mem_ctx,
443                                         int argc,
444                                         const char **argv )
445 {
446         struct policy_handle dom_pol;
447         NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
448         struct lsa_RightSet rights;
449         int i;
450
451         DOM_SID sid;
452
453         if (argc < 2 ) {
454                 d_printf(_("Usage: net rpc rights grant <name|SID> "
455                            "<rights...>\n"));
456                 return NT_STATUS_OK;
457         }
458
459         result = name_to_sid(pipe_hnd, mem_ctx, &sid, argv[0]);
460         if (NT_STATUS_EQUAL(result, NT_STATUS_NONE_MAPPED))
461                 result = NT_STATUS_NO_SUCH_USER;
462
463         if (!NT_STATUS_IS_OK(result))
464                 goto done;
465
466         result = rpccli_lsa_open_policy2(pipe_hnd, mem_ctx, true,
467                                      SEC_FLAG_MAXIMUM_ALLOWED,
468                                      &dom_pol);
469
470         if (!NT_STATUS_IS_OK(result))
471                 return result;
472
473         rights.count = argc-1;
474         rights.names = TALLOC_ARRAY(mem_ctx, struct lsa_StringLarge,
475                                     rights.count);
476         if (!rights.names) {
477                 return NT_STATUS_NO_MEMORY;
478         }
479
480         for (i=0; i<argc-1; i++) {
481                 init_lsa_StringLarge(&rights.names[i], argv[i+1]);
482         }
483
484         result = rpccli_lsa_AddAccountRights(pipe_hnd, mem_ctx,
485                                              &dom_pol,
486                                              &sid,
487                                              &rights);
488
489         if (!NT_STATUS_IS_OK(result))
490                 goto done;
491
492         d_printf(_("Successfully granted rights.\n"));
493
494  done:
495         if ( !NT_STATUS_IS_OK(result) ) {
496                 d_fprintf(stderr, _("Failed to grant privileges for %s (%s)\n"),
497                         argv[0], nt_errstr(result));
498         }
499
500         rpccli_lsa_Close(pipe_hnd, mem_ctx, &dom_pol);
501
502         return result;
503 }
504
505 /********************************************************************
506 ********************************************************************/
507
508 static NTSTATUS rpc_rights_revoke_internal(struct net_context *c,
509                                         const DOM_SID *domain_sid,
510                                         const char *domain_name,
511                                         struct cli_state *cli,
512                                         struct rpc_pipe_client *pipe_hnd,
513                                         TALLOC_CTX *mem_ctx,
514                                         int argc,
515                                         const char **argv )
516 {
517         struct policy_handle dom_pol;
518         NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
519         struct lsa_RightSet rights;
520         DOM_SID sid;
521         int i;
522
523         if (argc < 2 ) {
524                 d_printf(_("Usage: net rpc rights revoke <name|SID> "
525                            "<rights...>\n"));
526                 return NT_STATUS_OK;
527         }
528
529         result = name_to_sid(pipe_hnd, mem_ctx, &sid, argv[0]);
530         if (!NT_STATUS_IS_OK(result))
531                 return result;
532
533         result = rpccli_lsa_open_policy2(pipe_hnd, mem_ctx, true,
534                                      SEC_FLAG_MAXIMUM_ALLOWED,
535                                      &dom_pol);
536
537         if (!NT_STATUS_IS_OK(result))
538                 return result;
539
540         rights.count = argc-1;
541         rights.names = TALLOC_ARRAY(mem_ctx, struct lsa_StringLarge,
542                                     rights.count);
543         if (!rights.names) {
544                 return NT_STATUS_NO_MEMORY;
545         }
546
547         for (i=0; i<argc-1; i++) {
548                 init_lsa_StringLarge(&rights.names[i], argv[i+1]);
549         }
550
551         result = rpccli_lsa_RemoveAccountRights(pipe_hnd, mem_ctx,
552                                                 &dom_pol,
553                                                 &sid,
554                                                 false,
555                                                 &rights);
556
557         if (!NT_STATUS_IS_OK(result))
558                 goto done;
559
560         d_printf(_("Successfully revoked rights.\n"));
561
562 done:
563         if ( !NT_STATUS_IS_OK(result) ) {
564                 d_fprintf(stderr,_("Failed to revoke privileges for %s (%s)\n"),
565                         argv[0], nt_errstr(result));
566         }
567
568         rpccli_lsa_Close(pipe_hnd, mem_ctx, &dom_pol);
569
570         return result;
571 }
572
573
574 /********************************************************************
575 ********************************************************************/
576
577 static int rpc_rights_list(struct net_context *c, int argc, const char **argv )
578 {
579         if (c->display_usage) {
580                 d_printf(_("Usage:\n"
581                            "net rpc rights list [{accounts|privileges} "
582                            "[name|SID]]\n"
583                            "    View available/assigned privileges\n"));
584                 return 0;
585         }
586
587         return run_rpc_command(c, NULL, &ndr_table_lsarpc.syntax_id, 0,
588                 rpc_rights_list_internal, argc, argv );
589 }
590
591 /********************************************************************
592 ********************************************************************/
593
594 static int rpc_rights_grant(struct net_context *c, int argc, const char **argv )
595 {
596         if (c->display_usage) {
597                 d_printf(_("Usage:\n"
598                            "net rpc rights grant <name|SID> <right>\n"
599                            "    Assign privilege[s]\n"));
600                 d_printf(_("For example:\n"
601                            "    net rpc rights grant 'VALE\\biddle' "
602                            "SePrintOperatorPrivilege SeDiskOperatorPrivilege\n"
603                            "    would grant the printer admin and disk manager "
604                            "rights to the user 'VALE\\biddle'\n"));
605                 return 0;
606         }
607
608         return run_rpc_command(c, NULL, &ndr_table_lsarpc.syntax_id, 0,
609                 rpc_rights_grant_internal, argc, argv );
610 }
611
612 /********************************************************************
613 ********************************************************************/
614
615 static int rpc_rights_revoke(struct net_context *c, int argc, const char **argv)
616 {
617         if (c->display_usage) {
618                 d_printf(_("Usage:\n"
619                            "net rpc rights revoke <name|SID> <right>\n"
620                            "    Revoke privilege[s]\n"));
621                 d_printf(_("For example:\n"
622                            "    net rpc rights revoke 'VALE\\biddle' "
623                            "SePrintOperatorPrivilege SeDiskOperatorPrivilege\n"
624                            "    would revoke the printer admin and disk manager"
625                            " rights from the user 'VALE\\biddle'\n"));
626                 return 0;
627         }
628
629         return run_rpc_command(c, NULL, &ndr_table_lsarpc.syntax_id, 0,
630                 rpc_rights_revoke_internal, argc, argv );
631 }
632
633 /********************************************************************
634 ********************************************************************/
635
636 int net_rpc_rights(struct net_context *c, int argc, const char **argv)
637 {
638         struct functable func[] = {
639                 {
640                         "list",
641                         rpc_rights_list,
642                         NET_TRANSPORT_RPC,
643                         N_("View available/assigned privileges"),
644                         N_("net rpc rights list\n"
645                            "    View available/assigned privileges")
646                 },
647                 {
648                         "grant",
649                         rpc_rights_grant,
650                         NET_TRANSPORT_RPC,
651                         N_("Assign privilege[s]"),
652                         N_("net rpc rights grant\n"
653                            "    Assign privilege[s]")
654                 },
655                 {
656                         "revoke",
657                         rpc_rights_revoke,
658                         NET_TRANSPORT_RPC,
659                         N_("Revoke privilege[s]"),
660                         N_("net rpc rights revoke\n"
661                            "    Revoke privilege[s]")
662                 },
663                 {NULL, NULL, 0, NULL, NULL}
664         };
665
666         return net_run_function(c, argc, argv, "net rpc rights", func);
667 }
668
669 static NTSTATUS rpc_sh_rights_list(struct net_context *c,
670                                    TALLOC_CTX *mem_ctx, struct rpc_sh_ctx *ctx,
671                                    struct rpc_pipe_client *pipe_hnd,
672                                    int argc, const char **argv)
673 {
674         return rpc_rights_list_internal(c, ctx->domain_sid, ctx->domain_name,
675                                         ctx->cli, pipe_hnd, mem_ctx,
676                                         argc, argv);
677 }
678
679 static NTSTATUS rpc_sh_rights_grant(struct net_context *c,
680                                     TALLOC_CTX *mem_ctx,
681                                     struct rpc_sh_ctx *ctx,
682                                     struct rpc_pipe_client *pipe_hnd,
683                                     int argc, const char **argv)
684 {
685         return rpc_rights_grant_internal(c, ctx->domain_sid, ctx->domain_name,
686                                          ctx->cli, pipe_hnd, mem_ctx,
687                                          argc, argv);
688 }
689
690 static NTSTATUS rpc_sh_rights_revoke(struct net_context *c,
691                                      TALLOC_CTX *mem_ctx,
692                                      struct rpc_sh_ctx *ctx,
693                                      struct rpc_pipe_client *pipe_hnd,
694                                      int argc, const char **argv)
695 {
696         return rpc_rights_revoke_internal(c, ctx->domain_sid, ctx->domain_name,
697                                           ctx->cli, pipe_hnd, mem_ctx,
698                                           argc, argv);
699 }
700
701 struct rpc_sh_cmd *net_rpc_rights_cmds(struct net_context *c, TALLOC_CTX *mem_ctx,
702                                        struct rpc_sh_ctx *ctx)
703 {
704         static struct rpc_sh_cmd cmds[] = {
705
706         { "list", NULL, &ndr_table_lsarpc.syntax_id, rpc_sh_rights_list,
707           N_("View available or assigned privileges") },
708
709         { "grant", NULL, &ndr_table_lsarpc.syntax_id, rpc_sh_rights_grant,
710           N_("Assign privilege[s]") },
711
712         { "revoke", NULL, &ndr_table_lsarpc.syntax_id, rpc_sh_rights_revoke,
713           N_("Revoke privilege[s]") },
714
715         { NULL, NULL, 0, NULL, NULL }
716         };
717
718         return cmds;
719 }
720