diff options
author | Andrew Tridgell <tridge@samba.org> | 2010-11-01 12:32:18 +1100 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2010-11-01 18:55:18 +1100 |
commit | 8b63ff52e2442d457b5221f51cb9e85e4b94e298 (patch) | |
tree | 582abea1338458934880dab68bcececbcd371e10 /source4/lib/ldb/common/ldb.c | |
parent | fd6d29bc08cacbd5270599aab52e0006bea2002f (diff) | |
download | samba-8b63ff52e2442d457b5221f51cb9e85e4b94e298.tar.gz samba-8b63ff52e2442d457b5221f51cb9e85e4b94e298.tar.bz2 samba-8b63ff52e2442d457b5221f51cb9e85e4b94e298.zip |
s4-ldb: support a new type of ldb module loading
this supports module loading in ldb which uses the approach of "load
all modules in a directory". This is much more flexible than the
current module loading, as it will allow us to load modules for
command line parsing and authentication.
Modules are loaded from a colon separated path, in the environment
variable LDB_MODULES_PATH. If unset, it defaults to LDB_MODULESDIR.
Within each directory modules are loaded recursively (traversing down
the directory tree). The device/inode number of each module is
remembered to prevent us loading a module twice.
Each module is checked for a ldb_init_module() function with
dlsym(). If found, it is called with the ldb module version as an
argument.
Diffstat (limited to 'source4/lib/ldb/common/ldb.c')
-rw-r--r-- | source4/lib/ldb/common/ldb.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/source4/lib/ldb/common/ldb.c b/source4/lib/ldb/common/ldb.c index e2a3e603ce..f6189debe6 100644 --- a/source4/lib/ldb/common/ldb.c +++ b/source4/lib/ldb/common/ldb.c @@ -92,6 +92,16 @@ struct ldb_context *ldb_init(TALLOC_CTX *mem_ctx, struct tevent_context *ev_ctx) { struct ldb_context *ldb; int ret; + const char *modules_path = getenv("LDB_MODULES_PATH"); + + if (modules_path == NULL) { + modules_path = LDB_MODULESDIR; + } + + ret = ldb_modules_load(modules_path, LDB_VERSION); + if (ret != LDB_SUCCESS) { + return NULL; + } ldb = talloc_zero(mem_ctx, struct ldb_context); /* A new event context so that callers who don't want ldb |