summaryrefslogtreecommitdiff
path: root/source4/lib/ldb/common
diff options
context:
space:
mode:
Diffstat (limited to 'source4/lib/ldb/common')
-rw-r--r--source4/lib/ldb/common/ldb.c32
1 files changed, 19 insertions, 13 deletions
diff --git a/source4/lib/ldb/common/ldb.c b/source4/lib/ldb/common/ldb.c
index 1aae76bad6..760a311383 100644
--- a/source4/lib/ldb/common/ldb.c
+++ b/source4/lib/ldb/common/ldb.c
@@ -61,6 +61,21 @@ static struct ldb_backend {
ldb_connect_fn connect_fn;
struct ldb_backend *prev, *next;
} *ldb_backends = NULL;
+
+
+static ldb_connect_fn ldb_find_backend(const char *url)
+{
+ struct ldb_backend *backend;
+
+ for (backend = ldb_backends; backend; backend = backend->next) {
+ if (strncmp(backend->name, url, strlen(backend->name)) == 0) {
+ return backend->connect_fn;
+ }
+ }
+
+ return NULL;
+}
+
/*
register a new ldb backend
*/
@@ -68,6 +83,10 @@ int ldb_register_backend(const char *url_prefix, ldb_connect_fn connectfn)
{
struct ldb_backend *backend = talloc(talloc_autofree_context(), struct ldb_backend);
+ if (ldb_find_backend(url_prefix)) {
+ return LDB_SUCCESS;
+ }
+
/* Maybe check for duplicity here later on? */
backend->name = talloc_strdup(backend, url_prefix);
@@ -77,19 +96,6 @@ int ldb_register_backend(const char *url_prefix, ldb_connect_fn connectfn)
return LDB_SUCCESS;
}
-static ldb_connect_fn ldb_find_backend(const char *url)
-{
- struct ldb_backend *backend;
-
- for (backend = ldb_backends; backend; backend = backend->next) {
- if (strncmp(backend->name, url, strlen(backend->name)) == 0) {
- return backend->connect_fn;
- }
- }
-
- return NULL;
-}
-
/*
Return the ldb module form of a database. The URL can either be one of the following forms
ldb://path