Projects
Kolab:3.4
cyrus-imapd
cyrus-imapd-2.4.15-903-normalize-authorization-...
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File cyrus-imapd-2.4.15-903-normalize-authorization-id.patch of Package cyrus-imapd (Revision 38)
Currently displaying revision
38
,
Show latest
diff --git a/imap/global.c b/imap/global.c index d2e5ba7..930d539 100644 --- a/imap/global.c +++ b/imap/global.c @@ -219,6 +219,8 @@ int cyrus_init(const char *alt_config, const char *ident, unsigned flags) config_getswitch(IMAPOPT_UNIX_GROUP_ENABLE)); libcyrus_config_setswitch(CYRUSOPT_USERNAME_TOLOWER, config_getswitch(IMAPOPT_USERNAME_TOLOWER)); + libcyrus_config_setswitch(CYRUSOPT_NORMALIZEUID, + config_getswitch(IMAPOPT_NORMALIZEUID)); libcyrus_config_setswitch(CYRUSOPT_SKIPLIST_UNSAFE, config_getswitch(IMAPOPT_SKIPLIST_UNSAFE)); libcyrus_config_setstring(CYRUSOPT_TEMP_PATH, diff --git a/lib/auth_unix.c b/lib/auth_unix.c index c1f0329..d7abf79 100644 --- a/lib/auth_unix.c +++ b/lib/auth_unix.c @@ -156,10 +156,12 @@ const char *identifier; 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; @@ -211,6 +213,22 @@ size_t len; /* 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; } diff --git a/lib/imapoptions b/lib/imapoptions index c049501..4d16fb5 100644 --- a/lib/imapoptions +++ b/lib/imapoptions @@ -1416,6 +1416,11 @@ product version in the capabilities */ the special use flag "\Drafts" added. Later versions of Cyrus have a much more flexible RFC 6154 compatible system. */ +{ "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 diff --git a/lib/libcyr_cfg.c b/lib/libcyr_cfg.c index 688523c..b5c6008 100644 --- a/lib/libcyr_cfg.c +++ b/lib/libcyr_cfg.c @@ -158,6 +158,10 @@ struct cyrusopt_s cyrus_options[] = { CFGVAL(long, 1), CYRUS_OPT_SWITCH }, + { CYRUSOPT_NORMALIZEUID, + CFGVAL(long, 1), + CYRUS_OPT_SWITCH }, + { CYRUSOPT_LAST, { NULL }, CYRUS_OPT_NOTOPT } }; diff --git a/lib/libcyr_cfg.h b/lib/libcyr_cfg.h index 7bdca06..1afe95a 100644 --- a/lib/libcyr_cfg.h +++ b/lib/libcyr_cfg.h @@ -116,6 +116,8 @@ enum cyrus_opt { CYRUSOPT_SQL_USESSL, /* Checkpoint after every recovery (OFF) */ CYRUSOPT_SKIPLIST_ALWAYS_CHECKPOINT, + /* Lowercase uid and strip leading and trailing blanks (OFF) */ + CYRUSOPT_NORMALIZEUID, CYRUSOPT_LAST
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.