summaryrefslogtreecommitdiff
path: root/source4/lib/ldb/ldb_tdb
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2004-04-10 20:18:22 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:51:11 -0500
commitac193579e7db00c7a2ea0aadaaf0d34c10dcf1a5 (patch)
treebcd9a0afdc2996df4a56479932b7d36d32c50f8d /source4/lib/ldb/ldb_tdb
parent91b30df39bfaec8bfa32be40a13fd62008f66b9e (diff)
downloadsamba-ac193579e7db00c7a2ea0aadaaf0d34c10dcf1a5.tar.gz
samba-ac193579e7db00c7a2ea0aadaaf0d34c10dcf1a5.tar.bz2
samba-ac193579e7db00c7a2ea0aadaaf0d34c10dcf1a5.zip
r152: a quick airport commit ....
added ldbedit, a _really_ useful command added ldbadd, ldbdel, ldbsearch and ldbmodify to build solved lots of timezone issues, we now pass the torture tests with client and server in different zones fixed several build issues I know this breaks the no-LDAP build. Wait till I arrive in San Jose for that fix. (This used to be commit af34710d4da1841653624fe304b1c8d812c0fdd9)
Diffstat (limited to 'source4/lib/ldb/ldb_tdb')
-rw-r--r--source4/lib/ldb/ldb_tdb/ldb_pack.c2
-rw-r--r--source4/lib/ldb/ldb_tdb/ldb_search.c36
-rw-r--r--source4/lib/ldb/ldb_tdb/ldb_tdb.c2
-rw-r--r--source4/lib/ldb/ldb_tdb/ldb_tdb.h4
4 files changed, 14 insertions, 30 deletions
diff --git a/source4/lib/ldb/ldb_tdb/ldb_pack.c b/source4/lib/ldb/ldb_tdb/ldb_pack.c
index 5964e0751d..1196e561a2 100644
--- a/source4/lib/ldb/ldb_tdb/ldb_pack.c
+++ b/source4/lib/ldb/ldb_tdb/ldb_pack.c
@@ -33,7 +33,7 @@
*/
#include "includes.h"
-#include "ldb_tdb.h"
+#include "ldb/ldb_tdb/ldb_tdb.h"
/* change this if the data format ever changes */
#define LTDB_PACKING_FORMAT 0x26011966
diff --git a/source4/lib/ldb/ldb_tdb/ldb_search.c b/source4/lib/ldb/ldb_tdb/ldb_search.c
index 5905231b32..9cb5853c94 100644
--- a/source4/lib/ldb/ldb_tdb/ldb_search.c
+++ b/source4/lib/ldb/ldb_tdb/ldb_search.c
@@ -33,7 +33,7 @@
*/
#include "includes.h"
-#include "ldb_tdb.h"
+#include "ldb/ldb_tdb/ldb_tdb.h"
/*
free a message that has all parts separately allocated
@@ -56,22 +56,6 @@ static void msg_free_all_parts(struct ldb_message *msg)
/*
- TODO: this should take advantage of the sorted nature of the message
-
- return index of the attribute, or -1 if not found
-*/
-int ldb_msg_find_attr(const struct ldb_message *msg, const char *attr)
-{
- int i;
- for (i=0;i<msg->num_elements;i++) {
- if (strcmp(msg->elements[i].name, attr) == 0) {
- return i;
- }
- }
- return -1;
-}
-
-/*
duplicate a ldb_val structure
*/
struct ldb_val ldb_val_dup(const struct ldb_val *v)
@@ -193,7 +177,7 @@ static struct ldb_message *ltdb_pull_attrs(struct ldb_context *ldb,
}
for (i=0;attrs[i];i++) {
- int j;
+ struct ldb_message_element *el;
if (strcmp(attrs[i], "*") == 0) {
if (msg_add_all_elements(ret, msg) != 0) {
@@ -202,17 +186,15 @@ static struct ldb_message *ltdb_pull_attrs(struct ldb_context *ldb,
}
continue;
}
- j = ldb_msg_find_attr(msg, attrs[i]);
- if (j == -1) {
+
+ el = ldb_msg_find_element(msg, attrs[i]);
+ if (!el) {
continue;
}
- do {
- if (msg_add_element(ret, &msg->elements[j]) != 0) {
- msg_free_all_parts(ret);
- return NULL;
- }
- } while (++j < msg->num_elements &&
- strcmp(attrs[i], msg->elements[j].name) == 0);
+ if (msg_add_element(ret, el) != 0) {
+ msg_free_all_parts(ret);
+ return NULL;
+ }
}
return ret;
diff --git a/source4/lib/ldb/ldb_tdb/ldb_tdb.c b/source4/lib/ldb/ldb_tdb/ldb_tdb.c
index ec90eec03f..b28d73cbea 100644
--- a/source4/lib/ldb/ldb_tdb/ldb_tdb.c
+++ b/source4/lib/ldb/ldb_tdb/ldb_tdb.c
@@ -33,7 +33,7 @@
*/
#include "includes.h"
-#include "ldb_tdb.h"
+#include "ldb/ldb_tdb/ldb_tdb.h"
/*
form a TDB_DATA for a record key
diff --git a/source4/lib/ldb/ldb_tdb/ldb_tdb.h b/source4/lib/ldb/ldb_tdb/ldb_tdb.h
index 30afe223ea..efb0af1c9c 100644
--- a/source4/lib/ldb/ldb_tdb/ldb_tdb.h
+++ b/source4/lib/ldb/ldb_tdb/ldb_tdb.h
@@ -5,7 +5,9 @@ struct ltdb_private {
unsigned int connect_flags;
};
-#ifdef STANDALONE
+#ifndef IVAL
#define IVAL(p, ofs) (((unsigned *)((char *)(p) + (ofs)))[0])
+#endif
+#ifndef SIVAL
#define SIVAL(p, ofs, v) do { IVAL(p, ofs) = (v); } while (0)
#endif