From bc00f6f8817f1d2407b6a51ca989ef85d88f97de Mon Sep 17 00:00:00 2001
From: Emil Karlson <jekarlson@gmail.com>
Date: Wed, 14 Jun 2017 16:23:27 +0300
Subject: [PATCH] match.c: allow use of FNM_EXTMATCH, where available

---
 plugins/sudoers/match.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/plugins/sudoers/match.c b/plugins/sudoers/match.c
index bb68285..e6c8d19 100644
--- a/plugins/sudoers/match.c
+++ b/plugins/sudoers/match.c
@@ -356,7 +356,11 @@ cmnd_matches(const struct member *m)
 static bool
 command_args_match(const char *sudoers_cmnd, const char *sudoers_args)
 {
+#ifdef FNM_EXTMATCH
+    int flags = FNM_EXTMATCH;
+#else
     int flags = 0;
+#endif
     debug_decl(command_args_match, SUDOERS_DEBUG_MATCH)
 
     /*
@@ -373,7 +377,7 @@ command_args_match(const char *sudoers_cmnd, const char *sudoers_args)
     if (sudoers_args) {
 	/* For sudoedit, all args are assumed to be pathnames. */
 	if (strcmp(sudoers_cmnd, "sudoedit") == 0)
-	    flags = FNM_PATHNAME;
+	    flags |= FNM_PATHNAME;
 	if (fnmatch(sudoers_args, user_args ? user_args : "", flags) == 0)
 	    debug_return_bool(true);
     }
-- 
2.13.0

