s4-ldb: use ldb_set_modules_dir() to load additional ldb modules
authorAndrew Tridgell <tridge@samba.org>
Mon, 1 Nov 2010 11:48:16 +0000 (22:48 +1100)
committerAndrew Tridgell <tridge@samba.org>
Mon, 1 Nov 2010 13:47:33 +0000 (13:47 +0000)
this allows ldb_wrap to enable s4 modules in a standalone ldb install
without any additional installation

Autobuild-User: Andrew Tridgell <tridge@samba.org>
Autobuild-Date: Mon Nov  1 13:47:33 UTC 2010 on sn-devel-104

source4/lib/ldb/common/ldb_modules.c
source4/lib/ldb/include/ldb_private.h

index 5f01082e1dc8e0125290a5af702bc5aff751e96e..1eeede23f76109ef80a7097b15ae4f436e240f7b 100644 (file)
 #include "dlinklist.h"
 #include "system/dir.h"
 
-void ldb_set_modules_dir(struct ldb_context *ldb, const char *path)
-{
-       talloc_free(ldb->modules_dir);
-       ldb->modules_dir = talloc_strdup(ldb, path);
-}
-
 static char *ldb_modules_strdup_no_spaces(TALLOC_CTX *mem_ctx, const char *string)
 {
        size_t i, len;
@@ -978,6 +972,18 @@ static int ldb_modules_load_dir(const char *modules_dir, const char *version)
        return LDB_SUCCESS;
 }
 
+/* 
+   load any additional modules from the given directory 
+*/
+void ldb_set_modules_dir(struct ldb_context *ldb, const char *path)
+{
+       int ret = ldb_modules_load_dir(path, LDB_VERSION);
+       if (ret != LDB_SUCCESS) {
+               ldb_asprintf_errstring(ldb, "Failed to load modules from: %s\n", path);
+       }
+}
+
+
 /*
   load all modules static (builtin) modules
  */
index 04b6897e69428bf6cf412d9f14a944bf70d8e8d4..57d003b8402542ec1cd0a281c66acccb954f30ff 100644 (file)
@@ -118,8 +118,6 @@ struct ldb_context {
 
        unsigned int create_perms;
 
-       char *modules_dir;
-
        struct tevent_context *ev_ctx;
 
        bool prepare_commit_done;