]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/blame - src/patches/authid_normalize.patch
Wir kehren zurueck zu Kudzu, da hwinfo noch mehr Aerger macht.
[people/teissler/ipfire-2.x.git] / src / patches / authid_normalize.patch
CommitLineData
b40388bb
MT
1--- lib/auth_unix.c
2+++ lib/auth_unix.c 2004/05/31 11:32:50
3@@ -159,10 +159,12 @@
4 size_t len;
5 {
6 static char retbuf[81];
7+ char backup[81];
8 struct group *grp;
9 char sawalpha;
10 char *p;
11 int username_tolower = 0;
12+ int ic,rbc;
13
14 if(!len) len = strlen(identifier);
15 if(len >= sizeof(retbuf)) return NULL;
16@@ -210,6 +212,22 @@
17
18 if (!sawalpha) return NULL; /* has to be one alpha char */
19
20+ if( (libcyrus_config_getswitch(CYRUSOPT_NORMALIZEUID) == 1) ) {
21+ strcpy(backup,retbuf);
22+ /* remove leading blanks */
23+ for(ic=0; isblank(backup[ic]); ic++);
24+ for(rbc=0; backup[ic]; ic++) {
25+ retbuf[rbc] = ( isalpha(backup[ic]) ?
26+ tolower(backup[ic]) : backup[ic] );
27+ rbc++;
28+ }
29+ retbuf[rbc] = '\0';
30+ /* remove trailing blanks */
31+ for(--rbc; isblank(retbuf[rbc]); rbc--) {
32+ retbuf[rbc] = '\0';
33+ }
34+ }
35+
36 return retbuf;
37 }
38
39--- lib/imapoptions
40+++ lib/imapoptions 2004/05/31 11:32:50
41@@ -832,6 +832,11 @@
42 interface, otherwise the user is assumed to be in the default
43 domain (if set). */
44
45+{ "normalizeuid", 0, SWITCH }
46+/* Lowercase uid and strip leading and trailing blanks. It is recommended
47+ to set this to yes, especially if OpenLDAP is used as authentication
48+ source. */
49+
50 /*
51 .SH SEE ALSO
52 .PP
53--- lib/libcyr_cfg.c
54+++ lib/libcyr_cfg.c 2004/05/31 11:32:50
55@@ -118,6 +118,11 @@
56 CFGVAL(int, 100),
57 CYRUS_OPT_INT },
58
59+ { CYRUSOPT_NORMALIZEUID,
60+ (union cyrus_config_value)((int)1),
61+ CYRUS_OPT_SWITCH },
62+
63+
64 { CYRUSOPT_LAST, { NULL }, CYRUS_OPT_NOTOPT }
65 };
66
67--- lib/libcyr_cfg.h
68+++ lib/libcyr_cfg.h 2004/05/31 11:33:10
69@@ -97,6 +97,8 @@
70 CYRUSOPT_BERKELEY_LOCKS_MAX,
71 /* BDB max txns (100) */
72 CYRUSOPT_BERKELEY_TXNS_MAX,
73+ /* Lowercase uid and strip leading and trailing blanks (OFF) */
74+ CYRUSOPT_NORMALIZEUID,
75
76 CYRUSOPT_LAST
77