summaryrefslogtreecommitdiff
path: root/src/responder
diff options
context:
space:
mode:
authorPavel Březina <pbrezina@redhat.com>2013-09-02 13:36:25 +0200
committerJakub Hrozek <jhrozek@redhat.com>2013-09-17 16:02:19 +0200
commita473fb88e6015cf0ccbd2e9005c7e6acca18f452 (patch)
tree49546bec7a5fe3789fd841421af6786c35df87ab /src/responder
parentd0017ae54df06b1be7f6878e6f3bfeabe93c2290 (diff)
downloadsssd-a473fb88e6015cf0ccbd2e9005c7e6acca18f452.tar.gz
sssd-a473fb88e6015cf0ccbd2e9005c7e6acca18f452.tar.bz2
sssd-a473fb88e6015cf0ccbd2e9005c7e6acca18f452.zip
util: add sss_idmap_talloc[_free]
Remove code duplication.
Diffstat (limited to 'src/responder')
-rw-r--r--src/responder/nss/nsssrv.c13
-rw-r--r--src/responder/pac/pacsrv.c13
2 files changed, 4 insertions, 22 deletions
diff --git a/src/responder/nss/nsssrv.c b/src/responder/nss/nsssrv.c
index 253756d1..5f1d2e67 100644
--- a/src/responder/nss/nsssrv.c
+++ b/src/responder/nss/nsssrv.c
@@ -47,6 +47,7 @@
#include "providers/data_provider.h"
#include "monitor/monitor_interfaces.h"
#include "sbus/sbus_client.h"
+#include "util/util_sss_idmap.h"
#define DEFAULT_PWFIELD "*"
#define DEFAULT_NSS_FD_LIMIT 8192
@@ -413,16 +414,6 @@ 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)
@@ -490,7 +481,7 @@ int nss_process_init(TALLOC_CTX *mem_ctx,
nss_dp_reconnect_init, iter);
}
- err = sss_idmap_init(idmap_talloc, nctx, idmap_free,
+ err = sss_idmap_init(sss_idmap_talloc, nctx, sss_idmap_talloc_free,
&nctx->idmap_ctx);
if (err != IDMAP_SUCCESS) {
DEBUG(SSSDBG_FATAL_FAILURE, ("sss_idmap_init failed.\n"));
diff --git a/src/responder/pac/pacsrv.c b/src/responder/pac/pacsrv.c
index 22f87cb7..a06d768b 100644
--- a/src/responder/pac/pacsrv.c
+++ b/src/responder/pac/pacsrv.c
@@ -42,6 +42,7 @@
#include "providers/data_provider.h"
#include "monitor/monitor_interfaces.h"
#include "sbus/sbus_client.h"
+#include "util/util_sss_idmap.h"
#define SSS_PAC_PIPE_NAME "pac"
#define DEFAULT_PAC_FD_LIMIT 8192
@@ -105,16 +106,6 @@ static void pac_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 pac_process_init(TALLOC_CTX *mem_ctx,
struct tevent_context *ev,
struct confdb_ctx *cdb)
@@ -186,7 +177,7 @@ int pac_process_init(TALLOC_CTX *mem_ctx,
pac_dp_reconnect_init, iter);
}
- err = sss_idmap_init(idmap_talloc, pac_ctx, idmap_free,
+ err = sss_idmap_init(sss_idmap_talloc, pac_ctx, sss_idmap_talloc_free,
&pac_ctx->idmap_ctx);
if (err != IDMAP_SUCCESS) {
DEBUG(SSSDBG_FATAL_FAILURE, ("sss_idmap_init failed.\n"));