Blame cyrus-imapd-2.2.10-groupcache.patch
|
|
d0d307a |
diff -Naur cyrus-imapd-2.2.10.orig/lib/auth_unix.c cyrus-imapd-2.2.10/lib/auth_unix.c
|
|
|
d0d307a |
--- cyrus-imapd-2.2.10.orig/lib/auth_unix.c Tue Sep 14 00:49:29 2004
|
|
|
d0d307a |
+++ cyrus-imapd-2.2.10/lib/auth_unix.c Thu Dec 16 08:36:32 2004
|
|
|
d0d307a |
@@ -48,6 +48,7 @@
|
|
|
d0d307a |
#include <stdlib.h>
|
|
|
d0d307a |
#include <pwd.h>
|
|
|
d0d307a |
#include <grp.h>
|
|
|
d0d307a |
+#include <stdio.h>
|
|
|
d0d307a |
#include <ctype.h>
|
|
|
d0d307a |
#include <string.h>
|
|
|
d0d307a |
|
|
|
d0d307a |
@@ -226,6 +227,10 @@
|
|
|
d0d307a |
struct passwd *pwd;
|
|
|
d0d307a |
struct group *grp;
|
|
|
d0d307a |
char **mem;
|
|
|
d0d307a |
+ FILE *groupcache;
|
|
|
d0d307a |
+ char fnamebuf[1024];
|
|
|
d0d307a |
+ const char *config_dir =
|
|
|
d0d307a |
+ libcyrus_config_getstring(CYRUSOPT_CONFIG_DIR);
|
|
|
d0d307a |
|
|
|
d0d307a |
identifier = auth_canonifyid(identifier, 0);
|
|
|
d0d307a |
if (!identifier) return 0;
|
|
|
d0d307a |
@@ -242,8 +247,11 @@
|
|
|
d0d307a |
|
|
|
d0d307a |
pwd = getpwnam(identifier);
|
|
|
d0d307a |
|
|
|
d0d307a |
+ strcpy(fnamebuf, config_dir);
|
|
|
d0d307a |
+ strcat(fnamebuf, "/group.cache");
|
|
|
d0d307a |
+ groupcache = fopen(fnamebuf, "r");
|
|
|
d0d307a |
setgrent();
|
|
|
d0d307a |
- while ((grp = getgrent())) {
|
|
|
d0d307a |
+ while (grp = ( (groupcache) ? fgetgrent(groupcache) : getgrent() )) {
|
|
|
d0d307a |
for (mem = grp->gr_mem; *mem; mem++) {
|
|
|
d0d307a |
if (!strcmp(*mem, identifier)) break;
|
|
|
d0d307a |
}
|
|
|
d0d307a |
@@ -256,6 +264,7 @@
|
|
|
d0d307a |
}
|
|
|
d0d307a |
}
|
|
|
d0d307a |
endgrent();
|
|
|
d0d307a |
+ if (groupcache) fclose(groupcache);
|
|
|
d0d307a |
return newstate;
|
|
|
d0d307a |
}
|
|
|
d0d307a |
|