diff options
| author | Nalin Dahyabhai <nalin.dahyabhai@pobox.com> | 2008-06-03 14:46:17 -0400 |
|---|---|---|
| committer | Nalin Dahyabhai <nalin.dahyabhai@pobox.com> | 2008-06-03 14:46:17 -0400 |
| commit | d917e8e3d1f0361655bfd6190d0e1a99de8287bf (patch) | |
| tree | 687132c9b7589a54bfbbd965d985a5ec11881a38 /src/plugin.c | |
| parent | 215814f16d2a858ff16e2efdd30f8bd5d3beaa2b (diff) | |
| download | slapi-nis-d917e8e3d1f0361655bfd6190d0e1a99de8287bf.tar.gz slapi-nis-d917e8e3d1f0361655bfd6190d0e1a99de8287bf.tar.xz slapi-nis-d917e8e3d1f0361655bfd6190d0e1a99de8287bf.zip | |
- implement tcp_wrappers support
Diffstat (limited to 'src/plugin.c')
| -rw-r--r-- | src/plugin.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/plugin.c b/src/plugin.c index c35d0d7..d5e5e4e 100644 --- a/src/plugin.c +++ b/src/plugin.c @@ -40,6 +40,10 @@ #include <rpc/pmap_clnt.h> #include <rpcsvc/yp_prot.h> +#ifdef HAVE_TCPD_H +#include <tcpd.h> +#endif + #ifdef HAVE_DIRSRV_SLAPI_PLUGIN_H #include <nspr.h> #include <nss.h> @@ -161,6 +165,22 @@ plugin_state_init(Slapi_PBlock *pb, struct plugin_state **lstate) slapi_pblock_get(pb, SLAPI_PLUGIN_IDENTITY, &state->plugin_identity); slapi_pblock_get(pb, SLAPI_TARGET_DN, &state->plugin_base); +#ifdef HAVE_TCPD_H + state->request_info = malloc(sizeof(*(state->request_info))); + if ((state->request_info == NULL) || + (request_init(state->request_info, 0) != state->request_info) || + (request_set(state->request_info, + RQ_DAEMON, plugin_description.spd_id, + 0) != state->request_info)) { + slapi_log_error(SLAPI_LOG_PLUGIN, state->plugin_desc->spd_id, + "error initializing tcp_wrappers for \"%s\"\n", + plugin_description.spd_id); + return state; + } +#else + state->request_info = NULL; +#endif + /* Create a socket for use in communicating with the portmapper. */ sockfd = socket(PF_INET, SOCK_DGRAM, 0); if (sockfd == -1) { |
