On Tue, 12 Dec 2006, Tom Collins wrote:
> On Dec 12, 2006, at 9:36 PM, Rick Widmer wrote:
> > Qmailadmin should read .vpopmail files before .qmail files and
> > delete the .qmail file if it exists when the .vpopmail file is
> > written. Effectively the files will be renamed as they are edited.
> > Maybe there needs to be a ./configure option to disable the new
> > file name.
> >
> > What do you think?
>
> If we go with that, should the user's .qmail file become .vpopmail-
> default?
>
If the decision is to go with .vpopmail files then I agree that the user's
.qmail file should be called .vpopmail (not .vpopmail-default though,
this would only get used for recipient addresses that contain an
extension).
So the situation should be that if you disabled the functionality in the
patch I provided (by NOT providing --enable-qmail-ext on the configure
command line) vdelivermail will look for a single .vpopmail (currently
.qmail) file in the users directory, otherwise (if --enable-qmail-ext WAS
provided on the configure command line) vdelivermail will try and resolve
a .vpopmail[-extension][-default] file.
If my reading of whats required is correct AND the decision to move from
.qmail[-extension][-default] to .vpopmail[-extension][-default] is made
then the patch attached to this email should do the trick. It does still
fallback to .qmail files in both instances (depending on
--enable-qmail-ext) for backwards compatibility and easy migration.
> I think that it should be a configure option in vpopmail that
> cascades into QmailAdmin. We'll need to make it clear to the admin
> enabling the feature that they need to update their QmailAdmin as well.
>
Agreed.
> --
> Tom Collins - [EMAIL PROTECTED]
> Certified Rabbit Semiconductor Consultant based in Napa, California
>
>
>
diff -uPr vpopmail-5.4.17.orig/vdelivermail.c vpopmail-5.4.17/vdelivermail.c
--- vpopmail-5.4.17.orig/vdelivermail.c 2006-06-29 20:36:43.000000000 +0100
+++ vpopmail-5.4.17/vdelivermail.c 2006-12-13 07:06:23.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);
@@ -700,16 +706,50 @@
chdir(dir);
+#ifdef QMAIL_EXT
/* format the file name */
- if ( (fs = fopen(".qmail","r")) == NULL ) {
+ if (strlen(TheExt)) {
+ strcpy(tmpbuf,".vpopmail-");
+ strcat(tmpbuf,TheExt);
+ if ( (fs = fopen(tmpbuf,"r")) == NULL ) {
+ 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,".vpopmail-");
+ strncat(tmpbuf,TheExt,i);
+ strcat(tmpbuf,"default");
+ if ( (fs = fopen(tmpbuf,"r")) != NULL) {
+ break;
+ }
+ strcpy(tmpbuf,".qmail-");
+ strncat(tmpbuf,TheExt,i);
+ strcat(tmpbuf,"default");
+ if ( (fs = fopen(tmpbuf,"r")) != NULL) {
+ break;
+ }
+ }
+ }
+ }
+ }
+ } else {
+ if ( (fs = fopen(".vpopmail","r")) == NULL) {
+ fs = fopen(".qmail","r");
+ }
+ }
+#else
+ if ( (fs = fopen(".vpopmail","r")) == NULL) {
+ 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 == '#') {
@@ -722,14 +762,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;