diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile.am | 2 | ||||
-rw-r--r-- | src/backend.c | 30 | ||||
-rw-r--r-- | src/backend.h | 4 | ||||
-rw-r--r-- | src/defaults.c | 4 | ||||
-rw-r--r-- | src/defaults.h | 3 | ||||
-rw-r--r-- | src/dispatch.c | 14 | ||||
-rw-r--r-- | src/dummymap.c | 8 | ||||
-rw-r--r-- | src/format.c | 16 | ||||
-rw-r--r-- | src/format.h | 10 | ||||
-rw-r--r-- | src/map.c | 12 | ||||
-rw-r--r-- | src/map.h | 5 | ||||
-rw-r--r-- | src/nis.c | 12 | ||||
-rw-r--r-- | src/nis.h | 4 | ||||
-rw-r--r-- | src/plugin.c | 19 | ||||
-rw-r--r-- | src/plugin.h | 9 | ||||
-rw-r--r-- | src/portmap.c | 14 | ||||
-rw-r--r-- | src/portmap.h | 2 |
17 files changed, 112 insertions, 56 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index e18337e..645ea75 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -19,7 +19,7 @@ nis_plugin_la_SOURCES = \ plugin.c \ portmap.c -EXTRA_LTLIBRARIES = dummy-nis-plugin.la +noinst_LTLIBRARIES = dummy-nis-plugin.la dummy_nis_plugin_la_SOURCES = \ dispatch.c \ dummymap.c \ diff --git a/src/backend.c b/src/backend.c index 630f202..2c81b36 100644 --- a/src/backend.c +++ b/src/backend.c @@ -7,7 +7,15 @@ #include <string.h> #include <unistd.h> +#ifdef HAVE_DIRSRV_SLAPI_PLUGIN_H +#include <nspr.h> +#include <nss.h> #include <dirsrv/slapi-plugin.h> +#else +#include <slapi-plugin.h> +#endif + +#include <rpc/xdr.h> #include "backend.h" #include "plugin.h" @@ -425,7 +433,7 @@ backend_entry_matches_map(struct backend_map_data *map_data, * means that it must be contained by one of the bases of the map. */ entry_sdn = slapi_sdn_new_ndn_byref(slapi_entry_get_ndn(e)); if (entry_sdn == NULL) { - return PR_FALSE; + return FALSE; } else { /* Check each base in turn. */ for (i = 0; @@ -433,7 +441,7 @@ backend_entry_matches_map(struct backend_map_data *map_data, i++) { base_sdn = slapi_sdn_new_dn_byval(map_data->bases[i]); if (base_sdn == NULL) { - return PR_FALSE; + return FALSE; } else { if (slapi_sdn_scope_test(entry_sdn, base_sdn, @@ -450,22 +458,22 @@ backend_entry_matches_map(struct backend_map_data *map_data, } /* If we ran out of bases to check, it doesn't match. */ if ((map_data->bases == NULL) || (map_data->bases[i] == NULL)) { - return PR_FALSE; + return FALSE; } } /* If it's contained by a search base, compare it to the filter. */ filter = slapi_str2filter(map_data->filter); if (filter == NULL) { - return PR_FALSE; + return FALSE; } else { if (slapi_vattr_filter_test(pb, e, filter, 0) != 0) { /* Didn't match -- return. */ slapi_filter_free(filter, 1); - return PR_FALSE; + return FALSE; } slapi_filter_free(filter, 1); } - return PR_TRUE; + return TRUE; } /* Add any map entries which correspond to a directory server entry in this @@ -501,7 +509,7 @@ backend_add_entry_cb(const char *domain, const char *map, void *backend_data, map_data_unset_entry_id(map_data->state, map_data->domain, map_data->map, cbdata->dn); - return PR_TRUE; + return TRUE; } /* Pull out the key and value. */ @@ -540,7 +548,7 @@ backend_add_entry_cb(const char *domain, const char *map, void *backend_data, format_free_ndn_list(visited_dn_list); format_free_data(value); format_free_data(key); - return PR_TRUE; + return TRUE; } static int @@ -647,7 +655,7 @@ backend_modify_entry_cb(const char *domain, const char *map, void *backend_data, format_free_data(value); format_free_data(key); } - return PR_TRUE; + return TRUE; } static int @@ -801,7 +809,7 @@ backend_modrdn_entry_cb(const char *domain, const char *map, void *backend_data, format_free_data(value_post); format_free_data(key_post); - return PR_TRUE; + return TRUE; } static int @@ -856,7 +864,7 @@ backend_delete_entry_cb(const char *domain, const char *map, void *backend_data, map_data->domain, map_data->map, cbdata->dn); map_data_unset_entry_id(map_data->state, domain, map, cbdata->dn); - return PR_TRUE; + return TRUE; } /* Called by the server when a directory server entry is deleted. */ diff --git a/src/backend.h b/src/backend.h index 260204b..a76b0da 100644 --- a/src/backend.h +++ b/src/backend.h @@ -1,7 +1,9 @@ -/* Initialize maps. */ +#ifndef backend_h +#define backend_h struct plugin_state; struct slapi_pblock; int backend_read_master_name(struct plugin_state *state, char **master); void backend_free_master_name(struct plugin_state *state, char *master); void backend_startup(struct plugin_state *state); void backend_init(struct slapi_pblock *pb, struct plugin_state *state); +#endif diff --git a/src/defaults.c b/src/defaults.c index 43b229b..1185114 100644 --- a/src/defaults.c +++ b/src/defaults.c @@ -1,3 +1,7 @@ +#ifdef HAVE_CONFIG_H +#include "../config.h" +#endif + #include <string.h> #define DEFAULT_ENTRY_FILTER "(&(nisMapName=%m)(objectClass=nisObject))" diff --git a/src/defaults.h b/src/defaults.h index a4c8133..448e922 100644 --- a/src/defaults.h +++ b/src/defaults.h @@ -1,4 +1,7 @@ +#ifndef defaults_h +#define defaults_h void defaults_get_map_config(const char *mapname, const char **filter, const char **key_format, const char **value_format); +#endif diff --git a/src/dispatch.c b/src/dispatch.c index a880d8a..2f216ac 100644 --- a/src/dispatch.c +++ b/src/dispatch.c @@ -1,3 +1,7 @@ +#ifdef HAVE_CONFIG_H +#include "../config.h" +#endif + #include <sys/types.h> #include <sys/socket.h> #include <arpa/inet.h> @@ -11,13 +15,21 @@ #include <syslog.h> #include <unistd.h> +#ifdef HAVE_DIRSRV_SLAPI_PLUGIN_H +#include <nspr.h> +#include <nss.h> +#include <dirsrv/slapi-plugin.h> +#else +#include <slapi-plugin.h> +#endif + #include <rpc/rpc.h> #include <rpc/pmap_clnt.h> #include <rpcsvc/yp_prot.h> +#include "plugin.h" #include "dispatch.h" #include "nis.h" -#include "plugin.h" #include "portmap.h" #define MAX_CLIENT_IDLE (60 * 1000) diff --git a/src/dummymap.c b/src/dummymap.c index 35c3823..f093a10 100644 --- a/src/dummymap.c +++ b/src/dummymap.c @@ -8,6 +8,14 @@ #include <time.h> #include <unistd.h> +#ifdef HAVE_DIRSRV_SLAPI_PLUGIN_H +#include <nspr.h> +#include <nss.h> +#include <dirsrv/slapi-plugin.h> +#else +#include <slapi-plugin.h> +#endif + #include <rpc/rpc.h> #include "dispatch.h" diff --git a/src/format.c b/src/format.c index 305842b..948c767 100644 --- a/src/format.c +++ b/src/format.c @@ -1,8 +1,22 @@ +#ifdef HAVE_CONFIG_H +#include "../config.h" +#endif + #include <sys/types.h> -#include <rpcsvc/yp.h> #include <fnmatch.h> #include <regex.h> #include <stdlib.h> + +#ifdef HAVE_DIRSRV_SLAPI_PLUGIN_H +#include <nspr.h> +#include <nss.h> +#include <dirsrv/slapi-plugin.h> +#else +#include <slapi-plugin.h> +#endif + +#include <rpcsvc/yp.h> + #include "defaults.h" #include "format.h" #include "plugin.h" diff --git a/src/format.h b/src/format.h index 796eebb..8ccd9cf 100644 --- a/src/format.h +++ b/src/format.h @@ -1,7 +1,11 @@ -#include <dirsrv/slapi-plugin.h> +#ifndef defaults_h +#define defaults_h +struct slapi_pblock; +struct slapi_entry; struct plugin_state; void format_free_data(char *data); void format_free_ndn_list(char **ndn_list); char *format_get_data(struct plugin_state *state, - Slapi_PBlock *pb, Slapi_Entry *e, const char *fmt, - char ***visited_ndn_list); + struct slapi_pblock *pb, struct slapi_entry *e, + const char *fmt, char ***visited_ndn_list); +#endif @@ -10,11 +10,15 @@ #include <time.h> #include <unistd.h> -#include <rpc/rpc.h> - +#ifdef HAVE_DIRSRV_SLAPI_PLUGIN_H #include <nspr.h> -#include <secport.h> -#include <plarenas.h> +#include <nss.h> +#include <dirsrv/slapi-plugin.h> +#else +#include <slapi-plugin.h> +#endif + +#include <rpc/xdr.h> #include "backend.h" #include "dispatch.h" @@ -1,5 +1,5 @@ -#include <rpc/xdr.h> - +#ifndef map_h +#define map_h struct plugin_state; struct slapi_pblock; /* Functions to pull data out of maps. */ @@ -74,3 +74,4 @@ bool_t map_data_foreach_map(struct plugin_state *state, const char *domain_name, void *backend_data, void *cbdata), void *cbdata); +#endif @@ -11,6 +11,14 @@ #include <time.h> #include <unistd.h> +#ifdef HAVE_DIRSRV_SLAPI_PLUGIN_H +#include <nspr.h> +#include <nss.h> +#include <dirsrv/slapi-plugin.h> +#else +#include <slapi-plugin.h> +#endif + #include <rpc/rpc.h> #include <rpc/pmap_clnt.h> #include <rpcsvc/yp_prot.h> @@ -266,12 +274,12 @@ nis_maplist_cb(const char *domain, const char *mapname, next->map = strdup(mapname); if (next->map == NULL) { free(next); - return PR_TRUE; + return TRUE; } next->next = *list; *list = next; } - return PR_TRUE; + return TRUE; } static void nis_free_maplist_cb_result(struct ypmaplist **list) @@ -1,10 +1,8 @@ #ifndef nis_h #define nis_h -#include <sys/types.h> -#include <sys/socket.h> -#include "plugin.h" #include "dispatch.h" +struct plugin_state; struct dispatch_client_data; void nis_process_request(struct plugin_state *state, diff --git a/src/plugin.c b/src/plugin.c index f9e586d..7f49352 100644 --- a/src/plugin.c +++ b/src/plugin.c @@ -19,10 +19,13 @@ #include <rpc/pmap_clnt.h> #include <rpcsvc/yp_prot.h> +#ifdef HAVE_DIRSRV_SLAPI_PLUGIN_H #include <nspr.h> -#include <secport.h> -#include <plarenas.h> +#include <nss.h> #include <dirsrv/slapi-plugin.h> +#else +#include <slapi-plugin.h> +#endif #include "dispatch.h" #include "map.h" @@ -123,19 +126,13 @@ plugin_state_init(Slapi_PBlock *pb, struct plugin_state **lstate) { int sockfd = -1, err, i; struct plugin_state *state = NULL; - PLArenaPool *arena = NULL; struct sockaddr_in sin; struct sockaddr_in6 sin6; - arena = PORT_NewArena(sizeof(double)); - if (arena == NULL) { - goto failed; - } - state = PORT_ArenaZAlloc(arena, sizeof(*state)); + state = malloc(sizeof(*state)); if (state == NULL) { goto failed; } - state->arena = arena; state->plugin_base = NULL; state->plugin_desc = &plugin_description; slapi_pblock_get(pb, SLAPI_PLUGIN_IDENTITY, &state->plugin_identity); @@ -245,9 +242,7 @@ plugin_state_init(Slapi_PBlock *pb, struct plugin_state **lstate) return 0; failed: err = errno; - if (arena != NULL) { - PORT_FreeArena(arena, PR_TRUE); - } + free(state); errno = err; return -1; } diff --git a/src/plugin.h b/src/plugin.h index 0b3a653..230bad1 100644 --- a/src/plugin.h +++ b/src/plugin.h @@ -1,16 +1,7 @@ #ifndef plugin_h #define plugin_h -#include <sys/types.h> -#include <pthread.h> - -#include <nspr.h> -#include <secport.h> -#include <plarenas.h> -#include <dirsrv/slapi-plugin.h> - struct plugin_state { - PLArenaPool *arena; pthread_t tid; char *plugin_base; Slapi_ComponentId *plugin_identity; diff --git a/src/portmap.c b/src/portmap.c index fbd73f3..e3c26ce 100644 --- a/src/portmap.c +++ b/src/portmap.c @@ -4,15 +4,21 @@ #include <sys/types.h> #include <sys/socket.h> -#include <rpc/xdr.h> -#include <rpc/rpc_msg.h> -#include <rpc/pmap_prot.h> -#include <rpcsvc/yp_prot.h> #include <errno.h> #include <poll.h> #include <time.h> +#ifdef HAVE_DIRSRV_SLAPI_PLUGIN_H +#include <nspr.h> +#include <nss.h> #include <dirsrv/slapi-plugin.h> +#else +#include <slapi-plugin.h> +#endif + +#include <rpc/xdr.h> +#include <rpc/pmap_prot.h> +#include <rpcsvc/yp_prot.h> #include "portmap.h" diff --git a/src/portmap.h b/src/portmap.h index 1601b7b..18b7152 100644 --- a/src/portmap.h +++ b/src/portmap.h @@ -1,8 +1,6 @@ #ifndef portmap_h #define portmap_h -#include <rpc/xdr.h> - bool_t portmap_register(const char *log_id, int resv_sock, int program, int version, int protocol, int port); bool_t portmap_unregister(const char *log_id, |