X-Git-Url: http://andersk.mit.edu/gitweb/nss_nonlocal.git/blobdiff_plain/cbb0e3ea444ff761b58c8f9355af1dfc631bc64b..dc397f8f1c8609311eeb93210e190ecffdda5cf4:/nonlocal-passwd.c diff --git a/nonlocal-passwd.c b/nonlocal-passwd.c index 052af95..b9a14b5 100644 --- a/nonlocal-passwd.c +++ b/nonlocal-passwd.c @@ -25,18 +25,19 @@ #define _GNU_SOURCE + #include -#include -#include -#include -#include #include -#include -#include #include -#include -#include #include +#include +#include +#include +#include +#include +#include +#include + #include "nsswitch-internal.h" #include "nonlocal.h" @@ -143,6 +144,23 @@ check_nonlocal_user(const char *user, int *errnop) return status; } +enum nss_status +get_nonlocal_passwd(const char *name, struct passwd *pwd, char **buffer, + int *errnop) +{ + enum nss_status status; + size_t buflen = sysconf(_SC_GETPW_R_SIZE_MAX); + const struct walk_nss w = { + .lookup = __nss_passwd_nonlocal_lookup, .fct_name = "getpwnam_r", + .status = &status, .errnop = errnop, .buf = buffer, .buflen = &buflen + }; + const __typeof__(&_nss_nonlocal_getpwnam_r) self = NULL; +#define args (name, pwd, *buffer, buflen, errnop) +#include "walk_nss.h" +#undef args + return status; +} + static service_user *pwent_startp, *pwent_nip; static void *pwent_fct_start; @@ -262,7 +280,7 @@ _nss_nonlocal_getpwnam_r(const char *name, struct passwd *pwd, if (status != NSS_STATUS_SUCCESS) return status; - if (check_nonlocal_gid(name, pwd->pw_gid, &group_errno) != + if (check_nonlocal_gid(name, NULL, pwd->pw_gid, &group_errno) != NSS_STATUS_SUCCESS) pwd->pw_gid = 65534 /* nogroup */; return NSS_STATUS_SUCCESS; @@ -299,7 +317,7 @@ _nss_nonlocal_getpwuid_r(uid_t uid, struct passwd *pwd, if (status != NSS_STATUS_SUCCESS) return status; - if (check_nonlocal_gid(pwd->pw_name, pwd->pw_gid, &group_errno) != + if (check_nonlocal_gid(pwd->pw_name, NULL, pwd->pw_gid, &group_errno) != NSS_STATUS_SUCCESS) pwd->pw_gid = 65534 /* nogroup */; return NSS_STATUS_SUCCESS;