1.
I haven't checked this on other systems, but on mine (fbsd 4.7),
chdir("") return -1, setting ENOENT in the process. As a result,
Mailbox { path = ""; } behaves incorrectly.
2.
Not being familiar enough with the IMAP spec, I'm assuming that
one can issue multiple LOGIN commands within the same session.
On some systems, putenv() may fail if no value is specified,
so putenv("BINC_USERID") fails on fbsd 4.7. I'm not sure why
the getenv/putenv sequence is really necessary, when you can
replace it all with a call to unsetenv().
3.
After more vmailmgr testing, I find that a bincimap-uidpwd
modified to append MAILDIR to the cwd may lead to other problems.
i.
bincimapd still thinks of the "pwd" line as a home directory,
so it looks for local config changes in .bincimap, which would
have to live inside the Maildir.
ii.
By making a clear distiction between the "pwd" line actually
being "home" and a subsequent (optional) line containing the
relative/absolute [maildir] path, the difference between where
control/config files live (in "home") and where mail lives
would be clear.
On the other hand, not much can be done with local .bincimap anyway.
Attached is patch to deal with 1 and 2.
regards.
--
-dale
--- src/authenticate.cc Sat Feb 22 04:45:43 2003
+++ src/authenticate.cc Sat Mar 8 03:06:15 2003
@@ -69,18 +69,10 @@ int Binc::imapd::authenticate(const stri
string authpenalty = globalconfig["auth penalty"];
// remove BINC_USERID from environment
- if (getenv("BINC_USERID") != NULL && putenv("BINC_USERID") != 0) {
- logger << "authentication broke for <"
- << username << ">, putenv failed to remove BINC_USERID" << endl;
- return 1;
- }
+ unsetenv("BINC_USERID");
// remove BINC_PASSWD from environment
- if (getenv("BINC_PASSWD") != NULL && putenv("BINC_PASSWD") != 0) {
- logger << "authentication broke for <"
- << username << ">, putenv failed to remove BINC_PASSWD" << endl;
- return 1;
- }
+ unsetenv("BINC_PASSWD");
// set BINC_USERID and BINC_PASSWD
if ((putenv(strdup(("BINC_USERID=" + username).c_str())) == -1)
@@ -216,6 +208,8 @@ int Binc::imapd::authenticate(const stri
}
if (!trycreate) {
+ if (path == "") break;
+
if (chdir(dochroot ? "/" : path.c_str()) != 0) {
if (!trycreate && errno == ENOENT)
trycreate = true;