diff options
author | Simo Sorce <simo@redhat.com> | 2012-01-03 02:46:40 -0500 |
---|---|---|
committer | Stephen Gallagher <sgallagh@redhat.com> | 2012-03-19 09:45:25 -0400 |
commit | 10eae23e2483733d4ca3c21f15b5bdb3f04c9839 (patch) | |
tree | 7c9364283ed6ea554c5e41a9fdd3726e9a378618 /src/sss_client/nss_group.c | |
parent | c3ef027218fe9a7d16a70ca9d2f53e3d995e369f (diff) | |
download | sssd-10eae23e2483733d4ca3c21f15b5bdb3f04c9839.tar.gz sssd-10eae23e2483733d4ca3c21f15b5bdb3f04c9839.tar.xz sssd-10eae23e2483733d4ca3c21f15b5bdb3f04c9839.zip |
sss_client: shared memory cache group map support
Diffstat (limited to 'src/sss_client/nss_group.c')
-rw-r--r-- | src/sss_client/nss_group.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/src/sss_client/nss_group.c b/src/sss_client/nss_group.c index 085a53409..1b9f3a3aa 100644 --- a/src/sss_client/nss_group.c +++ b/src/sss_client/nss_group.c @@ -29,6 +29,7 @@ #include <string.h> #include <stdbool.h> #include "sss_cli.h" +#include "nss_mc.h" static struct sss_nss_getgrent_data { size_t len; @@ -365,6 +366,27 @@ enum nss_status _nss_sss_getgrnam_r(const char *name, struct group *result, return NSS_STATUS_NOTFOUND; } + ret = sss_nss_mc_getgrnam(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; + case EINVAL: + /* if using the mmaped cache failed, + * fall back to socket based comms */ + break; + default: + *errnop = EBADMSG; + return NSS_STATUS_TRYAGAIN; + } + rd.len = name_len + 1; rd.data = name; @@ -433,6 +455,27 @@ enum nss_status _nss_sss_getgrgid_r(gid_t gid, struct group *result, /* Caught once glibc passing in buffer == 0x0 */ if (!buffer || !buflen) return ERANGE; + ret = sss_nss_mc_getgrgid(gid, 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; + case EINVAL: + /* if using the mmaped cache failed, + * fall back to socket based comms */ + break; + default: + *errnop = EBADMSG; + return NSS_STATUS_TRYAGAIN; + } + group_gid = gid; rd.len = sizeof(uint32_t); rd.data = &group_gid; |