--- cyrus-imapd-2.3.13/lib/libcyr_cfg.h.authid_normalize 2008-07-30 18:03:39.000000000 +0200 +++ cyrus-imapd-2.3.13/lib/libcyr_cfg.h 2009-01-13 11:41:59.000000000 +0100 @@ -100,6 +100,8 @@ CYRUSOPT_BERKELEY_TXNS_MAX, /* RFC 2086 right which allows DELETE ("c") */ CYRUSOPT_DELETERIGHT, + /* Lowercase uid and strip leading and trailing blanks (OFF) */ + CYRUSOPT_NORMALIZEUID, /* SQL database */ CYRUSOPT_SQL_DATABASE, /* SQL engine ("mysql") */ --- cyrus-imapd-2.3.13/lib/auth_unix.c.authid_normalize 2009-01-13 11:38:08.000000000 +0100 +++ cyrus-imapd-2.3.13/lib/auth_unix.c 2009-01-13 11:38:08.000000000 +0100 @@ -155,10 +155,12 @@ size_t len; { static char retbuf[81]; + char backup[81]; struct group *grp; char sawalpha; char *p; int username_tolower = 0; + int ic,rbc; if(!len) len = strlen(identifier); if(len >= sizeof(retbuf)) return NULL; @@ -210,6 +212,22 @@ /* now we don't */ /* if (!sawalpha) return NULL; */ + if( (libcyrus_config_getswitch(CYRUSOPT_NORMALIZEUID) == 1) ) { + strcpy(backup,retbuf); + /* remove leading blanks */ + for(ic=0; isblank(backup[ic]); ic++); + for(rbc=0; backup[ic]; ic++) { + retbuf[rbc] = ( isalpha(backup[ic]) ? + tolower(backup[ic]) : backup[ic] ); + rbc++; + } + retbuf[rbc] = '\0'; + /* remove trailing blanks */ + for(--rbc; isblank(retbuf[rbc]); rbc--) { + retbuf[rbc] = '\0'; + } + } + return retbuf; } --- cyrus-imapd-2.3.13/lib/imapoptions.authid_normalize 2009-01-13 11:38:08.000000000 +0100 +++ cyrus-imapd-2.3.13/lib/imapoptions 2009-01-13 11:38:08.000000000 +0100 @@ -1182,6 +1182,11 @@ interface, otherwise the user is assumed to be in the default domain (if set). */ +{ "normalizeuid", 0, SWITCH } +/* Lowercase uid and strip leading and trailing blanks. It is recommended + to set this to yes, especially if OpenLDAP is used as authentication + source. */ + /* .SH SEE ALSO .PP --- cyrus-imapd-2.3.13/lib/libcyr_cfg.c.authid_normalize 2008-07-30 18:03:38.000000000 +0200 +++ cyrus-imapd-2.3.13/lib/libcyr_cfg.c 2009-01-13 11:38:08.000000000 +0100 @@ -150,6 +150,11 @@ CFGVAL(long, 0), CYRUS_OPT_SWITCH }, + { CYRUSOPT_NORMALIZEUID, + CFGVAL(long, 1), + CYRUS_OPT_SWITCH }, + + { CYRUSOPT_LAST, { NULL }, CYRUS_OPT_NOTOPT } };