svn commit: samba r25081 - in branches/SAMBA_4_0: . source/lib
source/lib/ldb source/lib/ldb/common source/lib/ldb/include
jelmer at samba.org
jelmer at samba.org
Tue Sep 11 15:42:21 GMT 2007
Author: jelmer
Date: 2007-09-11 15:42:19 +0000 (Tue, 11 Sep 2007)
New Revision: 25081
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=25081
Log:
Add modules_dir member to ldb_context that is used rather than a global
modulesdir setting. Samba always sets this to lp_modulesdir()/ldb
Modified:
branches/SAMBA_4_0/
branches/SAMBA_4_0/source/lib/db_wrap.c
branches/SAMBA_4_0/source/lib/ldb/common/ldb.c
branches/SAMBA_4_0/source/lib/ldb/common/ldb_modules.c
branches/SAMBA_4_0/source/lib/ldb/config.mk
branches/SAMBA_4_0/source/lib/ldb/include/ldb.h
branches/SAMBA_4_0/source/lib/ldb/include/ldb_private.h
Changeset:
Property changes on: branches/SAMBA_4_0
___________________________________________________________________
Name: bzr:revision-info
...skipped...
Name: bzr:revision-id:v3-trunk0
...skipped...
Modified: branches/SAMBA_4_0/source/lib/db_wrap.c
===================================================================
--- branches/SAMBA_4_0/source/lib/db_wrap.c 2007-09-11 14:56:43 UTC (rev 25080)
+++ branches/SAMBA_4_0/source/lib/db_wrap.c 2007-09-11 15:42:19 UTC (rev 25081)
@@ -120,6 +120,9 @@
return NULL;
}
+ ldb_set_modules_dir(ldb,
+ talloc_asprintf(ldb, "%s/ldb", lp_modulesdir()));
+
/* we want to use the existing event context if possible. This
relies on the fact that in smbd, everything is a child of
the main event_context */
Modified: branches/SAMBA_4_0/source/lib/ldb/common/ldb.c
===================================================================
--- branches/SAMBA_4_0/source/lib/ldb/common/ldb.c 2007-09-11 14:56:43 UTC (rev 25080)
+++ branches/SAMBA_4_0/source/lib/ldb/common/ldb.c 2007-09-11 15:42:19 UTC (rev 25081)
@@ -51,6 +51,7 @@
ldb_set_utf8_default(ldb);
ldb_set_create_perms(ldb, 0666);
+ ldb_set_modules_dir(ldb, LDB_MODULESDIR);
return ldb;
}
Modified: branches/SAMBA_4_0/source/lib/ldb/common/ldb_modules.c
===================================================================
--- branches/SAMBA_4_0/source/lib/ldb/common/ldb_modules.c 2007-09-11 14:56:43 UTC (rev 25080)
+++ branches/SAMBA_4_0/source/lib/ldb/common/ldb_modules.c 2007-09-11 15:42:19 UTC (rev 25081)
@@ -42,6 +42,12 @@
#define LDB_MODULE_PREFIX "modules:"
#define LDB_MODULE_PREFIX_LEN 8
+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)
{
int i, len;
@@ -203,22 +209,13 @@
char *path;
void *handle;
int (*init_fn) (void);
- char *modulesdir;
- if (getenv("LD_LDB_MODULE_PATH") != NULL) {
- modulesdir = talloc_strdup(ldb, getenv("LD_LDB_MODULE_PATH"));
- } else {
-#ifdef _SAMBA_BUILD_
- modulesdir = talloc_asprintf(ldb, "%s/ldb", dyn_MODULESDIR);
-#else
- modulesdir = talloc_strdup(ldb, MODULESDIR);
-#endif
- }
+ if (ldb->modules_dir == NULL)
+ return -1;
- path = talloc_asprintf(ldb, "%s/%s.%s", modulesdir, name, SHLIBEXT);
+ path = talloc_asprintf(ldb, "%s/%s.%s", ldb->modules_dir, name,
+ SHLIBEXT);
- talloc_free(modulesdir);
-
ldb_debug(ldb, LDB_DEBUG_TRACE, "trying to load %s from %s\n", name, path);
handle = dlopen(path, RTLD_NOW);
Modified: branches/SAMBA_4_0/source/lib/ldb/config.mk
===================================================================
--- branches/SAMBA_4_0/source/lib/ldb/config.mk 2007-09-11 14:56:43 UTC (rev 25080)
+++ branches/SAMBA_4_0/source/lib/ldb/config.mk 2007-09-11 15:42:19 UTC (rev 25081)
@@ -142,9 +142,16 @@
./lib/ldb/common/ldb_modules.o: lib/ldb/common/ldb_modules.c Makefile
@echo Compiling $<
@$(CC) `$(PERL) $(srcdir)/script/cflags.pl $@` $(CFLAGS) $(PICFLAG) \
- -DLDBMODULESDIR=\"$(MODULESDIR)/ldb\" -DSHLIBEXT=\"$(SHLIBEXT)\" \
+ -DSHLIBEXT=\"$(SHLIBEXT)\" \
-c $< -o $@
+./lib/ldb/common/ldb.o: lib/ldb/common/ldb.c Makefile
+ @echo Compiling $<
+ @$(CC) `$(PERL) $(srcdir)/script/cflags.pl $@` $(CFLAGS) $(PICFLAG) \
+ -DLDB_MODULESDIR=\"$(MODULESDIR)/ldb\" \
+ -c $< -o $@
+
+
################################################
# Start SUBSYSTEM ldb
[LIBRARY::LIBLDB]
Modified: branches/SAMBA_4_0/source/lib/ldb/include/ldb.h
===================================================================
--- branches/SAMBA_4_0/source/lib/ldb/include/ldb.h 2007-09-11 14:56:43 UTC (rev 25080)
+++ branches/SAMBA_4_0/source/lib/ldb/include/ldb.h 2007-09-11 15:42:19 UTC (rev 25081)
@@ -779,6 +779,7 @@
int ldb_set_timeout(struct ldb_context *ldb, struct ldb_request *req, int timeout);
int ldb_set_timeout_from_prev_req(struct ldb_context *ldb, struct ldb_request *oldreq, struct ldb_request *newreq);
void ldb_set_create_perms(struct ldb_context *ldb, unsigned int perms);
+void ldb_set_modules_dir(struct ldb_context *ldb, const char *path);
/**
Initialise ldbs' global information
@@ -876,7 +877,7 @@
\param ret_req the request structure is returned here (talloced on mem_ctx)
\param ldb the context associated with the database (from ldb_init())
- \param mem_ctx a talloc emmory context (used as parent of ret_req)
+ \param mem_ctx a talloc memory context (used as parent of ret_req)
\param base the Base Distinguished Name for the query (use ldb_dn_new() for an empty one)
\param scope the search scope for the query
\param expression the search expression to use for this query
@@ -904,7 +905,7 @@
\param ret_req the request structure is returned here (talloced on mem_ctx)
\param ldb the context associated with the database (from ldb_init())
- \param mem_ctx a talloc emmory context (used as parent of ret_req)
+ \param mem_ctx a talloc memory context (used as parent of ret_req)
\param message contains the entry to be added
\param controls an array of controls
\param context the callback function context
@@ -926,7 +927,7 @@
\param ret_req the request structure is returned here (talloced on mem_ctx)
\param ldb the context associated with the database (from ldb_init())
- \param mem_ctx a talloc emmory context (used as parent of ret_req)
+ \param mem_ctx a talloc memory context (used as parent of ret_req)
\param message contains the entry to be modified
\param controls an array of controls
\param context the callback function context
@@ -948,7 +949,7 @@
\param ret_req the request structure is returned here (talloced on mem_ctx)
\param ldb the context associated with the database (from ldb_init())
- \param mem_ctx a talloc emmory context (used as parent of ret_req)
+ \param mem_ctx a talloc memory context (used as parent of ret_req)
\param dn the DN to be deleted
\param controls an array of controls
\param context the callback function context
@@ -970,7 +971,7 @@
\param ret_req the request structure is returned here (talloced on mem_ctx)
\param ldb the context associated with the database (from ldb_init())
- \param mem_ctx a talloc emmory context (used as parent of ret_req)
+ \param mem_ctx a talloc memory context (used as parent of ret_req)
\param olddn the old DN
\param newdn the new DN
\param controls an array of controls
@@ -1137,7 +1138,7 @@
\param ret_req the request structure is returned here (talloced on mem_ctx)
\param ldb the context associated with the database (from ldb_init())
- \param mem_ctx a talloc emmory context (used as parent of ret_req)
+ \param mem_ctx a talloc memory context (used as parent of ret_req)
\param oid the OID of the extended operation.
\param data a void pointer a the extended operation specific parameters,
it needs to be NULL or a valid talloc pointer! talloc_get_type() will be used on it
Modified: branches/SAMBA_4_0/source/lib/ldb/include/ldb_private.h
===================================================================
--- branches/SAMBA_4_0/source/lib/ldb/include/ldb_private.h 2007-09-11 14:56:43 UTC (rev 25080)
+++ branches/SAMBA_4_0/source/lib/ldb/include/ldb_private.h 2007-09-11 15:42:19 UTC (rev 25081)
@@ -120,6 +120,8 @@
unsigned int flags;
unsigned int create_perms;
+
+ char *modules_dir;
};
#ifndef ARRAY_SIZE
More information about the samba-cvs
mailing list