diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2018-10-29 12:49:00 +0100 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2018-10-29 15:07:35 +0100 |
commit | 1a5153117784c267ceb81c048dd5e9b9c4309fbb (patch) | |
tree | 23b5b83b5a8e76c4ed1463e8f93980564f2c3ebd /src/main.c | |
parent | 48636e1fe6f6d3141de735f9faf4c359938b837c (diff) |
src: default to numeric UID and GID listing
Like iptables-save, print UID and GID as numeric values by default.
Add a new option `-u' to print the UID and GID names as defined by
/etc/passwd and /etc/group.
Note that -n is ignored after this patch, since default are numeric
printing for UID and GID.
Acked-by: Phil Sutter <phil@nwl.cc>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -39,10 +39,11 @@ enum opt_vals { OPT_DEBUG = 'd', OPT_HANDLE_OUTPUT = 'a', OPT_ECHO = 'e', + OPT_GUID = 'u', OPT_INVALID = '?', }; -#define OPTSTRING "hvcf:iI:jvnsNaeS" +#define OPTSTRING "hvcf:iI:jvnsNaeSu" static const struct option options[] = { { @@ -105,6 +106,10 @@ static const struct option options[] = { .val = OPT_JSON, }, { + .name = "guid", + .val = OPT_GUID, + }, + { .name = NULL } }; @@ -127,6 +132,7 @@ static void show_help(const char *name) " Specify twice to also show Internet services (port numbers) numerically.\n" " Specify three times to also show protocols, user IDs, and group IDs numerically.\n" " -s, --stateless Omit stateful information of ruleset.\n" +" -u, --guid Print UID/GID as defined in /etc/passwd and /etc/group.\n" " -N Translate IP addresses to names.\n" " -S, --service Translate ports to service names as described in /etc/services.\n" " -a, --handle Output rule handle.\n" @@ -276,6 +282,9 @@ int main(int argc, char * const *argv) output_flags |= NFT_CTX_OUTPUT_JSON; #endif break; + case OPT_GUID: + output_flags |= NFT_CTX_OUTPUT_GUID; + break; case OPT_INVALID: exit(EXIT_FAILURE); } |