mupdate exits with signal 11
Derrick J Brashear
shadow at dementia.org
Tue Apr 26 13:55:34 EDT 2005
And I guess this also:
--- auth_unix.c 16 Feb 2005 21:06:50 -0000 1.37.2.2
+++ auth_unix.c 26 Apr 2005 17:53:40 -0000
@@ -157,10 +157,11 @@
size_t len;
{
static char retbuf[81];
- struct group *grp;
+ struct group grp;
char sawalpha;
char *p;
int username_tolower = 0;
+ char buf[BUFLEN];
if(!len) len = strlen(identifier);
if(len >= sizeof(retbuf)) return NULL;
@@ -177,8 +178,8 @@
*/
if (!strncmp(retbuf, "group:", 6)) {
- grp = getgrnam(retbuf+6);
- if (!grp) return 0;
+ if (getgrnam_r(retbuf + 6, &grp, buf, BUFLEN))
+ return 0;
strcpy(retbuf+6, grp->gr_name);
return retbuf;
}
> Index: auth_unix.c
> ===================================================================
> RCS file: /afs/andrew.cmu.edu/system/cvs/src/cyrus/lib/auth_unix.c,v
> retrieving revision 1.37.2.2
> diff -u -r1.37.2.2 auth_unix.c
> --- auth_unix.c 16 Feb 2005 21:06:50 -0000 1.37.2.2
> +++ auth_unix.c 26 Apr 2005 17:43:56 -0000
> @@ -221,9 +221,11 @@
> static struct auth_state *mynewstate(const char *identifier)
> {
> struct auth_state *newstate;
> - struct passwd *pwd;
> - struct group *grp;
> + struct passwd pwd, *pwdp;
> char **mem;
> + struct group grp, *grpp;
> + char buf[BUFLEN], buf2[BUFLEN];
> + int i;
>
> identifier = mycanonifyid(identifier, 0);
> if (!identifier) return 0;
> @@ -238,22 +240,25 @@
> if(!libcyrus_config_getswitch(CYRUSOPT_AUTH_UNIX_GROUP_ENABLE))
> return newstate;
>
> - pwd = getpwnam(identifier);
> + getpwnam_r(identifier, pwd, buf2, BUFLEN, &pwdp);
>
> 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);
> - }
> + while (1) {
> + i = getgrent_r(&grp, buf, BUFLEN, &grpp);
> + if (i)
> + break;
> + for (mem = grpp->gr_mem; *mem; mem++) {
> + if (!strcmp(*mem, identifier)) break;
> + }
> + if (*mem || (pwdp && pwdp->pw_gid == grpp->gr_gid)) {
> + newstate->ngroups++;
> + newstate->group = (char **)xrealloc((char *)newstate->group,
> + newstate->ngroups * sizeof(char
> *));
> + newstate->group[newstate->ngroups-1] = xstrdup(grpp->gr_name);
> + }
> }
> endgrent();
> +
> return newstate;
> }
>
>
---
Cyrus Home Page: http://asg.web.cmu.edu/cyrus
Cyrus Wiki/FAQ: http://cyruswiki.andrew.cmu.edu
List Archives/Info: http://asg.web.cmu.edu/cyrus/mailing-list.html
More information about the Info-cyrus
mailing list