On Mon, Jun 25, 2001 at 12:34:28PM +0200, Matthias Blaser wrote:
> the only things i've edited are the password strings...

That's ok of course.

> maybe it is the problem that i've only defined mailmessagestore but no 
> homedirectory ?? 

hmm, don't think so. the dash-trick patch doesn't change anything regarding
this.

please try this patch instead of the original dash-trick patch. it just adds
some debugging. post your log snippets afterwards.

--- ../qmail-1.03-patch20010301-orig/qmail-lspawn.c     Thu Mar  1 23:33:40 2001
+++ qmail-lspawn.c      Mon Mar  5 20:10:39 2001
@@ -351,6 +351,9 @@
    int  reply;
    int  at;
    int  i;
+#ifdef DASH_EXT
+   int  dash;
+#endif
    int  force_forward;
    char *r;
    stralloc filter = {0};
@@ -401,37 +404,76 @@
    ret = ldap_lookup(&search, attrs, &info, extra);
 
    if ( ret != 0 && qldap_errno == LDAP_NOSUCH ) {
-      /* this handles the "catch all" extension */
+      /* extensions: catchall and dash-trick */
       at = 0;
       r = mail->s;
       i = mail->len;
       for (at = i - 1; r[at] != '@' && at >= 0 ; at--) ; 
             /* handels also mailwith 2 @ */
-      /* build the search string for the email address */
-      if (!stralloc_copys(&filter, "")) _exit(QLX_NOMEM); 
-      if (!stralloc_copys(&filter,"(|(" ) ) _exit(QLX_NOMEM);
-      /* optional objectclass */
-      if (qldap_objectclass.len) {
-        if (!stralloc_cats(&filter,LDAP_OBJECTCLASS)) _exit(QLX_NOMEM);
-        if (!stralloc_cats(&filter,"=")) _exit(QLX_NOMEM);
-        if (!stralloc_cat(&filter,&qldap_objectclass)) _exit(QLX_NOMEM);
-        if (!stralloc_cats(&filter,")(")) _exit(QLX_NOMEM);
-      } /* end */
-      if (!stralloc_cats(&filter,LDAP_MAIL)) _exit(QLX_NOMEM);
-      if (!stralloc_cats(&filter,"=")) _exit(QLX_NOMEM);
-      if (!stralloc_cats(&filter,LDAP_CATCH_ALL)) _exit(QLX_NOMEM);
-      if (!stralloc_catb(&filter,r+at, i-at)) _exit(QLX_NOMEM);
-      if (!stralloc_cats(&filter,")(")) _exit(QLX_NOMEM);
-      if (!stralloc_cats(&filter,LDAP_MAILALTERNATE)) _exit(QLX_NOMEM);
-      if (!stralloc_cats(&filter,"=")) _exit(QLX_NOMEM);
-      if (!stralloc_cats(&filter,LDAP_CATCH_ALL)) _exit(QLX_NOMEM);
-      if (!stralloc_catb(&filter,r+at, i-at)) _exit(QLX_NOMEM);
-      if (!stralloc_cats(&filter,"))")) _exit(QLX_NOMEM);
-      if (!stralloc_0(&filter)) _exit(QLX_NOMEM);
       
-      debug(16, "retry with filter '%s'\n", filter.s);
-      /* do the search for the catchall address */
-      ret = ldap_lookup(&search, attrs, &info, extra);
+#ifdef DASH_EXT
+      dash=0;
+      printf("debug1");
+      for (dash = at-1; dash > 0 && ret != 0 && qldap_errno == LDAP_NOSUCH; dash--) {
+        if ( r[dash-1] == '-' ) {
+        /* dash ext */
+            if (!stralloc_copys(&filter, "")) _exit(QLX_NOMEM); 
+            if (!stralloc_copys(&filter,"(|(" ) ) _exit(QLX_NOMEM);
+            /* optional objectclass */
+            if (qldap_objectclass.len) {
+              if (!stralloc_cats(&filter,LDAP_OBJECTCLASS)) _exit(QLX_NOMEM);
+              if (!stralloc_cats(&filter,"=")) _exit(QLX_NOMEM);
+              if (!stralloc_cat(&filter,&qldap_objectclass)) _exit(QLX_NOMEM);
+              if (!stralloc_cats(&filter,")(")) _exit(QLX_NOMEM);
+            } /* end */
+            if (!stralloc_cats(&filter,LDAP_MAIL)) _exit(QLX_NOMEM);
+            if (!stralloc_cats(&filter,"=")) _exit(QLX_NOMEM);
+            if (!stralloc_catb(&filter,r,dash-1)) _exit(QLX_NOMEM);
+            if (!stralloc_catb(&filter,r+at, i-at)) _exit(QLX_NOMEM);
+            if (!stralloc_cats(&filter,")(")) _exit(QLX_NOMEM);
+            if (!stralloc_cats(&filter,LDAP_MAILALTERNATE)) _exit(QLX_NOMEM);
+            if (!stralloc_cats(&filter,"=")) _exit(QLX_NOMEM);
+            if (!stralloc_catb(&filter,r,dash-1)) _exit(QLX_NOMEM);
+            if (!stralloc_catb(&filter,r+at, i-at)) _exit(QLX_NOMEM);
+            if (!stralloc_cats(&filter,"))")) _exit(QLX_NOMEM);
+            if (!stralloc_0(&filter)) _exit(QLX_NOMEM);
+       
+            debug(16, "retry with filter '%s'\n", filter.s);
+            /* do the search */
+           ret = ldap_lookup(&search, attrs, &info, extra);
+       }
+      }
+
+      if (ret != 0 && qldap_errno == LDAP_NOSUCH) {
+#endif
+      printf("debug2");
+        /* catchall */
+        /* build the search string for the email address */
+        if (!stralloc_copys(&filter, "")) _exit(QLX_NOMEM); 
+        if (!stralloc_copys(&filter,"(|(" ) ) _exit(QLX_NOMEM);
+        /* optional objectclass */
+        if (qldap_objectclass.len) {
+           if (!stralloc_cats(&filter,LDAP_OBJECTCLASS)) _exit(QLX_NOMEM);
+           if (!stralloc_cats(&filter,"=")) _exit(QLX_NOMEM);
+           if (!stralloc_cat(&filter,&qldap_objectclass)) _exit(QLX_NOMEM);
+           if (!stralloc_cats(&filter,")(")) _exit(QLX_NOMEM);
+        } /* end */
+        if (!stralloc_cats(&filter,LDAP_MAIL)) _exit(QLX_NOMEM);
+        if (!stralloc_cats(&filter,"=")) _exit(QLX_NOMEM);
+        if (!stralloc_cats(&filter,LDAP_CATCH_ALL)) _exit(QLX_NOMEM);
+        if (!stralloc_catb(&filter,r+at, i-at)) _exit(QLX_NOMEM);
+        if (!stralloc_cats(&filter,")(")) _exit(QLX_NOMEM);
+        if (!stralloc_cats(&filter,LDAP_MAILALTERNATE)) _exit(QLX_NOMEM);
+        if (!stralloc_cats(&filter,"=")) _exit(QLX_NOMEM);
+        if (!stralloc_cats(&filter,LDAP_CATCH_ALL)) _exit(QLX_NOMEM);
+        if (!stralloc_catb(&filter,r+at, i-at)) _exit(QLX_NOMEM);
+        if (!stralloc_cats(&filter,"))")) _exit(QLX_NOMEM);
+        if (!stralloc_0(&filter)) _exit(QLX_NOMEM);
+      
+        debug(16, "retry with filter '%s'\n", filter.s);
+        /* do the search for the catchall address */
+        ret = ldap_lookup(&search, attrs, &info, extra);
+#ifdef DASH_EXT
+      }
+#endif
    }
    alloc_free(filter.s); filter.s = 0;
 
@@ -525,11 +567,23 @@
    }
    if (!stralloc_0(&nughde)) _exit(QLX_NOMEM);
 
-   /* At the moment we ignore the dash-field and the extension field *
-    * so we fill up the nughde structure with '\0'                   */
-   
-   if (!stralloc_0(&nughde)) _exit(QLX_NOMEM);
-   if (!stralloc_0(&nughde)) _exit(QLX_NOMEM);
+#ifdef DASH_EXT
+      printf("debug3");
+   /* Here we fill the nughde structure with the dash-field the extension field */
+        if ((dash > 0) && (dash < (at-1))) {
+             if (!stralloc_cats(&nughde,"-")) _exit(QLX_NOMEM);
+             if (!stralloc_0(&nughde)) _exit(QLX_NOMEM);
+             if (!stralloc_catb(&nughde,r+dash+1,at-dash-1)) _exit(QLX_NOMEM);
+             if (!stralloc_0(&nughde)) _exit(QLX_NOMEM);
+          
+      printf("debug4");
+     } else {
+#endif
+       
+             if (!stralloc_0(&nughde)) _exit(QLX_NOMEM);
+             if (!stralloc_0(&nughde)) _exit(QLX_NOMEM);
+
+      printf("debug5");
+#ifdef DASH_EXT          
+     }
+#endif   
 
    /* get the quota for the user of that maildir mbox */
    if ( extra[0].vals != 0 ) {



-- 
* Henning Brauer, [EMAIL PROTECTED], http://www.bsws.de *
* Roedingsmarkt 14, 20459 Hamburg, Germany               *
Unix is very simple, but it takes a genius to understand the simplicity.
(Dennis Ritchie)

Reply via email to