summaryrefslogtreecommitdiff
path: root/source4/dsdb/samdb/ldb_modules/samba3sam.c
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2006-08-13 23:58:04 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:15:33 -0500
commit027583e6de2a6981d1c0e8959e1e37bf758be8f9 (patch)
treef256de0bd3edae21364179eb752b51f98e0bbb2d /source4/dsdb/samdb/ldb_modules/samba3sam.c
parentcf863ef3e37a52de35ec848fa84b129ecb4491ec (diff)
downloadsamba-027583e6de2a6981d1c0e8959e1e37bf758be8f9.tar.gz
samba-027583e6de2a6981d1c0e8959e1e37bf758be8f9.tar.bz2
samba-027583e6de2a6981d1c0e8959e1e37bf758be8f9.zip
r17525: This is a merge from the Google Summer of Code 2006 project by Martin Kühl
<mkhl@samba.org>. Martin took over the work done last year by Jelmer, in last year's SoC. This was a substanital task, as the the ldb modules API changed significantly during the past year, with the addition of async calls. This changeset reimplements and enables the ldb_map ldb module and adapts the example module and test case, both named samba3sam, to the implementation. The ldb_map module supports splitting an ldb database into two parts (called the "local" and "remote" part) and storing the data in one of them (the remote database) in a different format while the other acts as a fallback. This allows ldb to e.g. store to and load data from a remote LDAP server and present it according to the Samba4 schema while still allowing the LDAP to present and modify its data separately. A complex example of this is the samba3sam module (by Jelmer Vernooij), which maps data between the samba3 and samba4 schemas. A simpler example is given by the entryUUID module (by Andrew Bartlett), which handles some of the differences between AD and OpenLDAP in operational attributes. It principally maps objectGUID, to and from entryUUID elements. This is also an example of a module that doesn't use the local backend as fallback storage. This merge also splits the ldb_map.c file into smaller, more manageable parts. (This used to be commit af2bece4d343a9f787b2e3628848b266cec2b9f0)
Diffstat (limited to 'source4/dsdb/samdb/ldb_modules/samba3sam.c')
-rw-r--r--source4/dsdb/samdb/ldb_modules/samba3sam.c35
1 files changed, 33 insertions, 2 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/samba3sam.c b/source4/dsdb/samdb/ldb_modules/samba3sam.c
index 80cedb7b08..670d9ef0d8 100644
--- a/source4/dsdb/samdb/ldb_modules/samba3sam.c
+++ b/source4/dsdb/samdb/ldb_modules/samba3sam.c
@@ -5,11 +5,17 @@
*/
#include "includes.h"
-#include "ldb/modules/ldb_map.h"
#include "ldb/include/ldb.h"
#include "ldb/include/ldb_private.h"
+#include "ldb/include/ldb_errors.h"
+#include "ldb/modules/ldb_map.h"
#include "system/passwd.h"
+#include "librpc/gen_ndr/ndr_security.h"
+#include "librpc/ndr/libndr.h"
+#include "libcli/security/security.h"
+#include "libcli/security/proto.h"
+
/*
* sambaSID -> member (dn!)
* sambaSIDList -> member (dn!)
@@ -855,8 +861,33 @@ const struct ldb_map_attribute samba3_attributes[] =
}
};
+/* the context init function */
+static int samba3sam_init(struct ldb_module *module)
+{
+ int ret;
+
+ ret = ldb_map_init(module, samba3_attributes, samba3_objectclasses, "samba3sam");
+ if (ret != LDB_SUCCESS)
+ return ret;
+
+ return ldb_next_init(module);
+}
+
+static struct ldb_module_ops samba3sam_ops = {
+ .name = "samba3sam",
+ .init_context = samba3sam_init,
+};
+
/* the init function */
int ldb_samba3sam_module_init(void)
{
- return ldb_map_init(ldb, samba3_attributes, samba3_objectclasses, "samba3sam");
+ struct ldb_module_ops ops = ldb_map_get_ops();
+ samba3sam_ops.add = ops.add;
+ samba3sam_ops.modify = ops.modify;
+ samba3sam_ops.del = ops.del;
+ samba3sam_ops.rename = ops.rename;
+ samba3sam_ops.search = ops.search;
+ samba3sam_ops.wait = ops.wait;
+
+ return ldb_register_module(&samba3sam_ops);
}