Blob Blame History Raw
autofs-5.1.1 - implement reinit in hosts lookup module

From: Ian Kent <raven@themaw.net>

Refactor the hosts lookup module to add an implementation for the newly
added reinit entry point.

Signed-off-by: Ian Kent <raven@themaw.net>
---
 modules/lookup_hosts.c |   10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/modules/lookup_hosts.c b/modules/lookup_hosts.c
index 8ba0a4a..0a64655 100644
--- a/modules/lookup_hosts.c
+++ b/modules/lookup_hosts.c
@@ -69,6 +69,7 @@ int lookup_init(const char *mapfmt,
 		free(ctxt);
 		return 1;
 	}
+
 	*context = ctxt;
 
 	return 0;
@@ -77,6 +78,15 @@ int lookup_init(const char *mapfmt,
 int lookup_reinit(const char *mapfmt,
 		  int argc, const char *const *argv, void **context)
 {
+	struct lookup_context *ctxt = (struct lookup_context *) *context;
+	int ret;
+
+	mapfmt = MAPFMT_DEFAULT;
+
+	ret = reinit_parse(ctxt->parse, mapfmt, MODPREFIX, argc, argv);
+	if (ret)
+		return 1;
+
 	return 0;
 }