On Tue, Mar 11, 2014 at 3:45 AM, William Yodlowsky <will...@openbsd.org> wrote:
> I hit this today on -current amd64 with 2.2.10.  An attempt to
> authenticate to a nonexistent account caused this:
>
> Mar 10 12:04:51 host1 dovecot: auth-worker(12079): Fatal: master: 
> service(auth-worker): child 12079 returned error 83 (Out of memory (service 
> auth-worker { vsz_limit=256 MB }, you may need to increase it) - set 
> CORE_OUTOFMEM=1 environment to get core dump)
>
> Of course that continues to happen no matter how large the limits
> are raised.  The fix is to back out the workaround in dovecot, as
> getpwnam_r() was recently fixed.  With the below applied, you instead
> get:
>
> Mar 10 14:42:41 host1 dovecot: auth-worker(5241): Error: 
> bsdauth(notauser,1.2.3.4): getpwnam() failed: Operation not permitted
>
> I'm new to dovecot but that seems alot better than a crash.
>
>
> --- src/lib/ipwd.c.orig Mon Mar 10 14:00:34 2014
> +++ src/lib/ipwd.c      Mon Mar 10 14:03:41 2014
> @@ -50,11 +50,6 @@ int i_getpwnam(const char *name, struct passwd *pwd_r)
>         do {
>                 pw_init();
>                 errno = getpwnam_r(name, pwd_r, pwbuf, pwbuf_size, &result);
> -#ifdef __OpenBSD__
> -               /* OpenBSD returns 1 for all errors, assume it's ERANGE */
> -               if (errno == 1)
> -                       errno = ERANGE;
> -#endif
>         } while (errno == ERANGE);
>         if (result != NULL)
>                 return 1;
> @@ -73,11 +68,6 @@ int i_getpwuid(uid_t uid, struct passwd *pwd_r)
>         do {
>                 pw_init();
>                 errno = getpwuid_r(uid, pwd_r, pwbuf, pwbuf_size, &result);
> -#ifdef __OpenBSD__
> -               /* OpenBSD returns 1 for all errors, assume it's ERANGE */
> -               if (errno == 1)
> -                       errno = ERANGE;
> -#endif
>         } while (errno == ERANGE);
>         if (result != NULL)
>                 return 1;

Seems reasonable to me.

ciao,
David

Reply via email to