summaryrefslogtreecommitdiff
path: root/src/responder/nss
diff options
context:
space:
mode:
authorSumit Bose <sbose@redhat.com>2013-04-16 10:48:17 +0200
committerJakub Hrozek <jhrozek@redhat.com>2013-05-02 19:33:56 +0200
commitf427b36b0cecc426856ab3f77a9c684ac355659d (patch)
treeaffce4dbe27b9dfc3d66639b35f4a42da04db058 /src/responder/nss
parentf0944fdd627bd684ff36c9670dc857ffdedc343f (diff)
downloadsssd-f427b36b0cecc426856ab3f77a9c684ac355659d.tar.gz
sssd-f427b36b0cecc426856ab3f77a9c684ac355659d.tar.bz2
sssd-f427b36b0cecc426856ab3f77a9c684ac355659d.zip
Add idmap context to nss context
This allows the nss responder to use libsss_idmap to convert between different SID representations.
Diffstat (limited to 'src/responder/nss')
-rw-r--r--src/responder/nss/nsssrv.c19
-rw-r--r--src/responder/nss/nsssrv.h3
2 files changed, 22 insertions, 0 deletions
diff --git a/src/responder/nss/nsssrv.c b/src/responder/nss/nsssrv.c
index 709912c2..ee8fecb0 100644
--- a/src/responder/nss/nsssrv.c
+++ b/src/responder/nss/nsssrv.c
@@ -391,6 +391,16 @@ static void nss_dp_reconnect_init(struct sbus_connection *conn,
/* nss_shutdown(rctx); */
}
+static void *idmap_talloc(size_t size, void *pvt)
+{
+ return talloc_size(pvt, size);
+}
+
+static void idmap_free(void *ptr, void *pvt)
+{
+ talloc_free(ptr);
+}
+
int nss_process_init(TALLOC_CTX *mem_ctx,
struct tevent_context *ev,
struct confdb_ctx *cdb)
@@ -401,6 +411,7 @@ int nss_process_init(TALLOC_CTX *mem_ctx,
struct nss_ctx *nctx;
int memcache_timeout;
int ret, max_retries;
+ enum idmap_error_code err;
int hret;
int fd_limit;
@@ -457,6 +468,14 @@ int nss_process_init(TALLOC_CTX *mem_ctx,
nss_dp_reconnect_init, iter);
}
+ err = sss_idmap_init(idmap_talloc, nctx, idmap_free,
+ &nctx->idmap_ctx);
+ if (err != IDMAP_SUCCESS) {
+ DEBUG(SSSDBG_FATAL_FAILURE, ("sss_idmap_init failed.\n"));
+ ret = EFAULT;
+ goto fail;
+ }
+
/* Create the lookup table for netgroup results */
hret = sss_hash_create(nctx, 10, &nctx->netgroups);
if (hret != HASH_SUCCESS) {
diff --git a/src/responder/nss/nsssrv.h b/src/responder/nss/nsssrv.h
index 354782b9..b279f8a7 100644
--- a/src/responder/nss/nsssrv.h
+++ b/src/responder/nss/nsssrv.h
@@ -32,6 +32,7 @@
#include "sbus/sssd_dbus.h"
#include "responder/common/responder_packet.h"
#include "responder/common/responder.h"
+#include "lib/idmap/sss_idmap.h"
#define NSS_PACKET_MAX_RECV_SIZE 1024
@@ -68,6 +69,8 @@ struct nss_ctx {
struct sss_mc_ctx *pwd_mc_ctx;
struct sss_mc_ctx *grp_mc_ctx;
+
+ struct sss_idmap_ctx *idmap_ctx;
};
struct nss_packet;