summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Bokovoy <abokovoy@redhat.com>2013-07-31 14:26:55 +0300
committerAlexander Bokovoy <abokovoy@redhat.com>2013-08-05 15:35:22 +0300
commit7a232d34f5c23ea30ec00ae2584af8db1b061032 (patch)
tree8ac6e923a6d0068a1bd9898f1b12fc70bd5c7e5b
parentb32d84da5145efb0715b71c2ea2d563a068e6471 (diff)
downloadslapi-nis-7a232d34f5c23ea30ec00ae2584af8db1b061032.tar.gz
slapi-nis-7a232d34f5c23ea30ec00ae2584af8db1b061032.tar.xz
slapi-nis-7a232d34f5c23ea30ec00ae2584af8db1b061032.zip
back-sch: move structure definitions to back-sch.h to share with other code
NSSWITCH supporting code needs access to the schema-compat structures
-rw-r--r--src/Makefile.am1
-rw-r--r--src/back-sch.c34
-rw-r--r--src/back-sch.h95
3 files changed, 97 insertions, 33 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 6c8666b..0563171 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -51,6 +51,7 @@ nisserver_plugin_la_LIBADD = $(LDAP_LIBS) $(RUNTIME_LIBS) $(TIRPC_LIBS) $(LIBWRA
schemacompat_plugin_la_SOURCES = \
back-sch.c \
+ back-sch.h \
backend.h \
back-shr.c \
back-shr.h \
diff --git a/src/back-sch.c b/src/back-sch.c
index 142bdb9..0dc11c5 100644
--- a/src/back-sch.c
+++ b/src/back-sch.c
@@ -50,23 +50,10 @@
#include "format.h"
#include "plugin.h"
#include "map.h"
+#include "back-sch.h"
#define SCH_CONTAINER_CONFIGURATION_FILTER "(&(" SCH_CONTAINER_CONFIGURATION_GROUP_ATTR "=*)(" SCH_CONTAINER_CONFIGURATION_BASE_ATTR "=*)(" SCH_CONTAINER_CONFIGURATION_FILTER_ATTR "=*)(" SCH_CONTAINER_CONFIGURATION_RDN_ATTR "=*))"
-/* The data we ask the map cache to keep, for us, for each set. */
-struct backend_set_data {
- struct backend_shr_set_data common;
- /* Schema compatibility-specific data. */
- Slapi_DN *container_sdn;
- char *rdn_format;
- char **attribute_format;
- bool_t check_access;
-};
-struct backend_entry_data {
- Slapi_DN *original_entry_dn;
- Slapi_Entry *e;
-};
-
/* Read the name of the NIS master. A dummy function for the schema
* compatibility plugin. */
void
@@ -879,25 +866,6 @@ backend_update_params(Slapi_PBlock *pb, struct plugin_state *state)
slapi_entry_free(our_entry);
}
-/* Intercept a search request, and if it belongs to one of our compatibility
- * trees, answer from our cache before letting the default database have a
- * crack at it. */
-struct backend_search_cbdata {
- Slapi_PBlock *pb;
- struct plugin_state *state;
- char *target, *strfilter, **attrs;
- int scope, sizelimit, timelimit, attrsonly;
- bool_t check_access;
- Slapi_DN *target_dn;
- Slapi_Filter *filter;
-
- bool_t answer;
- int result;
- bool_t matched;
- char *closest_match, *text;
- int n_entries;
-};
-
static bool_t
backend_should_descend(Slapi_DN *this_dn, Slapi_DN *target_dn, int scope)
{
diff --git a/src/back-sch.h b/src/back-sch.h
new file mode 100644
index 0000000..14046e4
--- /dev/null
+++ b/src/back-sch.h
@@ -0,0 +1,95 @@
+/*
+ * Copyright 2013 Red Hat, Inc.
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This Program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this Program; if not, write to the
+ *
+ * Free Software Foundation, Inc.
+ * 59 Temple Place, Suite 330
+ * Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifndef back_sch_h
+#define back_sch_h
+
+enum sch_search_nsswitch_t {
+ SCH_NSSWITCH_NONE = 0,
+ SCH_NSSWITCH_USER,
+ SCH_NSSWITCH_GROUP
+};
+
+/* The data we ask the map cache to keep, for us, for each set. */
+struct backend_set_data {
+ struct backend_shr_set_data common;
+ /* Schema compatibility-specific data. */
+ Slapi_DN *container_sdn;
+ char *rdn_format;
+ char **attribute_format;
+ bool_t check_access;
+ enum sch_search_nsswitch_t check_nsswitch;
+ unsigned long nsswitch_min_id;
+};
+
+struct backend_entry_data {
+ Slapi_DN *original_entry_dn;
+ Slapi_Entry *e;
+};
+
+struct backend_staged_data {
+ struct backend_staged_data *next;
+ struct backend_set_data *set_data_fixup;
+ char *map_group, *map_set;
+ enum sch_search_nsswitch_t type;
+ bool_t is_id;
+ bool_t search_members;
+ char *name;
+ char *container_sdn;
+ int count;
+ Slapi_Entry **entries;
+};
+
+/* Intercept a search request, and if it belongs to one of our compatibility
+ * trees, answer from our cache before letting the default database have a
+ * crack at it. */
+struct backend_search_cbdata {
+ Slapi_PBlock *pb;
+ struct plugin_state *state;
+ char *target, *strfilter, **attrs;
+ int scope, sizelimit, timelimit, attrsonly;
+ bool_t check_access;
+ enum sch_search_nsswitch_t check_nsswitch;
+ Slapi_DN *target_dn;
+ Slapi_Filter *filter;
+ unsigned long nsswitch_min_id;
+ char *nsswitch_buffer;
+ ssize_t nsswitch_buffer_len;
+
+ bool_t answer;
+ int result;
+ bool_t matched;
+ char *closest_match, *text;
+ int n_entries;
+ struct backend_staged_data *staged;
+ struct backend_staged_data *cur_staged;
+};
+
+void backend_search_nsswitch(struct backend_set_data *set_data,
+ struct backend_search_cbdata *cbdata);
+
+bool_t backend_retrieve_from_nsswitch(struct backend_staged_data *staged,
+ struct backend_search_cbdata *cbdata);
+
+int backend_sch_do_pam_auth(Slapi_PBlock *pb, const char *username);
+
+
+#endif