Last change
on this file since 2349 was
1825,
checked in by andersk, 13 years ago
|
Update nss_nonlocal to 2.0
- Fix errno saving and restoring.
- Document nss-nonlocal-users and nss-local-users groups in README.
- Allow local whitelisting of nonlocal user and group memberships,
using the magic local ‘nss-nonlocal-users’ user and group.
|
File size:
1.3 KB
|
Line | |
---|
1 | { |
---|
2 | static service_user *startp = NULL; |
---|
3 | static void *fct_start = NULL; |
---|
4 | |
---|
5 | service_user *nip; |
---|
6 | union { |
---|
7 | __typeof__(self) l; |
---|
8 | void *ptr; |
---|
9 | } fct; |
---|
10 | int old_errno = errno; |
---|
11 | |
---|
12 | if (fct_start == NULL && |
---|
13 | w.lookup(&startp, w.fct_name, &fct_start) != 0) { |
---|
14 | *w.status = NSS_STATUS_UNAVAIL; |
---|
15 | goto walk_nss_out; |
---|
16 | } |
---|
17 | |
---|
18 | nip = startp; |
---|
19 | fct.ptr = fct_start; |
---|
20 | |
---|
21 | if (w.buf != NULL) { |
---|
22 | *w.buf = malloc(*w.buflen); |
---|
23 | errno = old_errno; |
---|
24 | if (*w.buf == NULL) { |
---|
25 | *w.status = NSS_STATUS_TRYAGAIN; |
---|
26 | *w.errnop = ENOMEM; |
---|
27 | goto walk_nss_out; |
---|
28 | } |
---|
29 | } |
---|
30 | |
---|
31 | do { |
---|
32 | walk_nss_morebuf: |
---|
33 | if (fct.ptr == NULL) |
---|
34 | *w.status = NSS_STATUS_UNAVAIL; |
---|
35 | else if (self != NULL && fct.l == self) |
---|
36 | *w.status = NSS_STATUS_NOTFOUND; |
---|
37 | else |
---|
38 | *w.status = DL_CALL_FCT(fct.l, args); |
---|
39 | if (*w.status == NSS_STATUS_TRYAGAIN && |
---|
40 | w.errnop != NULL && *w.errnop == ERANGE) { |
---|
41 | if (w.buf == NULL) |
---|
42 | break; |
---|
43 | free(*w.buf); |
---|
44 | *w.buflen *= 2; |
---|
45 | *w.buf = malloc(*w.buflen); |
---|
46 | errno = old_errno; |
---|
47 | if (*w.buf == NULL) { |
---|
48 | *w.errnop = ENOMEM; |
---|
49 | goto walk_nss_out; |
---|
50 | } |
---|
51 | goto walk_nss_morebuf; |
---|
52 | } |
---|
53 | } while (__nss_next(&nip, w.fct_name, &fct.ptr, *w.status, 0) == 0); |
---|
54 | |
---|
55 | if (w.buf != NULL && *w.status != NSS_STATUS_SUCCESS) { |
---|
56 | free(*w.buf); |
---|
57 | *w.buf = NULL; |
---|
58 | } |
---|
59 | |
---|
60 | walk_nss_out: |
---|
61 | ; |
---|
62 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.