3 * NSS walking template for nss_nonlocal proxy
5 * Copyright © 2011 Anders Kaseorg <andersk@mit.edu> and Tim Abbott
8 * This file is part of nss_nonlocal.
10 * nss_nonlocal is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Lesser General Public License
12 * as published by the Free Software Foundation; either version 2.1 of
13 * the License, or (at your option) any later version.
15 * nss_nonlocal is distributed in the hope that it will be useful, but
16 * WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * Lesser General Public License for more details.
20 * You should have received a copy of the GNU Lesser General Public
21 * License along with nss_nonlocal; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
27 static bool initialized = false;
28 static service_user *startp;
29 static void *fct_start;
36 int old_errno = errno;
39 if (w.lookup(&startp, w.fct_name, &fct_start) != 0) {
40 *w.status = NSS_STATUS_UNAVAIL;
51 *w.buf = malloc(*w.buflen);
54 *w.status = NSS_STATUS_TRYAGAIN;
63 *w.status = NSS_STATUS_UNAVAIL;
64 else if (self != NULL && fct.l == self)
65 *w.status = NSS_STATUS_NOTFOUND;
67 *w.status = DL_CALL_FCT(fct.l, args);
68 if (*w.status == NSS_STATUS_TRYAGAIN &&
69 w.errnop != NULL && *w.errnop == ERANGE) {
74 *w.buf = malloc(*w.buflen);
80 goto walk_nss_morebuf;
82 } while (__nss_next(&nip, w.fct_name, &fct.ptr, *w.status, 0) == 0);
84 if (w.buf != NULL && *w.status != NSS_STATUS_SUCCESS) {