dovecot-2.2: lib: wildcard_match() should have matched "*" wildc...

dovecot at dovecot.org dovecot at dovecot.org
Tue Aug 19 21:53:39 UTC 2014


details:   http://hg.dovecot.org/dovecot-2.2/rev/2ca346d91310
changeset: 17726:2ca346d91310
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Aug 19 23:51:14 2014 +0200
description:
lib: wildcard_match() should have matched "*" wildcard against an empty "" string also.
This fixes global ACL "*" matching the root namespace when creating new
mailboxes.

diffstat:

 src/lib/wildcard-match.c |  8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diffs (18 lines):

diff -r bd381e882485 -r 2ca346d91310 src/lib/wildcard-match.c
--- a/src/lib/wildcard-match.c	Mon Aug 18 22:39:56 2014 +0200
+++ b/src/lib/wildcard-match.c	Tue Aug 19 23:51:14 2014 +0200
@@ -29,9 +29,11 @@
   int match = 1;
   int sofar = 0;
 
-  /* null strings should never match */
-  if ((ma == NULL) || (na == NULL) || (!*ma) || (!*na))
-    return NOMATCH;
+  if (na[0] == '\0') {
+	  /* empty string can match only "*" wildcard(s) */
+	  while (ma[0] == '*') ma++;
+	  return ma[0] == '\0' ? MATCH : NOMATCH;
+  }
   /* find the end of each string */
   while (*(++mask));
   mask--;


More information about the dovecot-cvs mailing list