From 1330390c698ca0802200725df43356557aa633a2 Mon Sep 17 00:00:00 2001 From: Justin Stephenson Date: Thu, 29 Sep 2016 11:17:20 -0400 Subject: sss_cache: improve option argument handling Print informational message and exit when multiple arguments are provided for single-argument options with sss_cache Resolves: https://fedorahosted.org/sssd/ticket/3180 Reviewed-by: Jakub Hrozek --- src/man/sss_cache.8.xml | 3 ++- src/tools/sss_cache.c | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/man/sss_cache.8.xml b/src/man/sss_cache.8.xml index 3b0f788ad..221c0a86e 100644 --- a/src/man/sss_cache.8.xml +++ b/src/man/sss_cache.8.xml @@ -30,7 +30,8 @@ sss_cache invalidates records in SSSD cache. Invalidated records are forced to be reloaded from server as soon - as related SSSD backend is online. + as related SSSD backend is online. Options that invalidate a single + object only accept a single provided argument. diff --git a/src/tools/sss_cache.c b/src/tools/sss_cache.c index 8b78b29f1..f1d08937f 100644 --- a/src/tools/sss_cache.c +++ b/src/tools/sss_cache.c @@ -745,6 +745,14 @@ static errno_t init_context(int argc, const char *argv[], BAD_POPT_PARAMS(pc, poptStrerror(ret), ret, fini); } + if (poptGetArg(pc)) { + BAD_POPT_PARAMS(pc, + _("Unexpected argument(s) provided, options that " + "invalidate a single object only accept a single " + "provided argument.\n"), + ret, fini); + } + if (idb == INVALIDATE_NONE && !values.user && !values.group && !values.netgroup && !values.service && !values.map && !values.ssh_host && !values.sudo_rule) { -- cgit