Hi,

A little patch against preauthvchkpw.c to allow local imap and/or pop access even if no_pop or no_imap is set.

It used here to allow webmail access from localhost.

It is a patch against 3.0.8 but it is a small change and easily adjustable to other versions.

Based on Tom Collins code in vpopmail to allow the same thing.

Regards,

Rick
--- preauthvchkpw.c.ori Tue Nov 23 09:52:52 2004
+++ preauthvchkpw.c     Tue Nov 23 09:55:42 2004
@@ -57,6 +57,15 @@
 static char User[256];
 static char Domain[256];

+/* IMAP connections from the following IPs will be classified as
+* "web mail" instead of IMAP.  On single-server networks, this
+* will typically be just 'localhost'.  For clusters, add the IP
+* addresses of all webmail servers.
+*/
+char *webmailips[] = { "127.0.0.1" };
+char    *IpAddr;
+int i;
+
        /* Make sure the auth struct is empty */
         memset(&auth, 0, sizeof(auth));

@@ -92,6 +101,19 @@
                dprintf("vchkpw: user does not exist");
                return (-1);
        }
+
+       /* Check for local connection and change imap or pop
+        * to webmail
+       */
+
+        if ( (IpAddr = get_remote_ip())  == NULL) IpAddr="";
+
+        for (i = 0; i < (sizeof(webmailips)/sizeof(webmailips[0])); i++) {
+                if (strcmp (IpAddr, webmailips[i]) == 0) {
+                        strcpy(service,"webmail");
+                        break;
+                }
+        }

         /* Look at what type of connection we are trying to auth.
          * And then see if the user is permitted to make this type

Reply via email to