summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJustin Stephenson <jstephen@redhat.com>2016-09-29 11:17:20 -0400
committerJakub Hrozek <jhrozek@redhat.com>2016-10-10 12:08:41 +0200
commit1330390c698ca0802200725df43356557aa633a2 (patch)
tree9502ce818545effb7a7478f29f356effbfd80109
parenta5b4f865aae08d978e7bbbe1ff5c4b93ac41aa85 (diff)
downloadsssd-1330390c698ca0802200725df43356557aa633a2.tar.gz
sssd-1330390c698ca0802200725df43356557aa633a2.tar.xz
sssd-1330390c698ca0802200725df43356557aa633a2.zip
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 <jhrozek@redhat.com>
-rw-r--r--src/man/sss_cache.8.xml3
-rw-r--r--src/tools/sss_cache.c8
2 files changed, 10 insertions, 1 deletions
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 @@
<para>
<command>sss_cache</command> 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.
</para>
</refsect1>
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) {