Hi, cyrus imapd is completly independent of unix accounts and therefor does not depend on /etc/passwd.
I think beeing dependent on /etc/group is not nice either and therefor this little patch in the attachment. Also in order to get sieve working correctly the following trivial change is required: --- timsieved/lex.c.orig 2002-10-04 23:58:36.000000000 +0200 +++ timsieved/lex.c 2002-10-04 23:59:09.000000000 +0200 @@ -322,6 +322,7 @@ if (isdigit((unsigned char) ch)) { lexer_state=LEXER_STATE_NUMBER; tmpnum = ch -'0'; + break; } switch (ch) { case '(': Regards, --martin -- Dipl.-Phys. Martin Konold e r f r a k o n Erlewein, Frank, Konold & Partner - Beratende Ingenieure und Physiker Germanenstrasse 15, 70563 Stuttgart, Germany email: [EMAIL PROTECTED]
--- lib/auth_unix.c Thu Oct 10 16:38:26 2002 +++ lib/auth_unix.c Thu Oct 10 17:48:04 2002 @@ -48,6 +48,7 @@ #include <stdlib.h> #include <pwd.h> #include <grp.h> +#include <stdio.h> #include <ctype.h> #include <string.h> @@ -143,6 +144,26 @@ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + +static struct group* fgetgrnam(const char* name) +{ + struct group *grp; + FILE *groupfile; + + groupfile = fopen("/etc/imapd.group","r"); + if (!groupfile) groupfile = fopen("/etc/group", "r"); + if (groupfile) { + while ((grp = fgetgrent(groupfile))) { + if (strcmp(grp->gr_name, name) == 0) { + fclose(groupfile); + return grp; + } + } + } + if (groupfile) fclose(groupfile); + return NULL; +} + /* * Convert 'identifier' into canonical form. * Returns a pointer to a static buffer containing the canonical form @@ -185,7 +206,7 @@ */ if (!strncmp(retbuf, "group:", 6)) { - grp = getgrnam(retbuf+6); + grp = fgetgrnam(retbuf+6); if (!grp) return 0; strcpy(retbuf+6, grp->gr_name); return retbuf; @@ -228,6 +249,7 @@ struct passwd *pwd; struct group *grp; char **mem; + FILE *groupfile; identifier = auth_canonifyid(identifier, 0); if (!identifier) return 0; @@ -241,20 +263,23 @@ newstate->ngroups = 0; newstate->group = (char **) 0; - setgrent(); - while ((grp = getgrent())) { - for (mem = grp->gr_mem; *mem; mem++) { - if (!strcmp(*mem, identifier)) break; - } - - if (*mem || (pwd && pwd->pw_gid == grp->gr_gid)) { - newstate->ngroups++; - newstate->group = (char **)xrealloc((char *)newstate->group, - newstate->ngroups * sizeof(char *)); - newstate->group[newstate->ngroups-1] = xstrdup(grp->gr_name); - } - } - endgrent(); + groupfile = fopen("/etc/imapd.group", "r"); + if (!groupfile) groupfile = fopen("/etc/group","r"); + if (groupfile) { + while ((grp = fgetgrent(groupfile))) { + for (mem = grp->gr_mem; *mem; mem++) { + if (!strcmp(*mem, identifier)) break; + } + + if (*mem || (pwd && pwd->pw_gid == grp->gr_gid)) { + newstate->ngroups++; + newstate->group = (char **)xrealloc((char *)newstate->group, + newstate->ngroups * sizeof(char *)); + newstate->group[newstate->ngroups-1] = xstrdup(grp->gr_name); + } + } + fclose(groupfile); + } return newstate; }