Tom,
The first patch implements .qmail-extension files (and also the -default 
variations).  This is useful for me because it means that any special 
delivery rules created for a user can all be put in the users own 
directory, when the user is deleted all the special rules go aswell.

As far as the second patch goes, it just implements what I think is a 
missing feature from the commandline 'valias', and that is the ability to 
remove a line from an alias (either .qmail file or SQL backend).  This 
patch also removes the SQL only restriction.

I know most of the community only want to use SQL backends, I however do 
not, so I have been patching vpopmail for a while now so the file backend 
works.

While scanning the vpopmaild.c code, I noticed a comment in there that the 
list_alias and list_lists commands needed re-writing to use the new valias 
code, this is what I have done.  This removes the need for the bkscandir 
function (although that patch does not remove it).  Also the output of 
these commands does not display the leading .qmail (as the old commands 
did), this is probably correct for both file and SQL backends.

Patches attached :-
1) vpopmail-5.4.13-dot-qmail.patch - Implements .qmail-extension (etc) in 
the users directory.
2) vpopmail-5.4.13-deliveredto.patch - Some changes to how the 
Delivered-To: header line is inserted into an E-Mail, this patch is needed 
to handle E-Mails delivered using the above patch (maildir_to_email can 
return a blank result).
3) vpopmail-5.4.17-valias.patch - Changes to valias to remove SQL only 
restriction and implement alias line removal.
4) vpopmail-5.4.17-vpopmaild.patch - Implements list_alias and list_lists 
commands using the new valias code.

Note: I also have a patch which is the same as 1) but does not call the 
files in the users .qmail, instead calls them .vpopmail files.  I 
personaly prefer .qmail files so vpopmail looks like a qmail installation 
as far as users are concerned.

If there are any bugs in these patches, please let me know.

On Mon, 11 Dec 2006, Tom Collins wrote:

> On Dec 11, 2006, at 3:25 AM, [EMAIL PROTECTED] wrote:
> > I have a patch for implementing personal .qmail files (.qmail files  
> > inside
> > the user directory and not just in the domain directory), I also  
> > have a
> > variation on this patch to name these .vpopmail files.
> >
> > I also have a patch which implements alias line removal in valias.c  
> > (-r
> > flag), removal of SQL aliases only and adding alias line removal in
> > vpalias.c (function valias_remove()).
> >
> > I also have a patch which changes vpopmaild.c to use the new valias  
> > code
> > (as requested in vpopmaild.c - as a comment).
> >
> > Does anyone want these patches - I did not want to litter the list  
> > with
> > them.  I had sent the first one to the list before which while it
> > provoked a discussion got forgotten.  I find them all VERY useful.
> 
> We're definitely interested.  I maintain the 5.4 releases, and have  
> 5.4.18 waiting to be released.  It includes a lot of changes by Rick  
> Widmer, and patches by Peter Pentchev.
> 
> I'm not sure I understand the first one though -- vdelivermail and  
> qmailadmin already support a .qmail file in the user's directory.   
> Are you talking about .qmail-extension files?
> 
> --
> Tom Collins  -  [EMAIL PROTECTED]
> Vpopmail - virtual domains for qmail: http://vpopmail.sf.net/
> QmailAdmin - web interface for Vpopmail: http://qmailadmin.sf.net/
> 
> 
> 
diff -uPr vpopmail-5.4.13.orig/vdelivermail.c vpopmail-5.4.13/vdelivermail.c
--- vpopmail-5.4.13.orig/vdelivermail.c 2005-09-02 19:47:29.000000000 +0100
+++ vpopmail-5.4.13/vdelivermail.c      2005-12-16 15:53:29.000000000 +0000
@@ -62,6 +62,7 @@
 #ifdef QMAIL_EXT
 /* the User with '-' and following chars out if any */
 char TheUserExt[AUTH_SIZE]; 
+char TheExt[AUTH_SIZE];
 #endif
 
 #define FILE_SIZE 156
@@ -217,6 +218,11 @@
         vexit(EXIT_BOUNCE);
     }
 
+    strncpy(TheExt, &TheUser[i+1], AUTH_SIZE);
+    for (i = 0; (TheExt[i] != 0); i++) {
+      if (TheExt[i] == '.') TheExt[i] = ':';
+    }
+
 #endif
 
     vget_assign(TheDomain, TheDomainDir, sizeof(TheDomainDir), &TheDomainUid, 
&TheDomainGid);
@@ -697,16 +703,36 @@
    
     chdir(dir);
 
+#ifdef QMAIL_EXT
     /* format the file name */
-    if ( (fs = fopen(".qmail","r")) == NULL ) {
+    if (strlen(TheExt)) {
+        strcpy(tmpbuf,".qmail-");
+        strcat(tmpbuf,TheExt);
+        if ( (fs = fopen(tmpbuf,"r")) == NULL ) {
+            for (i=strlen(TheExt);i>=0;--i) {
+                if (!i || TheExt[i-1]=='-') {
+                    strcpy(tmpbuf,".qmail-");
+                    strncat(tmpbuf,TheExt,i);
+                    strcat(tmpbuf,"default");
+                    if ( (fs = fopen(tmpbuf,"r")) != NULL) {
+                        break;
+                    }
+                }
+            }
+        }
+    } else {
+        fs = fopen(".qmail","r");
+    }
+#else
+    fs = fopen(".qmail","r");
+#endif
 
+    /* no .qmail file at all */
+    if (fs == NULL ) {
         /* no file, so just return */
         return(-1);
     }
 
-    /* format a simple loop checker name */
-    snprintf(tmpbuf, sizeof(tmpbuf), "[EMAIL PROTECTED]", TheUser, TheDomain);
-
     /* read the file, line by line */
     while ( fgets(qmail_line, sizeof(qmail_line), fs ) != NULL ) {
         if (*qmail_line == '#') continue;
@@ -716,14 +742,6 @@
             if (qmail_line[i] == '\n') qmail_line[i] = 0;
         }
 
-        /* simple loop check, if they are sending it to themselves
-         * then skip this line
-         */
-        if ( strcmp( qmail_line, tmpbuf) == 0 ) continue;
-        /* check for &[EMAIL PROTECTED] as well */
-        if ((*qmail_line == '&') && (strcmp (qmail_line + 1, tmpbuf) == 0))
-            continue;
-
         deliver_mail(qmail_line, "");
 
         return_value = 1;
diff -uPr vpopmail-5.4.13.orig/vdelivermail.c vpopmail-5.4.13/vdelivermail.c
--- vpopmail-5.4.13.orig/vdelivermail.c 2005-09-02 19:47:29.000000000 +0100
+++ vpopmail-5.4.13/vdelivermail.c      2005-11-24 13:06:22.000000000 +0000
@@ -499,6 +499,7 @@
  FILE *fs;
  char tmp_file[256];
  char maildirquota[80];
+ char *email;
 
     /* This is a comment, ignore it */
     if ( *address == '#' ) return;
@@ -597,15 +598,19 @@
         }
 #endif
 
+        /* Get the email address from the maildir */
+        email = maildir_to_email(address);
+
         /* Set the Delivered-To: header */
-        if ( strcmp( address, bounce) == 0 ) {
+        if ( strcmp( address, bounce) == 0 ||
+             strcmp( email, "") == 0 ) {
             snprintf(DeliveredTo, sizeof(DeliveredTo), 
                 "%sDelivered-To: [EMAIL PROTECTED]", getenv("RPLINE"), 
                  TheUser, TheDomain);
         } else {
             snprintf(DeliveredTo, sizeof(DeliveredTo), 
                 "%sDelivered-To: %s\n", getenv("RPLINE"), 
-                maildir_to_email(address));
+                email);
         }
     
         switch (deliver_to_maildir (address, DeliveredTo, 0, message_size)) {
diff -uPr vpopmail-5.4.17.orig/configure vpopmail-5.4.17/configure
--- vpopmail-5.4.17.orig/configure      2006-07-12 19:12:00.000000000 +0100
+++ vpopmail-5.4.17/configure   2006-10-18 08:03:50.000000000 +0100
@@ -6567,19 +6567,19 @@
   1*|y*|Y*)
         echo "$as_me:$LINENO: result: yes" >&5
 echo "${ECHO_T}yes" >&6
-        if test "$USE_SQL" != 1
-        then
-                { { echo "$as_me:$LINENO: error: valias option is only 
supported in the SQL authentication modules" >&5
-echo "$as_me: error: valias option is only supported in the SQL authentication 
modules" >&2;}
-   { (exit 1); exit 1; }; }
-        else
+#        if test "$USE_SQL" != 1
+#        then
+#                { { echo "$as_me:$LINENO: error: valias option is only 
supported in the SQL authentication modules" >&5
+#echo "$as_me: error: valias option is only supported in the SQL 
authentication modules" >&2;}
+#   { (exit 1); exit 1; }; }
+#        else
                 VALIAS=1
 
 cat >>confdefs.h <<_ACEOF
 #define VALIAS $VALIAS
 _ACEOF
 
-        fi
+#        fi
         ;;
   *)
         echo "$as_me:$LINENO: result: no" >&5
diff -uPr vpopmail-5.4.17.orig/valias.c vpopmail-5.4.17/valias.c
--- vpopmail-5.4.17.orig/valias.c       2006-03-21 04:53:40.000000000 +0000
+++ vpopmail-5.4.17/valias.c    2006-10-19 09:01:57.000000000 +0100
@@ -37,8 +37,9 @@
 
 #define VALIAS_SELECT 0
 #define VALIAS_INSERT 1
-#define VALIAS_DELETE 2
-#define VALIAS_NAMES  3
+#define VALIAS_REMOVE 2
+#define VALIAS_DELETE 3
+#define VALIAS_NAMES  4
 
 int AliasAction;
 int AliasExists;
@@ -116,6 +117,23 @@
                }
                break;
 
+       case VALIAS_REMOVE:
+               /* check to see if it exists */
+               AliasExists = 0;
+               tmpalias = valias_select( Alias, Domain );
+               while (tmpalias != NULL) {
+                       if (strcmp (tmpalias, AliasLine) == 0) AliasExists = 1;
+                       tmpalias = valias_select_next();
+               }
+               if (AliasExists) {
+                       valias_remove (Alias, Domain, AliasLine );
+               } else {
+                       fprintf (stderr, "Error: alias %s -> %s does not 
exist.\n",
+                               Email, AliasLine);
+                       vexit(-1);
+               }
+               break;
+
        case VALIAS_DELETE:
                valias_delete( Alias, Domain );
                break;
@@ -136,6 +154,7 @@
        printf("         -s ( show aliases, can use just domain )\n");
        printf("         -d ( delete alias )\n");
        printf("         -i alias_line (insert alias line)\n");
+       printf("         -r alias_line (remove alias line)\n");
        printf("\n");
        printf("Example: valias -i [EMAIL PROTECTED] [EMAIL PROTECTED]");
        printf("         (adds alias from [EMAIL PROTECTED] to [EMAIL 
PROTECTED]");
@@ -154,7 +173,7 @@
        memset(AliasLine, 0, sizeof(AliasLine));
        AliasAction = VALIAS_SELECT;
 
-       while( (c=getopt(argc,argv,"vnsdi:")) != -1 ) {
+       while( (c=getopt(argc,argv,"vnsr:di:")) != -1 ) {
                switch(c) {
                case 'v':
                        printf("version: %s\n", VERSION);
@@ -165,6 +184,10 @@
                case 's':
                        AliasAction = VALIAS_SELECT;
                        break;
+               case 'r':
+                       AliasAction = VALIAS_REMOVE;
+                       snprintf(AliasLine, sizeof(AliasLine), "%s", optarg);
+                       break;
                case 'd':
                        AliasAction = VALIAS_DELETE;
                        break;
diff -uPr vpopmail-5.4.17.orig/vpalias.c vpopmail-5.4.17/vpalias.c
--- vpopmail-5.4.17.orig/vpalias.c      2006-06-29 07:19:59.000000000 +0100
+++ vpopmail-5.4.17/vpalias.c   2006-10-30 07:00:35.000000000 +0000
@@ -1,3 +1,4 @@
+#ifndef VALIAS 
 /*
  * $Id: vpalias.c,v 1.6.2.9 2006/06/29 06:19:59 tomcollins Exp $
  * Copyright (C) 2000-2004 Inter7 Internet Technologies, Inc.
@@ -16,8 +17,6 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
  */
-#include "config.h"
-#ifndef VALIAS 
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -25,6 +24,7 @@
 #include <sys/stat.h>
 #include <dirent.h>
 #include <unistd.h>
+#include "config.h"
 #include "vpopmail.h"
 #include "vauth.h"
 
@@ -110,53 +110,148 @@
     return(alias_line);
 }
 
-int valias_insert( char *alias, char *domain, char *alias_line)
+int valias_insert( char *alias, char *domain, char *insert_alias_line )
 {
- int i;
+ int cntr = 0, i;
  char *tmpstr;
- char Dir[156];
+ char qmail[156];
+ char tmpqmail[156];
+ char tmpalias[156];
  char *p;
  uid_t uid;
  gid_t gid;
  FILE *fs;
+ FILE *tmpfs;
 
     if ( alias == NULL ) return(VA_NULL_POINTER);
     if ( domain == NULL ) return(VA_NULL_POINTER);
     if ( alias_line == NULL ) return(VA_NULL_POINTER);
     if ( strlen(alias) > MAX_PW_NAME ) return(VA_USER_NAME_TOO_LONG);
     if ( strlen(domain) > MAX_PW_DOMAIN ) return(VA_DOMAIN_NAME_TOO_LONG);
-    if ( strlen(alias_line) >= MAX_ALIAS_LINE ) return(VA_ALIAS_LINE_TOO_LONG);
+    if ( strlen(insert_alias_line) >= MAX_ALIAS_LINE ) 
return(VA_ALIAS_LINE_TOO_LONG);
 
-    if ((tmpstr = vget_assign(domain, Dir, sizeof(Dir), &uid, &gid )) == NULL) 
{
+    if ((tmpstr = vget_assign(domain, qmail, sizeof(qmail), &uid, &gid )) == 
NULL) {
        printf("invalid domain, not in qmail assign file\n");
        return(-1);
     }
 
+    // copy across the directory
+    strncpy(tmpqmail, qmail, sizeof(tmpqmail));
+
     // create dotqmail filename, converting '.' to ':' as we go
-    strncat(Dir, "/.qmail-", sizeof(Dir)-strlen(Dir)-1);
-    i = strlen(Dir);
-    for (p = alias; (i < (int)sizeof(Dir) - 1) && (*p != '\0'); p++)
-      Dir[i++] = (*p == '.' ? ':' : *p);
-    Dir[i] = '\0';
-       
-    if ( (fs = fopen(Dir, "a")) == NULL ) {
+    strncat(qmail, "/.qmail-", sizeof(qmail)-strlen(qmail)-1);
+    i = strlen(qmail);
+    for (p = alias; (i < (int)sizeof(qmail) - 1) && (*p != '\0'); p++)
+      qmail[i++] = (*p == '.' ? ':' : *p);
+    qmail[i] = '\0';
+
+    // create tmp dotqmail filename, converting '.' to ':' as we go
+    strncat(tmpqmail, "/.tmp.qmail-", sizeof(tmpqmail)-strlen(tmpqmail)-1);
+    i = strlen(tmpqmail);
+    for (p = alias; (i < (int)sizeof(tmpqmail) - 1) && (*p != '\0'); p++)
+      tmpqmail[i++] = (*p == '.' ? ':' : *p);
+    tmpqmail[i] = '\0';
+
+    fs = fopen(qmail, "r");
+    if ( (tmpfs = fopen(tmpqmail, "w")) == NULL ) {
+       fclose(fs);
        return(-1);
     }
-    chmod(Dir,0600);
-    chown(Dir,uid,gid);
+    chmod(tmpqmail,0600);
+    chown(tmpqmail,uid,gid);
+
+    // add on a newline for inserting
+    snprintf(tmpalias, sizeof(tmpalias), "%s\n", insert_alias_line);
 
-    fprintf(fs, "%s\n", alias_line);
-    fclose(fs);
+    // loop thru copying across the alias lines
+    if ( fs != NULL ) {
+       while ( fgets(alias_line, sizeof(alias_line), fs) != NULL ) {
+           fputs(alias_line, tmpfs);
+           cntr++;
+        }
+       fclose(fs);
+       unlink(qmail);
+    }
+
+    fputs(tmpalias, tmpfs);
+    fclose(tmpfs);
+    link(tmpqmail, qmail);
+    unlink(tmpqmail);
     return(0);
 }
 
-int valias_remove( char *alias, char *domain, char *alias_line)
+int valias_remove( char *alias, char *domain, char *remove_alias_line )
 {
-  fprintf (stderr, "Error: valias_remove() not implemented for non-SQL 
backends.\n");
-  return -1;
+ int cntr = 0, i;
+ char *tmpstr;
+ char qmail[156];
+ char tmpqmail[156];
+ char tmpalias[156];
+ char *p;
+ uid_t uid;
+ gid_t gid;
+ FILE *fs;
+ FILE *tmpfs;
+
+    if ( alias == NULL ) return(VA_NULL_POINTER);
+    if ( domain == NULL ) return(VA_NULL_POINTER);
+    if ( alias_line == NULL ) return(VA_NULL_POINTER);
+    if ( strlen(alias) > MAX_PW_NAME ) return(VA_USER_NAME_TOO_LONG);
+    if ( strlen(domain) > MAX_PW_DOMAIN ) return(VA_DOMAIN_NAME_TOO_LONG);
+    if ( strlen(alias_line) >= MAX_ALIAS_LINE ) return(VA_ALIAS_LINE_TOO_LONG);
+
+    if ((tmpstr = vget_assign(domain, qmail, sizeof(qmail), &uid, &gid )) == 
NULL) {
+       printf("invalid domain, not in qmail assign file\n");
+       return(-1);
+    }
+
+    // copy across the directory
+    strncpy(tmpqmail, qmail, sizeof(tmpqmail));
+
+    // create dotqmail filename, converting '.' to ':' as we go
+    strncat(qmail, "/.qmail-", sizeof(qmail)-strlen(qmail)-1);
+    i = strlen(qmail);
+    for (p = alias; (i < (int)sizeof(qmail) - 1) && (*p != '\0'); p++)
+      qmail[i++] = (*p == '.' ? ':' : *p);
+    qmail[i] = '\0';
+
+    // create tmp dotqmail filename, converting '.' to ':' as we go
+    strncat(tmpqmail, "/.tmp.qmail-", sizeof(tmpqmail)-strlen(tmpqmail)-1);
+    i = strlen(tmpqmail);
+    for (p = alias; (i < (int)sizeof(tmpqmail) - 1) && (*p != '\0'); p++)
+      tmpqmail[i++] = (*p == '.' ? ':' : *p);
+    tmpqmail[i] = '\0';
+
+    fs = fopen(qmail, "r");
+    if ( (tmpfs = fopen(tmpqmail, "w")) == NULL ) {
+       fclose(fs);
+       return(-1);
+    }
+    chmod(tmpqmail,0600);
+    chown(tmpqmail,uid,gid);
+
+    // add on a newline for comparing
+    snprintf(tmpalias, sizeof(tmpalias), "%s\n", remove_alias_line);
+
+    // loop thru copying across the alias lines
+    if ( fs != NULL ) {
+       while ( fgets(alias_line, sizeof(alias_line), fs) != NULL ) {
+           if ( strcmp(alias_line, tmpalias) != 0) {
+               fputs(alias_line, tmpfs);
+               cntr++;
+           }
+       }
+       fclose(fs);
+       unlink(qmail);
+    }
+
+    fclose(tmpfs);
+    if ( cntr > 0 ) link(tmpqmail, qmail);
+    unlink(tmpqmail);
+    return(0);
 }
 
-int valias_delete( char *alias, char *domain)
+int valias_delete( char *alias, char *domain )
 {
  char *tmpstr;
  char Dir[156];
diff -uPr vpopmail-5.4.17.orig/vauth.h vpopmail-5.4.17/vauth.h
--- vpopmail-5.4.17.orig/vauth.h        2005-12-08 06:10:36.000000000 +0000
+++ vpopmail-5.4.17/vauth.h     2006-12-12 07:23:04.000000000 +0000
@@ -111,7 +111,9 @@
 char *valias_select( char *alias, char *domain );
 char *valias_select_next();
 char *valias_select_all( char *alias, char *domain );
-char *valias_select_all_next(char *alias);
+char *valias_select_all_next( char *alias);
+char *valias_select_names( char *domain);
+char *valias_select_names_next();
 int valias_insert( char *alias, char *domain, char *alias_line);
 int valias_remove( char *alias, char *domain, char *alias_line);
 int valias_delete( char *alias, char *domain);
diff -uPr vpopmail-5.4.17.orig/vpopmaild.c vpopmail-5.4.17/vpopmaild.c
--- vpopmail-5.4.17.orig/vpopmaild.c    2006-06-29 20:56:34.000000000 +0100
+++ vpopmail-5.4.17/vpopmaild.c 2006-12-12 07:23:05.000000000 +0000
@@ -1597,15 +1597,13 @@
 {
  static char thedir[256];
  char *domain;
+ char *alias;
  char *tmpstr;
  int page = 0;
  int lines_per_page = 0;
  int count;
  int start;
  int end;
- int i,j;
- struct dirent **namelist;
- struct dirent *mydirent;
 
   if ( !(AuthVpw.pw_gid & QA_ADMIN) && !(AuthVpw.pw_gid & SA_ADMIN) ) {
     snprintf(WriteBuf,sizeof(WriteBuf), RET_ERR "XXX not authorized" RET_CRLF);
@@ -1649,27 +1647,21 @@
   snprintf(WriteBuf, sizeof(WriteBuf), RET_OK_MORE);
   wait_write();
 
-  j = bkscandir(".", &namelist, 0, qa_sort);
-
   count = 0;
-  for(i=0;i<j;++i) {
-    mydirent=namelist[i];
-
-    if ( strncmp( ".qmail-", mydirent->d_name,7)!= 0 ) continue; 
-    if ( strstr(mydirent->d_name, "-owner") != NULL ) continue;
-    if ( strstr(mydirent->d_name, "-default") != NULL ) continue;
-
+  alias = valias_select_names(domain);
+  while ( alias!=NULL ) {
     if ( end>0 ) {
       if ( count>=start && count<end ) {
-        snprintf(WriteBuf,sizeof(WriteBuf), "%s" RET_CRLF, mydirent->d_name);
+        snprintf(WriteBuf,sizeof(WriteBuf), "%s" RET_CRLF, alias);
         wait_write();
       } else if ( count>=end ) {
         break;
       }
     } else { 
-      snprintf(WriteBuf,sizeof(WriteBuf), "%s" RET_CRLF, mydirent->d_name);
+      snprintf(WriteBuf,sizeof(WriteBuf), "%s" RET_CRLF, alias);
       wait_write();
     }
+    alias = valias_select_names_next();
     ++count;
   }
   snprintf(WriteBuf,sizeof(WriteBuf), "." RET_CRLF);
@@ -1680,15 +1672,13 @@
 {
  static char thedir[256];
  char *domain;
+ char *alias;
  char *tmpstr;
  int page = 0;
  int lines_per_page = 0;
  int count;
  int start;
  int end;
- int i,j;
- struct dirent **namelist;
- struct dirent *mydirent;
  FILE *fs;
  static char tmpbuf[1024];
 
@@ -1712,7 +1702,7 @@
 
   if ( (vget_assign(domain,thedir,sizeof(thedir),NULL,NULL)) == NULL ) {
     snprintf(WriteBuf,sizeof(WriteBuf), 
-      RET_ERR "XXX not authorized for domain" RET_CRLF);
+      RET_ERR "XXX invalid domain" RET_CRLF);
     return(-1);
   }
 
@@ -1741,30 +1731,28 @@
   snprintf(WriteBuf, sizeof(WriteBuf), RET_OK_MORE);
   wait_write();
 
-  j = bkscandir(".", &namelist, 0, qa_sort);
-
   count = 0;
-  for(i=0;i<j;++i) {
-    mydirent=namelist[i];
-
-    if ( strncmp( ".qmail-", mydirent->d_name,7)!= 0 ) continue;
-
-    if ( (fs=fopen(mydirent->d_name,"r"))==NULL ) continue;
-    fgets(tmpbuf,sizeof(tmpbuf),fs);
-    fclose(fs);
-    if ( strstr(tmpbuf, "ezmlm-reject") == 0 ) continue;
-
-    if ( end>0 ) {
-      if ( count>=start && count<end ) {
-        snprintf(WriteBuf,sizeof(WriteBuf), "%s" RET_CRLF, mydirent->d_name);
-        wait_write();
-      } else if ( count>=end ) {
-        break;
+  alias = valias_select_names(domain);
+  while ( alias!=NULL ) {
+    snprintf(tmpbuf,sizeof(tmpbuf), ".qmail-%s", alias);
+    if ( (fs=fopen(tmpbuf,"r"))!=NULL ) {
+      fgets(tmpbuf,sizeof(tmpbuf),fs);
+      fclose(fs);
+      if ( strstr(tmpbuf, "ezmlm-reject") != 0 ) {
+        if ( end>0 ) {
+          if ( count>=start && count<end ) {
+            snprintf(WriteBuf,sizeof(WriteBuf), "%s" RET_CRLF, alias);
+            wait_write();
+          } else if ( count>=end ) {
+            break;
+          }
+        } else { 
+          snprintf(WriteBuf,sizeof(WriteBuf), "%s" RET_CRLF, alias);
+          wait_write();
+        }
       }
-    } else { 
-      snprintf(WriteBuf,sizeof(WriteBuf), "%s" RET_CRLF, mydirent->d_name);
-      wait_write();
     }
+    alias = valias_select_names_next();
     ++count;
   }
   snprintf(WriteBuf,sizeof(WriteBuf), "." RET_CRLF);

Reply via email to