From b5f10b7d45b7e4310cfde4ca7848312b0712e5d7 Mon Sep 17 00:00:00 2001 From: Sumit Bose Date: Tue, 28 Oct 2014 19:42:47 +0100 Subject: [PATCH 3/4] nss: parse IPF user_attributes option --- Makefile.am | 1 + src/man/sssd.conf.5.xml | 26 ++++++++++++++++++++++++++ src/responder/nss/nsssrv.c | 18 ++++++++++++++++++ src/responder/nss/nsssrv.h | 2 ++ 4 files changed, 47 insertions(+) diff --git a/Makefile.am b/Makefile.am index 61bf5cf..3c81295 100644 --- a/Makefile.am +++ b/Makefile.am @@ -940,6 +940,7 @@ sssd_nss_SOURCES = \ src/responder/nss/nsssrv_netgroup.c \ src/responder/nss/nsssrv_services.c \ src/responder/nss/nsssrv_mmap_cache.c \ + src/responder/ifp/ifpsrv_util.c \ $(SSSD_RESPONDER_OBJ) sssd_nss_LDADD = \ $(TDB_LIBS) \ 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..601ffc2 100644 --- a/src/responder/nss/nsssrv.c +++ b/src/responder/nss/nsssrv.c @@ -48,6 +48,7 @@ #include "monitor/monitor_interfaces.h" #include "sbus/sbus_client.h" #include "util/util_sss_idmap.h" +#include "responder/ifp/ifp_private.h" #define DEFAULT_PWFIELD "*" #define DEFAULT_NSS_FD_LIMIT 8192 @@ -214,6 +215,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 +300,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 = ifp_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