summaryrefslogtreecommitdiff
path: root/source4/lib/ldb/modules/ldb_map.h
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2005-08-30 11:08:03 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:35:01 -0500
commitf9447d2a17089178d311e03e398c25c749450f6d (patch)
treeb4a8fb75612f10bf12b076ba1b5cae347a295948 /source4/lib/ldb/modules/ldb_map.h
parent391f9aaf0571c54a9748247cb4a2b1ee437eaef4 (diff)
downloadsamba-f9447d2a17089178d311e03e398c25c749450f6d.tar.gz
samba-f9447d2a17089178d311e03e398c25c749450f6d.tar.bz2
samba-f9447d2a17089178d311e03e398c25c749450f6d.zip
r9786: Move ldb_map into ldb/modules/
Move samba3sam to dsdb/ (This used to be commit eb9d615bcd49328131613f64745760a90553b7f2)
Diffstat (limited to 'source4/lib/ldb/modules/ldb_map.h')
-rw-r--r--source4/lib/ldb/modules/ldb_map.h108
1 files changed, 108 insertions, 0 deletions
diff --git a/source4/lib/ldb/modules/ldb_map.h b/source4/lib/ldb/modules/ldb_map.h
new file mode 100644
index 0000000000..02fec649c6
--- /dev/null
+++ b/source4/lib/ldb/modules/ldb_map.h
@@ -0,0 +1,108 @@
+/*
+ ldb database library - map backend
+
+ Copyright (C) Jelmer Vernooij 2005
+
+ ** NOTE! The following LGPL license applies to the ldb
+ ** library. This does NOT imply that all of Samba is released
+ ** under the LGPL
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+
+#ifndef __LDB_MAP_H__
+#define __LDB_MAP_H__
+
+/* ldb_map is a skeleton LDB module that can be used for any other modules
+ * that need to map attributes.
+ *
+ * The term 'remote' in this header refers to the connection where the
+ * original schema is used on while 'local' means the local connection
+ * that any upper layers will use.
+ *
+ * All local attributes will have to have a definition. Not all remote
+ * attributes need a definition as LDB is a lot less stricter then LDAP
+ * (in other words, sending unknown attributes to an LDAP server hurts us,
+ * returning too much attributes in ldb_search() doesn't)
+ */
+
+struct ldb_map_context;
+
+struct ldb_map_attribute
+{
+ const char *local_name; /* local name */
+
+ enum ldb_map_attr_type {
+ MAP_IGNORE, /* Ignore this local attribute. Doesn't exist remotely. */
+ MAP_KEEP, /* Keep as is. Same name locally and remotely. */
+ MAP_RENAME, /* Simply rename the attribute. Name changes, data is the same */
+ MAP_CONVERT, /* Rename + convert data */
+ MAP_GENERATE /* Use generate function for generating new name/data.
+ Used for generating attributes based on
+ multiple remote attributes. */
+ } type;
+
+ /* if set, will be called for expressions that contain this attribute */
+ struct ldb_parse_tree *(*convert_operator) (struct ldb_map_context *, TALLOC_CTX *ctx, const struct ldb_parse_tree *);
+
+ union {
+ struct {
+ const char *remote_name;
+ } rename;
+
+ struct {
+ const char *remote_name;
+ struct ldb_val (*convert_local) (struct ldb_map_context *, TALLOC_CTX *, const struct ldb_val *);
+ struct ldb_val (*convert_remote) (struct ldb_map_context *, TALLOC_CTX *, const struct ldb_val *);
+ } convert;
+
+ struct {
+ /* Generate the local attribute from remote message */
+ struct ldb_message_element *(*generate_local) (
+ struct ldb_map_context *,
+ TALLOC_CTX *ctx,
+ const char *attr,
+ const struct ldb_message *remote);
+
+ /* Update remote message with information from local message */
+ void (*generate_remote) (
+ struct ldb_map_context *,
+ const char *local_attr,
+ const struct ldb_message *local,
+ struct ldb_message *remote);
+
+ /* Name(s) for this attribute on the remote server. This is an array since
+ * one local attribute's data can be split up into several attributes
+ * remotely */
+#define LDB_MAP_MAX_REMOTE_NAMES 10
+ const char *remote_names[LDB_MAP_MAX_REMOTE_NAMES];
+ } generate;
+ } u;
+};
+
+struct ldb_map_objectclass
+{
+ const char *local_name;
+ const char *remote_name;
+};
+
+struct ldb_map_context
+{
+ struct ldb_map_attribute *attribute_maps;
+ const struct ldb_map_objectclass *objectclass_maps;
+ struct ldb_context *mapped_ldb;
+};
+
+#endif /* __LDB_MAP_H__ */