Hi Timo,

since I could not just let it be, i found a workaround, could you review
the patch in attachment ?

I'm going to look into the second subfolder bug...



On 08/07/2010 05:36 PM, Samuel Kvasnica wrote:
>  Hi Timo,
>
> in addition to my last message regarding public folders I did some more
> testing on the shared folder issue.
>
> It seems like there are 2 separate issues, both related to misbehaving
> LSUB command but different.
>
> For a shared folder a command like e.g.:
>
> , lsub "" "Shared/dot.user/dot_share"
>
> will return nothing, even if this folder is subscribed because
> list_escape (out of some strange reason) gets an empty prefix and
> wrongly escapes the user name dot.user to dot\2euser.
>
> For the LIST command on other hand it works, because it first fails with
> zero prefix but then all namespaces are probed which
> will succeed for prefix "Shared/dot.user". The difference seems to be
> the condition in cmd-list.c, list_namespace_init()
> testing for some subscription flags.
>
> Could you give some hint, whether a quick workaround is possible ? I
> have a feeling the listescape plugin is implemented at wrong place,
> somewhere directly above the storage stuff or as an virtual storage
> interface would be cleaner ?
>
> regards,
>
> Sam
>

--- listescape-plugin.c.orig    2010-08-06 20:02:57.000000000 +0200                                                                                                   
+++ listescape-plugin.c 2010-08-07 19:19:23.059376844 +0200                                                                                                           
@@ -60,23 +63,28 @@                                                                                                                                                   
                str_append_n(esc, str, i);                                                                                                                            
                str += i;                                                                                                                                             
        }                                                                                                                                                             
-                                                                                                                                                                     
        if (*str == '~') {                                                                                                                                            
                str_printfa(esc, "%c%02x", mlist->escape_char, *str);                                                                                                 
                str++;                                                                                                                                                
        }                                                                                                                                                             
+i_debug("list_escape entry, #3, sep=%c, i=%i, str=%s",ns->sep,i,str);                                                                                                
        for (; *str != '\0'; str++) {                                                                                                                                 
                if (*str == ns->sep) {                                                                                                                                
                        if (!vname)                                                                                                                                   
                                str_append_c(esc, ns->list->hierarchy_sep);                                                                                           
                        else                                                                                                                                          
                                str_append_c(esc, *str);                                                                                                              
-               } else if (*str == ns->list->hierarchy_sep ||                                                                                                         
-                          *str == mlist->escape_char || *str == '/')                                                                                                 
+               } else {                                                                                                                                              
+               if (*str == ns->list->hierarchy_sep || ( mlist && // SK mlist was zero check added !                                                                  
+                          *str == mlist->escape_char) || *str == '/'){                                                                                               
                        str_printfa(esc, "%c%02x", mlist->escape_char, *str);                                                                                         
-               else                                                                                                                                                  
+                       }                                                                                                                                             
+               else{
                        str_append_c(esc, *str);
+                       }
+               }
        }
+i_debug("list_escape entry, output=%s",str_c(esc));
        return str_c(esc);
 }

 static struct mailbox_list_iterate_context *
 listescape_mailbox_list_iter_init(struct mailbox_list *list,
                                  const char *const *patterns,
@@ -119,6 +161,9 @@
        const char **escaped_patterns;
        unsigned int i;

+       struct mail_namespace *parent_ns; // SK
+
+i_debug("listescape_mailbox_list_iter_init, prefix=%s",list->ns->prefix);
        /* this is kind of kludgy. In ACL code we want to convert patterns,
           in maildir renaming code we don't. so for now just use the _RAW_LIST
           flag.. */
@@ -126,8 +171,10 @@
                escaped_patterns = t_new(const char *,
                                         str_array_length(patterns) + 1);
                for (i = 0; patterns[i] != NULL; i++) {
+                       parent_ns = listescape_find_orig_ns(list->ns,patterns[i]); // SK is this a workaround ?
                        escaped_patterns[i] =
-                               list_escape(list->ns, patterns[i], TRUE);
+                               list_escape(parent_ns /*list->ns*/, patterns[i], TRUE);
+                       i_debug("  pattern: %s, esc_pattern: %s",patterns[i],escaped_patterns[i]);
                }
                patterns = escaped_patterns;
        }
@@ -146,25 +193,6 @@
        return ctx;
 }

Reply via email to