]>
Commit | Line | Data |
---|---|---|
b40388bb MT |
1 | diff -Naur cyrus-imapd-2.2.10.orig/lib/auth_unix.c cyrus-imapd-2.2.10/lib/auth_unix.c |
2 | --- cyrus-imapd-2.2.10.orig/lib/auth_unix.c Tue Sep 14 00:49:29 2004 | |
3 | +++ cyrus-imapd-2.2.10/lib/auth_unix.c Thu Dec 16 08:36:32 2004 | |
4 | @@ -48,6 +48,7 @@ | |
5 | #include <stdlib.h> | |
6 | #include <pwd.h> | |
7 | #include <grp.h> | |
8 | +#include <stdio.h> | |
9 | #include <ctype.h> | |
10 | #include <string.h> | |
11 | ||
12 | @@ -226,6 +227,10 @@ | |
13 | struct passwd *pwd; | |
14 | struct group *grp; | |
15 | char **mem; | |
16 | + FILE *groupcache; | |
17 | + char fnamebuf[1024]; | |
18 | + const char *config_dir = | |
19 | + libcyrus_config_getstring(CYRUSOPT_CONFIG_DIR); | |
20 | ||
21 | identifier = auth_canonifyid(identifier, 0); | |
22 | if (!identifier) return 0; | |
23 | @@ -242,8 +247,11 @@ | |
24 | ||
25 | pwd = getpwnam(identifier); | |
26 | ||
27 | + strcpy(fnamebuf, config_dir); | |
28 | + strcat(fnamebuf, "/group.cache"); | |
29 | + groupcache = fopen(fnamebuf, "r"); | |
30 | setgrent(); | |
31 | - while ((grp = getgrent())) { | |
32 | + while (grp = ( (groupcache) ? fgetgrent(groupcache) : getgrent() )) { | |
33 | for (mem = grp->gr_mem; *mem; mem++) { | |
34 | if (!strcmp(*mem, identifier)) break; | |
35 | } | |
36 | @@ -256,6 +264,7 @@ | |
37 | } | |
38 | } | |
39 | endgrent(); | |
40 | + if (groupcache) fclose(groupcache); | |
41 | return newstate; | |
42 | } | |
43 |