1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-12 09:18:10 +03:00

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

This commit is contained in:
Andrew Tridgell 2006-09-22 23:21:36 +00:00 committed by Gerald (Jerry) Carter
parent 77f1c15d92
commit 54b864b491

View File

@ -61,21 +61,7 @@ static struct ldb_backend {
ldb_connect_fn connect_fn;
struct ldb_backend *prev, *next;
} *ldb_backends = NULL;
/*
register a new ldb backend
*/
int ldb_register_backend(const char *url_prefix, ldb_connect_fn connectfn)
{
struct ldb_backend *backend = talloc(talloc_autofree_context(), struct ldb_backend);
/* Maybe check for duplicity here later on? */
backend->name = talloc_strdup(backend, url_prefix);
backend->connect_fn = connectfn;
DLIST_ADD(ldb_backends, backend);
return LDB_SUCCESS;
}
static ldb_connect_fn ldb_find_backend(const char *url)
{
@ -90,6 +76,26 @@ static ldb_connect_fn ldb_find_backend(const char *url)
return NULL;
}
/*
register a new ldb backend
*/
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);
backend->connect_fn = connectfn;
DLIST_ADD(ldb_backends, backend);
return LDB_SUCCESS;
}
/*
Return the ldb module form of a database. The URL can either be one of the following forms
ldb://path