Hi, Attached is a patch for a new option called "appenddomain". This patch works differently than the virtdomain option in the configuration, so it's not replicating existing behavior. If there's a better idea on how to do something like this, please let me know. Explanation follows. It seems the virtdomain option exists simply to allow users with older installations of cyrus (non virtual domain) to be able to use their spools without modifications. The "virtdomain" specified allows users to log in without a domain, and will auth them properly and use a deprecated path for the username. The problem with this is that when a user logs in WITH the domain, the system doesn't strip the domain from the mailbox path consistently. Further, for new installations, it maintains the old deprecated non-virtual paths. What we were looking for was something that would allow users to log in without a domain, however keep the path for the mailboxes organized against the hashing rules for virtual domains. So we created an option called "appenddomain" which, instead of stripping the domain from mailbox paths and/or logins when the user connects, appends the specified domain to unqualified usernames. Simply put it converts and qualifies unqualified usernames when specified. The patch was generated against Simon Matter's very cool RPM's which we used because we're on a 64 bit architecture. It was written by Andre Henry, and seems to compile cleanly and work. Comments, suggestions? Hope this gets included, thanks. -peace
--- cyrus-imapd-2.3.7.orig/imap/global.c 2005-12-13 14:35:50.000000000 -0500 +++ cyrus-imapd-2.3.7/imap/global.c 2006-09-26 15:03:41.000000000 -0400 @@ -355,6 +355,14 @@ char *domain = NULL; int len = strlen(user); char buf[81]; + char tmp[MAX_MAILBOX_NAME+1]; + + if (config_getstring(IMAPOPT_APPENDDOMAIN)) { + if( !strchr(user, '@') ) { + snprintf(tmp, (MAX_MAILBOX_NAME+1), "%s@%s", user, config_getstring(IMAPOPT_APPENDDOMAIN)); + user = tmp; + } + } /* check for domain */ if (config_virtdomains && --- cyrus-imapd-2.3.7.orig/lib/imapoptions 2006-10-02 12:43:02.000000000 -0400 +++ cyrus-imapd-2.3.7/lib/imapoptions 2006-09-25 12:02:24.000000000 -0400 @@ -236,7 +236,10 @@ mailbox that does not have a parent mailbox. */ { "defaultdomain", NULL, STRING } -/* The default domain for virtual domain support */ +/* The default domain for virtual domain support. If the domain part of + user@domain is the same as the value specified, it will be removed from + usernames. Use this option if you add virtual domain support and do not + want to rename exisiting mailboxes. See appenddomain */ { "defaultpartition", "default", STRING } /* The partition name used by default for new mailboxes. */ @@ -1102,6 +1105,10 @@ to set this to yes, especially if OpenLDAP is used as authentication source. */ +{ "appenddomain", NULL, STRING } +/* Append this doman name to user names without a domain portion. Do not use + with the default domain option */ + /* .SH SEE ALSO .PP
---- Cyrus Home Page: http://cyrusimap.web.cmu.edu/ Cyrus Wiki/FAQ: http://cyrusimap.web.cmu.edu/twiki List Archives/Info: http://asg.web.cmu.edu/cyrus/mailing-list.html