summaryrefslogtreecommitdiff
path: root/source4/lib/ldb/common
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2004-11-16 09:00:52 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:05:52 -0500
commit8a18778286a16423d7d6e483fdb308a91e294efe (patch)
treeb1cf6a44c1cb4deccb04897ab426a724204b3f52 /source4/lib/ldb/common
parente81157c7379116d83b9906e27c9fd418c779d129 (diff)
downloadsamba-8a18778286a16423d7d6e483fdb308a91e294efe.tar.gz
samba-8a18778286a16423d7d6e483fdb308a91e294efe.tar.bz2
samba-8a18778286a16423d7d6e483fdb308a91e294efe.zip
r3783: - don't use make proto for ldb anymore
- split ldh.h out of samba's includes.h - make ldb_context and ldb_module private to the subsystem - use ltdb_ prefix for all ldb_tdb functions metze (This used to be commit f5ee40d6ce8224e280070975efc9911558fe675c)
Diffstat (limited to 'source4/lib/ldb/common')
-rw-r--r--source4/lib/ldb/common/ldb.c2
-rw-r--r--source4/lib/ldb/common/ldb_alloc.c4
-rw-r--r--source4/lib/ldb/common/ldb_debug.c2
-rw-r--r--source4/lib/ldb/common/ldb_ldif.c2
-rw-r--r--source4/lib/ldb/common/ldb_modules.c10
-rw-r--r--source4/lib/ldb/common/ldb_msg.c27
-rw-r--r--source4/lib/ldb/common/ldb_parse.c2
-rw-r--r--source4/lib/ldb/common/ldb_utf8.c2
-rw-r--r--source4/lib/ldb/common/util.c2
9 files changed, 48 insertions, 5 deletions
diff --git a/source4/lib/ldb/common/ldb.c b/source4/lib/ldb/common/ldb.c
index 4fe2088daf..0fb371011f 100644
--- a/source4/lib/ldb/common/ldb.c
+++ b/source4/lib/ldb/common/ldb.c
@@ -33,6 +33,8 @@
*/
#include "includes.h"
+#include "ldb/include/ldb.h"
+#include "ldb/include/ldb_private.h"
/*
connect to a database. The URL can either be one of the following forms
diff --git a/source4/lib/ldb/common/ldb_alloc.c b/source4/lib/ldb/common/ldb_alloc.c
index 0053c5e73f..7dc12b142e 100644
--- a/source4/lib/ldb/common/ldb_alloc.c
+++ b/source4/lib/ldb/common/ldb_alloc.c
@@ -33,6 +33,8 @@
*/
#include "includes.h"
+#include "ldb/include/ldb.h"
+#include "ldb/include/ldb_private.h"
/*
@@ -122,7 +124,7 @@ void *ldb_strdup(struct ldb_context *ldb, const char *str)
/*
a ldb wrapper for asprintf(), using ldb_malloc()
*/
-int ldb_asprintf(struct ldb_context *ldb, char **strp, const char *fmt, ...) _PRINTF_ATTRIBUTE(3, 4)
+int ldb_asprintf(struct ldb_context *ldb, char **strp, const char *fmt, ...)
{
int len, len2;
va_list ap;
diff --git a/source4/lib/ldb/common/ldb_debug.c b/source4/lib/ldb/common/ldb_debug.c
index 0a187cd62d..6ba3f30b2d 100644
--- a/source4/lib/ldb/common/ldb_debug.c
+++ b/source4/lib/ldb/common/ldb_debug.c
@@ -33,6 +33,8 @@
*/
#include "includes.h"
+#include "ldb/include/ldb.h"
+#include "ldb/include/ldb_private.h"
/*
diff --git a/source4/lib/ldb/common/ldb_ldif.c b/source4/lib/ldb/common/ldb_ldif.c
index 01706304d9..bd99468182 100644
--- a/source4/lib/ldb/common/ldb_ldif.c
+++ b/source4/lib/ldb/common/ldb_ldif.c
@@ -37,6 +37,8 @@
*/
#include "includes.h"
+#include "ldb/include/ldb.h"
+#include "ldb/include/ldb_private.h"
#include <ctype.h>
diff --git a/source4/lib/ldb/common/ldb_modules.c b/source4/lib/ldb/common/ldb_modules.c
index 37be07c1ca..1a6a334b8d 100644
--- a/source4/lib/ldb/common/ldb_modules.c
+++ b/source4/lib/ldb/common/ldb_modules.c
@@ -34,6 +34,8 @@
*/
#include "includes.h"
+#include "ldb/include/ldb.h"
+#include "ldb/include/ldb_private.h"
#include "dlinklist.h"
#include <sys/types.h>
#include <sys/stat.h>
@@ -82,10 +84,10 @@ int ldb_load_modules(struct ldb_context *ldb, const char *options[])
if (!modules && strcmp("ldap", ldb->modules->ops->name)) { /* no modules in the options, look for @MODULES in the db (not for ldap) */
int ret, j, k;
- char * attrs[] = { "@MODULE" };
+ const char * const attrs[] = { "@MODULE" , NULL};
struct ldb_message **msg;
- ret = ldb_search(ldb, "", LDB_SCOPE_BASE, "dn=@MODULES", (const char * const *)attrs, &msg);
+ ret = ldb_search(ldb, "", LDB_SCOPE_BASE, "dn=@MODULES", attrs, &msg);
if (ret == 0) {
ldb_debug(ldb, LDB_DEBUG_TRACE, "no modules required by the db\n");
} else {
@@ -144,7 +146,7 @@ int ldb_load_modules(struct ldb_context *ldb, const char *options[])
#ifdef HAVE_DLOPEN_DISABLED
{
void *handle;
- init_ldb_module_function init;
+ ldb_module_init_function init;
struct stat st;
const char *errstr;
@@ -160,7 +162,7 @@ int ldb_load_modules(struct ldb_context *ldb, const char *options[])
return -1;
}
- init = (init_ldb_module_function)dlsym(handle, "init_module");
+ init = (ldb_module_init_function)dlsym(handle, "init_module");
errstr = dlerror();
if (errstr) {
diff --git a/source4/lib/ldb/common/ldb_msg.c b/source4/lib/ldb/common/ldb_msg.c
index 170a7ae5e4..18859c86dd 100644
--- a/source4/lib/ldb/common/ldb_msg.c
+++ b/source4/lib/ldb/common/ldb_msg.c
@@ -33,6 +33,8 @@
*/
#include "includes.h"
+#include "ldb/include/ldb.h"
+#include "ldb/include/ldb_private.h"
/*
@@ -83,6 +85,31 @@ struct ldb_val *ldb_msg_find_val(const struct ldb_message_element *el,
return NULL;
}
+/*
+ duplicate a ldb_val structure
+*/
+struct ldb_val ldb_val_dup(struct ldb_context *ldb,
+ const struct ldb_val *v)
+{
+ struct ldb_val v2;
+ v2.length = v->length;
+ if (v->length == 0) {
+ v2.data = NULL;
+ return v2;
+ }
+
+ /* the +1 is to cope with buggy C library routines like strndup
+ that look one byte beyond */
+ v2.data = ldb_malloc(ldb, v->length+1);
+ if (!v2.data) {
+ v2.length = 0;
+ return v2;
+ }
+
+ memcpy(v2.data, v->data, v->length);
+ ((char *)v2.data)[v->length] = 0;
+ return v2;
+}
/*
add an empty element to a message
diff --git a/source4/lib/ldb/common/ldb_parse.c b/source4/lib/ldb/common/ldb_parse.c
index feec8fc0f2..1e00a05d55 100644
--- a/source4/lib/ldb/common/ldb_parse.c
+++ b/source4/lib/ldb/common/ldb_parse.c
@@ -42,6 +42,8 @@
*/
#include "includes.h"
+#include "ldb/include/ldb.h"
+#include "ldb/include/ldb_private.h"
#include "ldb/include/ldb_parse.h"
#include <ctype.h>
diff --git a/source4/lib/ldb/common/ldb_utf8.c b/source4/lib/ldb/common/ldb_utf8.c
index e92d318bae..01bd8eb9ac 100644
--- a/source4/lib/ldb/common/ldb_utf8.c
+++ b/source4/lib/ldb/common/ldb_utf8.c
@@ -33,6 +33,8 @@
*/
#include "includes.h"
+#include "ldb/include/ldb.h"
+#include "ldb/include/ldb_private.h"
#include <ctype.h>
/*
diff --git a/source4/lib/ldb/common/util.c b/source4/lib/ldb/common/util.c
index c8aa5019e2..af738f352a 100644
--- a/source4/lib/ldb/common/util.c
+++ b/source4/lib/ldb/common/util.c
@@ -33,6 +33,8 @@
*/
#include "includes.h"
+#include "ldb/include/ldb.h"
+#include "ldb/include/ldb_private.h"
/*