ipwd.c revision bcb4e51a409d94ae670de96afb8483a4f7855294
25757faf029c369a8318349dafe952e2358df1d8Timo Sirainen/* Copyright (c) 2011-2018 Dovecot authors, see the included COPYING file */
25757faf029c369a8318349dafe952e2358df1d8Timo Sirainen#define _POSIX_PTHREAD_SEMANTICS /* for Solaris */
c7480644202e5451fbed448508ea29a25cffc99cTimo Sirainenstatic void pw_init(void)
25757faf029c369a8318349dafe952e2358df1d8Timo Sirainen pwbuf_size = nearest_power(old_pwbuf_size + 1);
25757faf029c369a8318349dafe952e2358df1d8Timo Sirainen pwbuf = i_realloc(pwbuf, old_pwbuf_size, pwbuf_size);
25757faf029c369a8318349dafe952e2358df1d8Timo Sirainenstatic void gr_init(void)
7d6389e4053c2dac1fb37180b5756b00785983dcTimo Sirainen grbuf_size = nearest_power(old_grbuf_size + 1);
7d6389e4053c2dac1fb37180b5756b00785983dcTimo Sirainen grbuf = i_realloc(grbuf, old_grbuf_size, grbuf_size);
25757faf029c369a8318349dafe952e2358df1d8Timo Sirainenint i_getpwnam(const char *name, struct passwd *pwd_r)
7d6389e4053c2dac1fb37180b5756b00785983dcTimo Sirainen errno = getpwnam_r(name, pwd_r, pwbuf, pwbuf_size, &result);
25ee72451d16374ed27fdbf829f4ec756c778352Timo Sirainen /* FreeBSD fails here when name="user@domain" */
6ef7e31619edfaa17ed044b45861d106a86191efTimo Sirainenint i_getpwuid(uid_t uid, struct passwd *pwd_r)
a3dd97fb6d92a89c3de0597fed2d4b044c7aeb84Timo Sirainen errno = getpwuid_r(uid, pwd_r, pwbuf, pwbuf_size, &result);
137ea7ca34005345aa2304a940149b7f3774d727Timo Sirainenint i_getgrnam(const char *name, struct group *grp_r)
1e21e6be70994b1aa9e52ca0e2f51afefca6d0dfTimo Sirainen errno = getgrnam_r(name, grp_r, grbuf, grbuf_size, &result);
errno = 0;
gr_init();