From c93405f10d8ec56f11c581f72c9b9930bf944185 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Mon, 30 May 2016 23:33:03 +0200 Subject: [PATCH] nsc: New enum ca_dump member CA_DUMP_ONLY CA_DUMP_ONLY selectors are like CA_DUMP_NONE, except the xdump command still has them. This will permit adding selectors for conditional selector and xdump command forward compatibility without also adding them to configuration tables. Signed-off-by: Markus Armbruster --- include/nsc.h | 1 + src/lib/common/ef_verify.c | 2 +- src/lib/common/xdump.c | 5 +++++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/include/nsc.h b/include/nsc.h index 2a0aee68..f076c4e1 100644 --- a/include/nsc.h +++ b/include/nsc.h @@ -201,6 +201,7 @@ enum ca_dump { /* order is relevant */ CA_DUMP, /* xdump and xundump normally */ CA_DUMP_CONST, /* same, but value can't be changed */ + CA_DUMP_ONLY, /* only in xdump command */ CA_DUMP_NONE /* do not xdump or xundump */ }; diff --git a/src/lib/common/ef_verify.c b/src/lib/common/ef_verify.c index eb982434..b5c31eac 100644 --- a/src/lib/common/ef_verify.c +++ b/src/lib/common/ef_verify.c @@ -81,7 +81,7 @@ verify_ca(int type) if (CANT_HAPPEN((ef_flags(type) & EFF_MEM) && ca[i].ca_get && ca[i].ca_dump <= CA_DUMP_CONST)) - ca[i].ca_dump = CA_DUMP_NONE; + ca[i].ca_dump = CA_DUMP_ONLY; } return 0; } diff --git a/src/lib/common/xdump.c b/src/lib/common/xdump.c index 7357a7e4..219e33a0 100644 --- a/src/lib/common/xdump.c +++ b/src/lib/common/xdump.c @@ -81,7 +81,10 @@ /* * Initialize @xd. + * If @cnum is NATID_BAD, this is an empdump export rather than an + * xdump command. * Translate dump for country @cnum, except when @cnum is NATID_BAD. + * Ignore CA_DUMP_ONLY selectors when @cnum is NATID_BAD. * If @human, dump in human-readable format. * If @sloppy, try to cope with invalid data (may result in invalid * dump). @@ -244,6 +247,8 @@ xdflds(struct xdstr *xd, struct castr ca[], void *ptr) continue; if (ca[i].ca_dump == CA_DUMP_NONE) continue; + if (ca[i].ca_dump == CA_DUMP_ONLY && xd->cnum == NATID_BAD) + continue; n = CA_ARRAY_LEN(&ca[i]); j = 0; do {