Cyrus wildcard question

Rob Siemborski rjs3 at andrew.cmu.edu
Mon Dec 1 14:41:23 EST 2003


On Sat, 29 Nov 2003, Ken Murchison wrote:

> > (cyrus-imapd-2.1.16)
>
> This is clearly wrong.  Its appears to do the same thing in v2.2 as well.

Well, its valid IMAP, even if it is nonsensical (that fun with unsolicited
responses and all).

In any case, I just posted a patch for this problem (ghier wasn't being
reset to NULL).  Sadly, I screwed up the patch and its spread across three
versions:

-Rob

diff -u -r1.25 -r1.25.2.3
--- glob.c      13 Feb 2003 20:15:40 -0000      1.25
+++ glob.c      1 Dec 2003 19:40:55 -0000       1.25.2.3
@@ -42,7 +42,7 @@
  * Start Date: 4/5/93
  */
 /*
- * $Id: glob.c,v 1.25 2003/02/13 20:15:40 rjs3 Exp $
+ * $Id: glob.c,v 1.25.2.3 2003/12/01 19:40:55 rjs3 Exp $
  */

 #include <config.h>
@@ -213,7 +213,8 @@
     const char *ghier, *phier; /* pointers for '%' patterns */
     const char *start;         /* start of input string */
     int newglob;
-
+    int firsttime = 1;
+
     /* check for remaining partial matches */
     if (min && *min < 0) return (-1);

@@ -248,13 +249,20 @@
        ghier = g->ghier;
        gptr = g->gptr;
     }
-
+
     /* main globbing loops */
     if (!(g->flags & GLOB_ICASE)) {
        /* case sensitive version */

        /* loop to manage wildcards */
        do {
+           /* reset hierarchy state */
+           if(firsttime) {
+               firsttime = 0;
+           } else {
+               ghier = NULL;
+           }
+
            /* see if we match to the next '%' or '*' wildcard */
            while (*gptr != '*' && *gptr != '%' && ptr != pend
                   && (*gptr == *ptr || (!newglob && *gptr == '?'))) {
@@ -329,6 +337,13 @@

        /* loop to manage wildcards */
        do {
+           /* reset hierarchy state */
+           if(firsttime) {
+               firsttime = 0;
+           } else {
+               ghier = NULL;
+           }
+
            /* see if we match to the next '%' or '*' wildcard */
            while (*gptr != '*' && *gptr != '%' && ptr != pend
                   && ((unsigned char) *gptr == TOLOWER(*ptr) ||


-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Rob Siemborski | Andrew Systems Group * Research Systems Programmer
PGP:0x5CE32FCC | Cyert Hall 207 * rjs3 at andrew.cmu.edu * 412.268.7456
-----BEGIN GEEK CODE BLOCK----
Version: 3.12
GCS/IT/CM/PA d- s+: a-- C++++$ ULS++++$ P+++$ L+++(++++) E W+ N o? K-
w O- M-- V-- PS+ PE++ Y+ PGP+ t+@ 5+++ R@ tv-@ b+ DI+++ G e++ h r- y?
------END GEEK CODE BLOCK-----





More information about the Info-cyrus mailing list