]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
i_getpw*(): Added OpenBSD workaround.
authorTimo Sirainen <tss@iki.fi>
Sun, 22 Sep 2013 04:24:26 +0000 (07:24 +0300)
committerTimo Sirainen <tss@iki.fi>
Sun, 22 Sep 2013 04:24:26 +0000 (07:24 +0300)
src/lib/ipwd.c

index e5dfc66880760a2e1a8f2be5f0c6dfc7f4a80e86..68c6b02fda42fce70ed62914ffca403f70f7d99c 100644 (file)
@@ -50,6 +50,11 @@ 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;
@@ -68,6 +73,11 @@ 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;