Subject: Snarfing /var/spool/mail/ into ~/INBOX for POP users

From: Rich Graves <[email-masked]>
Date: Mon, 15 Nov 1999 16:09:38 -0500 (EST)

drivers.txt says:

| If "black box mode" is not in effect, messages are automatically
| transferred ("snarfed") from the spool directory to an INBOX in mbox,
| mx, mbx, tenex, and mtx formats.

This works fine for imapd, but ipop3d doesn't pick up new mail. Is this
normal behavior, or did I break something?

I have UW-IMAP 4.6-release patched to use hashed mbx-format folders for
INBOX. My patches follow (they're small).

Forking off a tmail for every incoming message would be a major loss from
postfix's own delivery agent.

P.S. I've got IMAP referrals happening, but since neither Netscape nor
Outlook seem to notice, they're not doing anything for me.
-- 
Rich Graves <[email-masked]>
UNet Systems Administrator

--- imap-4.6/src/osdep/unix/env_unix.c.orig     Fri Oct 29 23:18:30 1999
+++ imap-4.6/src/osdep/unix/env_unix.c  Mon Nov  1 23:28:34 1999
@@ -531,8 +529,9 @@
     if (blackBox)              /* black box? */
       nslist[0] = &nshome,nslist[1] = &nsblackother,nslist[2] = &nsshared;
     else {                     /* not a black box */
-      nslist[0] = &nshome,nslist[1] = &nsunixother,nslist[2] = &nsshared;
-      myHomeDir = cpystr (home);/* use real home directory */
+      nslist[0] = &nshome,nslist[1] = &nsunixother,nslist[2] = &nsshared;
+      snprintf (tmp,32,"/var/imap/%.1s/%s",myUserName,myUserName); /* DON'T use real home dir */
+      myHomeDir = cpystr (tmp);                /* use /var/imap/<a>/<userid> */
                                /* make sure user rc files don't try this */
       blackBoxDir = blackBoxDefaultHome = "";
     }

--- imap-4.6/src/osdep/unix/env_unix.c.tilde    Fri Nov  5 16:41:09 1999
+++ imap-4.6/src/osdep/unix/env_unix.c  Fri Nov  5 17:08:28 1999
@@ -709,14 +709,30 @@
   }
 ^L
                                /* absolute path name? */
-  else if (*name == '/') return strcpy (dst,name);
+
+    /* We are not in full black-box mode, but we do want to discourage
+     * people from snooping around directories where they aren't
+     * welcome. */
+
+  else if (*name == '/') {
+    if (!((strstr (name,"var/imap")) || (strstr (name,"var/spool/mail/"))))
+      return NIL;
+    if (strstr (name,"..") || strstr (name,"//") || strstr (name,"/~"))
+      return NIL;              /* none of these allowed when restricted */
+    return strcpy (dst,name);
+  }
                                /* some home directory? */
   else if ((*name == '~') && *++name) {
     if (*name == '/') name++;  /* yes, my home directory? */
     else {                     /* no, copy user name */
       for (dir = dst; *name && (*name != '/'); *dir++ = *name++);
       *dir++ = '\0';           /* tie off user name, look up in passwd file */
-      if (!((pw = getpwnam (dst)) && (dir = pw->pw_dir))) return NIL;
+      if (!(pw = getpwnam (dst))) return NIL;
+                               /* Drop in /var/imap/<hash>/<user>/ */
+      sprintf (dir,"/var/imap/%.1s/%s",dst,dst);
       if (*name) name++;       /* skip past the slash */
     }
   }

--- imap-4.6/Makefile.orig      Fri Oct 29 22:07:36 1999
+++ imap-4.6/Makefile   Fri Oct 29 22:12:01 1999
@@ -128,7 +128,7 @@
 # mbox if file "mbox" exists on the home directory, automatically moves mail
 #       from the spool directory to "mbox" and uses "mbox" as INBOX.

-EXTRADRIVERS=mbox
+EXTRADRIVERS=

 # The following plaintext login types are defined:
@@ -244,7 +244,7 @@
 #      gradually-increasing intervals, starting at 2800-2900, and becoming
 #      permanent at 48,300.

-EXTRACFLAGS=
+EXTRACFLAGS=-DDISABLE_POP_PROXY=1 -DNETSCAPE_BRAIN_DAMAGE=\"https://unet.brandeis.edu/\"

 # Extra linker flags (additional/alternative libraries, etc.)

-- 
------------------------------------------------------------------
 For information about this mailing list, and its archives, see: 
 http://www.washington.edu/imap/c-client-list.html
------------------------------------------------------------------