From bf1cbb06a3585da0896dd378b565764bb780d19d Mon Sep 17 00:00:00 2001 From: Sumit Bose Date: Tue, 28 Oct 2014 19:42:47 +0100 Subject: [PATCH 4/5] nss: parse user_attributes option --- src/man/sssd.conf.5.xml | 26 ++++++++++++++++++++++++++ src/responder/nss/nsssrv.c | 17 +++++++++++++++++ src/responder/nss/nsssrv.h | 2 ++ 3 files changed, 45 insertions(+) diff --git a/src/man/sssd.conf.5.xml b/src/man/sssd.conf.5.xml index e2cb0b8..fbaca66 100644 --- a/src/man/sssd.conf.5.xml +++ b/src/man/sssd.conf.5.xml @@ -711,6 +711,32 @@ fallback_homedir = /home/%u + + user_attributes (string) + + + Some of the additional NSS responder requests can + return more attributes than just the POSIX ones + defined by the NSS interface. The list of attributes + is controlled by this option. It is handle the same + way as the user_attributes option of + the InfoPipe responder (see + + sssd-ifp + 5 + + for details) but with no default values. + + + To make configuration more easy the NSS responder + will check the InfoPipe option if it is not set for + the NSS responder. + + + Default: not set, fallback to InfoPipe option + + + diff --git a/src/responder/nss/nsssrv.c b/src/responder/nss/nsssrv.c index 1bbeaa1..baea9d5 100644 --- a/src/responder/nss/nsssrv.c +++ b/src/responder/nss/nsssrv.c @@ -214,6 +214,7 @@ static int nss_get_config(struct nss_ctx *nctx, struct confdb_ctx *cdb) { int ret; + char *tmp_str; ret = confdb_get_int(cdb, CONFDB_NSS_CONF_ENTRY, CONFDB_NSS_ENUM_CACHE_TIMEOUT, 120, @@ -298,6 +299,22 @@ static int nss_get_config(struct nss_ctx *nctx, &nctx->homedir_substr); if (ret != EOK) goto done; + + ret = confdb_get_string(cdb, nctx, CONFDB_NSS_CONF_ENTRY, + CONFDB_IFP_USER_ATTR_LIST, NULL, &tmp_str); + if (ret != EOK) goto done; + + if (tmp_str == NULL) { + ret = confdb_get_string(cdb, nctx, CONFDB_IFP_CONF_ENTRY, + CONFDB_IFP_USER_ATTR_LIST, NULL, &tmp_str); + if (ret != EOK) goto done; + } + + if (tmp_str != NULL) { + nctx->extra_attributes = parse_attr_list_ex(nctx, tmp_str, NULL); + if (ret != EOK) goto done; + } + ret = 0; done: return ret; diff --git a/src/responder/nss/nsssrv.h b/src/responder/nss/nsssrv.h index a5b946b..784eba2 100644 --- a/src/responder/nss/nsssrv.h +++ b/src/responder/nss/nsssrv.h @@ -75,6 +75,8 @@ struct nss_ctx { struct sss_idmap_ctx *idmap_ctx; struct sss_names_ctx *global_names; + + const char **extra_attributes; }; struct nss_packet; -- 1.8.3.1