From 5d7084fc5e5cfb47a36ea2d26a74b0b5bbd7724a Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Tue, 6 Oct 2009 09:33:45 -0400 Subject: [PATCH] Windows: fs listacl -cmd Add the new functionality from the Unix fs command to Windows. LICENSE BSD Reviewed-on: http://gerrit.openafs.org/585 Tested-by: Jeffrey Altman Reviewed-by: Hartmut Reuter Reviewed-by: Jeffrey Altman --- src/WINNT/afsd/fs.c | 92 +++++++++++++++++++++++++++------------------ 1 file changed, 56 insertions(+), 36 deletions(-) diff --git a/src/WINNT/afsd/fs.c b/src/WINNT/afsd/fs.c index eb76a4dbe..295c1cfff 100644 --- a/src/WINNT/afsd/fs.c +++ b/src/WINNT/afsd/fs.c @@ -1376,43 +1376,62 @@ ListACLCmd(struct cmd_syndesc *as, void *arock) error = 1; continue; } - switch (ta->dfs) { - case 0: - printf("Access list for %s is\n", ti->data); - break; - case 1: - printf("DFS access list for %s is\n", ti->data); - break; - case 2: - printf("DFS initial directory access list of %s is\n", ti->data); - break; - case 3: - printf("DFS initial file access list of %s is\n", ti->data); - break; - } - if (ta->dfs) { - printf(" Default cell = %s\n", ta->cell); - } - separator = ta->dfs? DFS_SEPARATOR : ' '; - if (ta->nplus > 0) { - if (!ta->dfs) - printf("Normal rights:\n"); - for(te = ta->pluslist;te;te=te->next) { - printf(" %s%c", te->name, separator); - PRights(te->rights, ta->dfs); - printf("\n"); - } - } - if (ta->nminus > 0) { - printf("Negative rights:\n"); - for(te = ta->minuslist;te;te=te->next) { - printf(" %s ", te->name); - PRights(te->rights, ta->dfs); - printf("\n"); - } - } - if (ti->next) + if (as->parms[3].items) { /* -cmd */ + printf("fs setacl -dir %s -acl ", ti->data); + if (ta->nplus > 0) { + for (te = ta->pluslist; te; te = te->next) { + printf(" %s ", te->name); + PRights(te->rights, ta->dfs); + } + } printf("\n"); + if (ta->nminus > 0) { + printf("fs setacl -dir %s -acl ", ti->data); + for (te = ta->minuslist; te; te = te->next) { + printf(" %s ", te->name); + PRights(te->rights, ta->dfs); + } + printf(" -negative\n"); + } + } else { + switch (ta->dfs) { + case 0: + printf("Access list for %s is\n", ti->data); + break; + case 1: + printf("DFS access list for %s is\n", ti->data); + break; + case 2: + printf("DFS initial directory access list of %s is\n", ti->data); + break; + case 3: + printf("DFS initial file access list of %s is\n", ti->data); + break; + } + if (ta->dfs) { + printf(" Default cell = %s\n", ta->cell); + } + separator = ta->dfs? DFS_SEPARATOR : ' '; + if (ta->nplus > 0) { + if (!ta->dfs) + printf("Normal rights:\n"); + for(te = ta->pluslist;te;te=te->next) { + printf(" %s%c", te->name, separator); + PRights(te->rights, ta->dfs); + printf("\n"); + } + } + if (ta->nminus > 0) { + printf("Negative rights:\n"); + for(te = ta->minuslist;te;te=te->next) { + printf(" %s ", te->name); + PRights(te->rights, ta->dfs); + printf("\n"); + } + } + if (ti->next) + printf("\n"); + } ZapAcl(ta); } return error; @@ -5064,6 +5083,7 @@ int wmain(int argc, wchar_t **wargv) parm_listacl_id = ts->nParms; cmd_AddParm(ts, "-id", CMD_FLAG, CMD_OPTIONAL, "initial directory acl"); cmd_AddParm(ts, "-if", CMD_FLAG, CMD_OPTIONAL, "initial file acl"); + cmd_AddParm(ts, "-cmd", CMD_FLAG, CMD_OPTIONAL, "output as 'fs setacl' command"); cmd_CreateAlias(ts, "la"); ts = cmd_CreateSyntax("cleanacl", CleanACLCmd, NULL, "clean up access control list"); -- 2.39.5