[cvs] [Wiki] changed: ImpUWIMAPNamespaces
Wiki Guest
wiki at wiki.horde.org
Thu Feb 2 04:07:04 PST 2006
guest [160.39.245.20] Thu, 02 Feb 2006 04:07:04 -0800
Modified page: http://wiki.horde.org/ImpUWIMAPNamespaces
New Revision: 1.12
Change log: Add patch to set mailsubdir, namespaces, and location of mbox
@@ -6,8 +6,91 @@
This may startle users of UW-IMAP when they discover that both 1) all files in the home directory may now show up in the folders list and 2) all sorts of namespaces appear (i.e. '#ftp/', '#shared/') that weren't there before.
To disable these extra namespaces and/or restrict UW-IMAP to your mail directories only (rather than your entire home directory), you will need to reconfigure (and then recompile) your imapd daemon. For detailed instructions on how you can change this parameters, please refer to {{docs/CONFIG}}[http://www.washington.edu/imap/documentation/CONFIG.html] in the c-client/imapd distribution.
+
+To restrict UW-IMAP to the mail/ directory, while still keeping mbox in ~/, apply the following patch. The patch also removes the mh-related and #public namespaces, and strips off the leading mail/ if some mail clients still have an IMAP server directory set (they shouldn't need it anymore).
+
+<code>
+--- src/osdep/unix/env_unix.c 2004/08/25 06:11:42
++++ src/osdep/unix/env_unix.c 2004/08/25 06:23:00
+@@ -29,7 +29,7 @@
+ static char *myMailboxDir = NIL;/* mailbox directory name */
+ static char *myLocalHost = NIL; /* local host name */
+ static char *myNewsrc = NIL; /* newsrc file name */
+-static char *mailsubdir = NIL; /* mail subdirectory name */
++static char *mailsubdir = "mail"; /* mail subdirectory name */
+ static char *sysInbox = NIL; /* system inbox name */
+ static char *newsActive = NIL; /* news active file */
+ static char *newsSpool = NIL; /* news spool */
+@@ -52,7 +52,7 @@
+ /* advertise filesystem root */
+ static short advertisetheworld = NIL;
+ /* only advertise own mailboxes and #shared */
+-static short limitedadvertise = NIL;
++static short limitedadvertise = T;
+ /* disable automatic shared namespaces */
+ static short noautomaticsharedns = NIL;
+ static short no822tztext = NIL; /* disable RFC [2]822 timezone text */
+@@ -114,7 +114,7 @@
+ static NAMESPACE nsmhf = {"#mh/",'/',NIL,NIL};
+ static NAMESPACE nsmh = {"#mhinbox",NIL,NIL,&nsmhf};
+ /* home namespace */
+-static NAMESPACE nshome = {"",'/',NIL,&nsmh};
++static NAMESPACE nshome = {"",'/',NIL,NIL};
+ /* UNIX other user namespace */
+ static NAMESPACE nsunixother = {"~",'/',NIL,NIL};
+ /* black box other user namespace */
+@@ -130,7 +130,7 @@
+ /* world namespace */
+ static NAMESPACE nsworld = {"/",'/',NIL,&nsshared};
+ /* only shared and public namespaces */
+-static NAMESPACE nslimited = {"#shared/",'/',NIL,&nspublic};
++static NAMESPACE nslimited = {"#shared/",'/',NIL,NIL};
+
+ #include "write.c" /* include safe writing routines */
+ #include "crexcl.c" /* include exclusive create */
+@@ -924,6 +924,9 @@
+ case '~': /* other user access */
+ /* bad syntax or anonymous can't win */
+ if (!*++name || anonymous) dst = NIL;
++ /* Translate ~/mail/foo to foo */
++ else if (*name == '/' && !strncmp (name+1,"mail/",5))
++ sprintf (dst,"%s/%s",mymailboxdir (),name+6);
+ /* ~/ equivalent to ordinary name */
+ else if (*name == '/') sprintf (dst,"%s/%s",mymailboxdir (),name+1);
+ /* other user forbidden if closed/restricted */
+@@ -950,7 +953,11 @@
+ /* don't allow ~root/ if restricted root */
+ if ((restrictBox & RESTRICTROOT) && !*pw->pw_dir) dst = NIL;
+ /* build final name w/ subdir if needed */
+- else if (mailsubdir) sprintf (dst,"%s/%s/%s",pw->pw_dir,mailsubdir,name);
++ else if (mailsubdir) {
++ /* Make sure mailsubdir is not included twice */
++ if (!strncmp(name,"mail/",5)) name+=5;
++ sprintf (dst,"%s/%s/%s",pw->pw_dir,mailsubdir,name);
++ }
+ else sprintf (dst,"%s/%s",pw->pw_dir,name);
+ }
+ else dst = NIL; /* no such user */
+@@ -965,6 +972,16 @@
+ else *dst = '\0'; /* otherwise driver selects the name */
+ break;
+ }
++ case 'm': /* make sure "mbox" is found in ~/, not mailsubdir */
++ if (!strcmp (name+1,"box")) {
++ sprintf (dst,"%s",name);
++ break;
++ }
++ /* mail/foo -> foo */
++ else if (!strncmp (name+1,"ail/",4)) {
++ sprintf (dst,"%s/%s",mymailboxdir (),name+5);
++ break;
++ }
+ /* drop into to ordinary name case */
+ default: /* ordinary name is easy */
+ sprintf (dst,"%s/%s",mymailboxdir (),name);
+</code>
++ Alternative Method (Unsupported)
If you can not, or do not want to, recompile your UW-IMAP server you can try using this **unsupported** method of setting the mail subdirectory (folder) location. Here, unsupported means primarily that the UW-IMAP authors do not support this setup - therefore Horde does not fully support this method either. However, many have reported good success with this setup. For more information on this method, refer to {{docs/imaprc.txt}}[http://www.washington.edu/imap/documentation/imaprc.txt.html] in the c-client/imapd distribution.
More information about the cvs
mailing list