opensc-tool: Fix ACL reporting for EF-s. Patch by Emanuele Pucciarelli.

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4623 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
martin 2010-08-14 12:18:27 +00:00
parent 9f639f48c4
commit 409284ed60
1 changed files with 14 additions and 5 deletions

View File

@ -453,16 +453,25 @@ static int do_info(int argc, char **argv)
"Linear fixed, SIMPLE-TLV", "Linear variable",
"Linear variable TLV", "Cyclic, SIMPLE-TLV",
};
const char *ops[] = {
"READ", "UPDATE", "DELETE", "WRITE", "REHABILITATE",
"INVALIDATE", "LIST_FILES", "CRYPTO",
const struct {
const char * label;
int op;
} ops[] = {
{ "READ", SC_AC_OP_READ },
{ "UPDATE", SC_AC_OP_UPDATE },
{ "DELETE", SC_AC_OP_DELETE },
{ "WRITE", SC_AC_OP_WRITE },
{ "REHABILITATE", SC_AC_OP_REHABILITATE },
{ "INVALIDATE", SC_AC_OP_INVALIDATE },
{ "LIST_FILES", SC_AC_OP_LIST_FILES },
{ "CRYPTO", SC_AC_OP_CRYPTO },
};
printf("%-15s%s\n", "EF structure:", structs[file->ef_structure]);
for (i = 0; i < sizeof(ops)/sizeof(ops[0]); i++) {
char buf[80];
sprintf(buf, "ACL for %s:", ops[i]);
printf("%-25s%s\n", buf, util_acl_to_str(sc_file_get_acl_entry(file, i)));
sprintf(buf, "ACL for %s:", ops[i].label);
printf("%-25s%s\n", buf, util_acl_to_str(sc_file_get_acl_entry(file, ops[i].op)));
}
}
if (file->prop_attr_len) {