Blob Blame History Raw
From 3e04a812772191e2c0e4f4be70584990a7235cbe Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pavel=20B=C5=99ezina?= <pbrezina@redhat.com>
Date: Thu, 15 Aug 2019 12:52:04 +0200
Subject: [PATCH 87/90] autofs: allow to run only setent without enumeration in
 test tool
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

So we can test that setent stores only the map object.

Resolves:
https://pagure.io/SSSD/sssd/issue/2607

Reviewed-by: Tomáš Halman <thalman@redhat.com>
---
 src/sss_client/autofs/autofs_test_client.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/sss_client/autofs/autofs_test_client.c b/src/sss_client/autofs/autofs_test_client.c
index 6bbd2a0e8..18d666895 100644
--- a/src/sss_client/autofs/autofs_test_client.c
+++ b/src/sss_client/autofs/autofs_test_client.c
@@ -44,9 +44,11 @@ int main(int argc, const char *argv[])
     char *key = NULL;
     char *value = NULL;
     char *pc_key = NULL;
+    int pc_setent = 0;
     struct poptOption long_options[] = {
         POPT_AUTOHELP
         { "by-name",  'n', POPT_ARG_STRING, &pc_key, 0, "Request map by name", NULL },
+        { "only-setent",  's', POPT_ARG_VAL, &pc_setent, 1, "Run only setent, do not enumerate", NULL },
         POPT_TABLEEND
     };
     poptContext pc = NULL;
@@ -75,6 +77,10 @@ int main(int argc, const char *argv[])
     }
     printf("setautomntent done for %s\n", mapname);
 
+    if (pc_setent) {
+        goto end;
+    }
+
     if (!pc_key) {
         do {
             ret = _sss_getautomntent_r(&key, &value, ctx);
-- 
2.20.1