diff options
author | Simo Sorce <simo@redhat.com> | 2012-01-02 17:10:12 -0500 |
---|---|---|
committer | Stephen Gallagher <sgallagh@redhat.com> | 2012-03-19 09:45:25 -0400 |
commit | 1171986bdc3011555c5b62a9d9ee9f7481f48cdc (patch) | |
tree | f60dace9d32638ae65c9b53e2576a18b4393521e /src/sss_client/nss_passwd.c | |
parent | 5f216c753dbd2f2b25a011c5f705ee4f8ad924e6 (diff) | |
download | sssd-1171986bdc3011555c5b62a9d9ee9f7481f48cdc.tar.gz sssd-1171986bdc3011555c5b62a9d9ee9f7481f48cdc.tar.bz2 sssd-1171986bdc3011555c5b62a9d9ee9f7481f48cdc.zip |
sss_client: shared memory cache passwd map support
Diffstat (limited to 'src/sss_client/nss_passwd.c')
-rw-r--r-- | src/sss_client/nss_passwd.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/sss_client/nss_passwd.c b/src/sss_client/nss_passwd.c index 16124948..e2f488b9 100644 --- a/src/sss_client/nss_passwd.c +++ b/src/sss_client/nss_passwd.c @@ -28,6 +28,7 @@ #include <stdint.h> #include <string.h> #include "sss_cli.h" +#include "nss_mc.h" static struct sss_nss_getpwent_data { size_t len; @@ -154,6 +155,24 @@ enum nss_status _nss_sss_getpwnam_r(const char *name, struct passwd *result, return NSS_STATUS_NOTFOUND; } + ret = sss_nss_mc_getpwnam(name, name_len, result, buffer, buflen); + switch (ret) { + case 0: + *errnop = 0; + return NSS_STATUS_SUCCESS; + case ERANGE: + *errnop = ERANGE; + return NSS_STATUS_TRYAGAIN; + case ENOENT: + /* fall through, we need to actively ask the parent + * if no entry is found */ + break; + default: + /* if using the mmaped cache failed, + * fall back to socket based comms */ + break; + } + rd.len = name_len + 1; rd.data = name; @@ -214,6 +233,24 @@ enum nss_status _nss_sss_getpwuid_r(uid_t uid, struct passwd *result, /* Caught once glibc passing in buffer == 0x0 */ if (!buffer || !buflen) return ERANGE; + ret = sss_nss_mc_getpwuid(uid, result, buffer, buflen); + switch (ret) { + case 0: + *errnop = 0; + return NSS_STATUS_SUCCESS; + case ERANGE: + *errnop = ERANGE; + return NSS_STATUS_TRYAGAIN; + case ENOENT: + /* fall through, we need to actively ask the parent + * if no entry is found */ + break; + default: + /* if using the mmaped cache failed, + * fall back to socket based comms */ + break; + } + user_uid = uid; rd.len = sizeof(uint32_t); rd.data = &user_uid; |