svn commit: samba r18830 - in branches/SAMBA_4_0/source/lib/ldb/common: .

tridge at samba.org tridge at samba.org
Fri Sep 22 23:21:37 GMT 2006


Author: tridge
Date: 2006-09-22 23:21:36 +0000 (Fri, 22 Sep 2006)
New Revision: 18830

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=18830

Log:

ensure backends aren't added twice (needed for samba3)

Modified:
   branches/SAMBA_4_0/source/lib/ldb/common/ldb.c


Changeset:
Modified: branches/SAMBA_4_0/source/lib/ldb/common/ldb.c
===================================================================
--- branches/SAMBA_4_0/source/lib/ldb/common/ldb.c	2006-09-22 20:00:49 UTC (rev 18829)
+++ branches/SAMBA_4_0/source/lib/ldb/common/ldb.c	2006-09-22 23:21:36 UTC (rev 18830)
@@ -61,6 +61,21 @@
 	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 @@
 {
 	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 @@
 	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



More information about the samba-cvs mailing list