1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-11 05:18:09 +03:00

s3-net: Fix Bug #6328: support "net sam rights grant/revoke" with multiple rights.

David

Signed-off-by: Günther Deschner <gd@samba.org>
This commit is contained in:
David Markey 2009-06-17 18:29:20 +02:00 committed by Günther Deschner
parent 13494c0f8f
commit 86450bd59c

View File

@ -682,7 +682,7 @@ static int net_sam_rights_grant(struct net_context *c, int argc,
if (argc < 2 || c->display_usage) {
d_fprintf(stderr, "usage: net sam rights grant <name> "
"<right> ...\n");
"<rights> ...\n");
return -1;
}
@ -709,16 +709,18 @@ static int net_sam_rights_grant(struct net_context *c, int argc,
return 0;
}
static int net_sam_rights_revoke(struct net_context *c, int argc, const char **argv)
static int net_sam_rights_revoke(struct net_context *c, int argc,
const char **argv)
{
DOM_SID sid;
enum lsa_SidType type;
const char *dom, *name;
SE_PRIV mask;
int i;
if (argc != 2 || c->display_usage) {
if (argc < 2 || c->display_usage) {
d_fprintf(stderr, "usage: net sam rights revoke <name> "
"<right>\n");
"<rights>\n");
return -1;
}
@ -728,8 +730,10 @@ static int net_sam_rights_revoke(struct net_context *c, int argc, const char **a
return -1;
}
if (!se_priv_from_name(argv[1], &mask)) {
d_fprintf(stderr, "%s unknown\n", argv[1]);
for (i=1; i < argc; i++) {
if (!se_priv_from_name(argv[i], &mask)) {
d_fprintf(stderr, "%s unknown\n", argv[i]);
return -1;
}
@ -738,7 +742,9 @@ static int net_sam_rights_revoke(struct net_context *c, int argc, const char **a
return -1;
}
d_printf("Revoked %s from %s\\%s\n", argv[1], dom, name);
d_printf("Revoked %s from %s\\%s\n", argv[i], dom, name);
}
return 0;
}
@ -757,17 +763,17 @@ static int net_sam_rights(struct net_context *c, int argc, const char **argv)
"grant",
net_sam_rights_grant,
NET_TRANSPORT_LOCAL,
"Grant a right",
"Grant right(s)",
"net sam rights grant\n"
" Grant a right"
" Grant right(s)"
},
{
"revoke",
net_sam_rights_revoke,
NET_TRANSPORT_LOCAL,
"Revoke a right",
"Revoke right(s)",
"net sam rights revoke\n"
" Revoke a right"
" Revoke right(s)"
},
{NULL, NULL, 0, NULL, NULL}
};