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/tools/sss_cache.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/tools') 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