On  7-Mar-2003 19:54 Marek Gutkowski wrote:
| You can find a small program that does something similar in the Contrib
| section (http://www.bincimap.andreas.hanssen.name/bincimap-contrib.html)

    This is somewhat useful, within limits, but I think it would be
    much better to have the existing bincimap-uidpwd program use the
    MAILDIR environment variable when present.

    If Andreas is interested, I'm attaching an appropriate patch.
    It also checks if MAILDIR starts with a '/', in which it is used
    instead of cwd.  Andreas may decide it's better to ignore MAILDIR
    if it starts with a '/', which may be considered more correct
    behaviour anyway.

| I attach a native vmailmgr authenticator for binc-imap. Put it into the
| authenticate/ dir in your vmailmgr source tree, and apply the patch for
| Makefile.am (patch -p1 < Makefile.diff in vmailmgr-0.96.9/), then
| recompile.
| It has same features as checkvpw, see the source code for details.
| Remember to set Maildir path to "" in your bincimap.conf. This code will
| also take care of real, system users (exactly as checkvpw does).

    While I appreciate your efforts, I was looking for a config-based
    solution within vmailmgr.  The difficulty is not in writing an
    authenticator (for either), but having both work in such a way
    that neither requires patching.  More importantly, I'd like to
    see BincIMAP, vmailmgr, or both to have changes such that they
    work without these kinds of patches.  Other than checkvpw's
    "requirement" of having a maildir-like argument (and rewriting
    it), I'd say it works as it should.  It seems easier to have
    BincIMAP changed though, and I'm really still not fond of the
    "chroot to a maildir" problem, mostly stemming from BincIMAP's
    strict adherence to Maildir++ usage.
--
-dale
--- src/auth/bincimap-uidpwd.cc Sat Feb 22 03:10:51 2003
+++ src/auth/bincimap-uidpwd.cc Fri Mar  7 17:08:48 2003
@@ -37,6 +37,7 @@
 #endif
 
 #include <unistd.h>
+#include <string>
 #include <iostream>
 
 using namespace std;
@@ -45,10 +46,17 @@ const int CWDBUFFERSIZE = 4096;
 
 int main(void)
 {
+  char *md;
   char *cwd = new char[CWDBUFFERSIZE];
   if (getcwd(cwd, CWDBUFFERSIZE) == NULL)
       return 111;
 
   cout << getuid() << "." << getgid() << endl;
-  cout << cwd << endl;
+  md = getenv("MAILDIR");
+  if (!md)
+    cout << cwd << endl;
+  else if (*md == '/')
+    cout << md << endl;
+  else
+    cout << cwd << "/" << md << endl;
 }

Reply via email to