1
0
mirror of https://github.com/samba-team/samba.git synced 2025-11-07 12:23:51 +03:00
Commit Graph

49 Commits

Author SHA1 Message Date
Simo Sorce
22c8c97e6f r11567: Ldb API change patch.
This patch changes the way lsb_search is called and the meaning of the returned integer.
The last argument of ldb_search is changed from struct ldb_message to struct ldb_result
which contains a pointer to a struct ldb_message list and a count of the number of messages.
The return is not the count of messages anymore but instead it is an ldb error value.

I tryed to keep the patch as tiny as possible bu as you can guess I had to change a good
amount of places. I also tried to double check all my changes being sure that the calling
functions would still behave as before. But this patch is big enough that I fear some bug
may have been introduced anyway even if it passes the test suite. So if you are currently
working on any file being touched please give it a deep look and blame me for any error.

Simo.
2007-10-10 13:45:53 -05:00
Andrew Tridgell
f6818daecc r10913: This patch isn't as big as it looks ...
most of the changes are fixes to make all the ldb code compile without
warnings on gcc4. Unfortunately That required a lot of casts :-(

I have also added the start of an 'operational' module, which will
replace the timestamp module, plus add support for some other
operational attributes

In ldb_msg_*() I added some new utility functions to make the
operational module sane, and remove the 'ldb' argument from the
ldb_msg_add_*() functions. That argument was only needed back in the
early days of ldb when we didn't use the hierarchical talloc and thus
needed a place to get the allocation function from. Now its just a
pain to pass around everywhere.

Also added a ldb_debug_set() function that calls ldb_debug() plus sets
the result using ldb_set_errstring(). That saves on some awkward
coding in a few places.
2007-10-10 13:39:41 -05:00
Andrew Tridgell
7684cdb47b r10892: - improved the handling of the special distinguishedName attribute
- ensure we don't add attributes twice, should a user ask for the
  attribute twice. Do this in such a way that we don't become O(n^2)

- removed some unused code
2007-10-10 13:39:40 -05:00
Andrew Tridgell
40d304140b r10889: make searches for dn's less of a special case, and much faster when
part of more complex expressions
2007-10-10 13:39:39 -05:00
Andrew Tridgell
7e44f9153c r10753: don't require every ldb module to implement both a search_bytree() and
a search() function, instead each module now only implements the
bytree method, and the expression based search is handled generically
by the modules code. This makes for more consistency and less code
duplication.

fixed the tdb backend to handle BASE searches much more
efficiently. They now always only lookup one record, regardless of the
search expression
2007-10-10 13:39:26 -05:00
Andrew Tridgell
26ff538578 r10667: cope with a NULL tree for base searches in ldb_search() 2007-10-10 13:39:16 -05:00
Andrew Tridgell
ddff66298f r10422: ldb_search() can now use tdb_traverse_read() to ensure it can run in
parallel with any transaction
2007-10-10 13:38:44 -05:00
Andrew Tridgell
1b8d368a67 r10408: now that we are using tdb transactions we don't need any additional
locking code in the ldb_tdb backend, except for a single read lock
during searches to ensure searches don't cross transaction boundaries

The tdb transactions code would map these extra locks to noops anyway
(as locking makes no sense inside a transaction), but the work in
setting up the locking keys still costs something, and it makes the
code needlessly complex
2007-10-10 13:38:42 -05:00
Simo Sorce
3fc676ac1d r10305: start implementing better error handling
changed the prioivate modules API
error string are now not spread over all
modules but are kept in  a single place.

This allows a better control of memory
and error reporting.
2007-10-10 13:38:16 -05:00
Simo Sorce
4357a2db5e r10251: some more work on ldb_sqlite3
I must say that writing a new module is a very good way
to find lot of subtle bugs laying in the code

We need more tests!

commit oLschema2ldif.c to keep it safe from data losses (rm -fr :-)

update test generic to reflect the fix made on comparsion functions
2007-10-10 13:38:11 -05:00
Simo Sorce
692e35b779 r9391: Convert all the code to use struct ldb_dn to ohandle ldap like distinguished names
Provide more functions to handle DNs in this form
2007-10-10 13:33:32 -05:00
Simo Sorce
1d40461362 r8779: Add rdn module to makefile and headers
Search by distinguishedName as if searching by dn
2007-10-10 13:30:04 -05:00
Andrew Tridgell
7b37923b72 r8736: this fixes the ldb speed (raises BENCH-WINS from 15 ops/sec to over 4000)
simo, we need to be careful to cope with this sort of direct dn query efficiently
2007-10-10 13:30:00 -05:00
Simo Sorce
4eb5863042 r8373: New wildcard matching code.
This code applies correct ldap standard wildcard matching code
removes WILDCARD matching from tdb @ATTRIBUTES, that's now handled independently
adds some more tests for wildcard matching
fixes dn comparison code in ldb_match
2007-10-10 13:20:13 -05:00
Andrew Tridgell
944c5844ab r8037: a fairly major update to the internals of ldb. Changes are:
- moved the knowledge of attribute types out of ldb_tdb and into the
   generic ldb code. This allows the ldb_match() message match logic
   to be generic, so it can be used by other backend

 - added the generic ability to load attribute handlers, for
   canonicalisation, compare, ldif read and ldif write. In the future
   this will be used by the schema module to allow us to correctly
   obey the attributetype schema elements

 - added attribute handlers for some of the core ldap attribute types,
   Integer, DirectoryString, DN, ObjectClass etc

 - added automatic registration of attribute handlers for well-known
   attribute names 'cn', 'dc', 'dn', 'ou' and 'objectClass'

 - converted the objectSid special handlers for Samba to the new system

 - added more correct handling of indexing in tdb backend based on the
   attribute canonicalisation function

 - added generic support for subclasses, moving it out of the tdb
   backend. This will be used in future by the schema module

 - fixed several bugs in the dn_explode code. It still needs more
   work, but doesn't corrupt ldb dbs any more.
2007-10-10 13:19:01 -05:00
Andrew Tridgell
f648fdf187 r7709: - convert ldb to use popt, so that it can interact with the samba
cmdline credentials code (which will be done soon)

- added a ldb_init() call, and changed ldb_connect() to take a ldb
  context. This allows for much better error handling in
  ldb_connect(), and also made the popt conversion easier

- fixed up all the existing backends with the new syntax

- improved error handling in *_connect()

- fixed a crash bug in the new case_fold_required() code

- ensured that ltdb_rename() and all ltdb_search() paths get the read lock

- added a ldb_oom() macro to make it easier to report out of memory
  situations in ldb code
2007-10-10 13:18:24 -05:00
Derrell Lipman
ce9966e091 r7602: fix some compiler warnings 2007-10-10 13:18:13 -05:00
Simo Sorce
a614466dec r7582: Better way to have a fast path searching for a specific DN.
Old way was ugly and had a bug, you couldn't add an attribute named
dn or distinguishedName and search for it, tdb would change that search in a dn search.
This makes it also possible to search by dn against an ldap server as the old method was
not supported by ldap syntaxes.

sss
2007-10-10 13:18:11 -05:00
Andrew Tridgell
96620ab2ee r7527: - added a ldb_search_bytree() interface, which takes a ldb_parse_tree
instead of a search expression. This allows our ldap server to pass
  its ASN.1 parsed search expressions straight to ldb, instead of going
  via strings.

- updated all the ldb modules code to handle the new interface

- got rid of the separate ldb_parse.h now that the ldb_parse
  structures are exposed externally

- moved to C99 structure initialisation in ldb

- switched ldap server to using ldb_search_bytree()
2007-10-10 13:18:06 -05:00
Andrew Tridgell
5b3575d930 r7514: make the ldb_parse code not depend on a ldb_context, so we can now potentially use
it in our ldap client code, instead of replicating all the code
2007-10-10 13:18:02 -05:00
Andrew Tridgell
917f2a8a07 r6560: added a tdb_chainlock_read() call in ldb_search(). This guarantees
that ldb_search() sees a single consistent view of the database (by
blocking writes during a ldb_search)
2007-10-10 13:16:25 -05:00
Simo Sorce
4f0948dab0 r6470: Remove ldb_search_free() it is not needed anymore.
Just use talloc_free() to release the memory after an ldb_search().
2007-10-10 13:11:40 -05:00
Andrew Tridgell
7893251456 r4744: until we decide what to do about attribute aliasing (see my recent
samba-technical posting), this is an interim solution that makes us
work pretty much like w2k3 does.
2007-10-10 13:08:49 -05:00
Simo Sorce
a681ae365f r4714: move the ldb code to the new talloc interface (eg remove _p suffix)
this helps standalone building of ldb

renew the schema module
split code into functions to improve readability and code reuse

add and modify works correctly but we need a proper testsuite

Simo
2007-10-10 13:08:47 -05:00
Andrew Tridgell
1071712cf5 r4486: fixed some memory leaks in the new ldb code, by ensuring that memory is always
allocated as a child of the right context
2007-10-10 13:08:11 -05:00
Andrew Tridgell
0ab98f50a7 r4474: - converted ldb to use talloc internally
- added gcov flags to Makefile.ldb

- expanded ldb test suite to get more coverage
2007-10-10 13:07:55 -05:00
Stefan Metzmacher
79d0eb2f67 r4022: fix compiler warnings
metze
2007-10-10 13:06:15 -05:00
Stefan Metzmacher
f5ee40d6ce 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
2007-10-10 13:05:52 -05:00
Simo Sorce
71323f424b r3754: merge in ldb modules support from the tmp branch ldbPlugins 2007-10-10 13:05:51 -05:00
Stefan Metzmacher
1e7e94fdb1 r3095: - fix a free'ing of msg.dn
- reenable index tests

metze
2007-10-10 13:02:20 -05:00
Stefan Metzmacher
52eab8dc17 r3089: fix memleak
metze
2007-10-10 13:01:58 -05:00
Tim Potter
45b4016530 r1374: Fix signed/unsigned warnings (actually found by g++) after unsigned int
changes in r1018.
2007-10-10 12:56:54 -05:00
Tim Potter
de5984c956 r1268: varient -> variant 2007-10-10 12:56:46 -05:00
Andrew Tridgell
3657539623 r792: - changed the ldb ldif_* functions to be in the ldb_ namespace
- added better error reporting in ldbdel

 - fixed a bug in handling packing of records which contain elements
   with no values (it caused db corruption)

 - allow search with "dn" as target attribute
2007-10-10 12:53:50 -05:00
Andrew Tridgell
b42d1f3984 r711: don't hide attributes inside the special ldb_tdb records (so the fact
that a attribute is hidden is not itself hidden!)
2007-10-10 12:53:44 -05:00
Andrew Tridgell
f5cd3d733b r606: added a HIDDEN attribute on fields in ldb (in @ATTRIBUTES). This allows you to mark
an attribute as only appearing in searches that explicitly name it. It will be used
for attributes like nTSecurityDescriptor
2007-10-10 12:51:50 -05:00
Andrew Tridgell
7b5f3370e6 r583: fixed two bugs in the handling of index entry deletion 2007-10-10 12:51:48 -05:00
Andrew Tridgell
62b4ec367d r574: - another attempt at const cleanliness in ldb
- fixed a problem with searching for values containing an '=' sign

 - fixed the semantics of attempting an attribute deletion on an attribute that doesn't exist.

 - added some more ldb_msg_*() utilities
2007-10-10 12:51:47 -05:00
Andrew Tridgell
3955c482e6 r502: modified ldb to allow the use of an external pool memory
allocator. The way to use this is to call ldb_set_alloc() with a
function pointer to whatever memory allocator you like. It includes a
context pointer to allow for pool based allocators.
2007-10-10 12:51:45 -05:00
Andrew Tridgell
01e8740676 r490: - expanded the test suite to test modify and delete operations
- made yet another attempt to make ldb const clean.

- "make test" now runs both the tdb and ldap backend tests, and run the ldbtest utility
  with and without indexing

- added prototypes in ldb.h for ldb_msg_*() public functions
2007-10-10 12:51:45 -05:00
Andrew Tridgell
cdd48e2b9b r456: - added -i option to ldbsearch
- fixed sorting bug in ldb index handing
2007-10-10 12:51:43 -05:00
Andrew Tridgell
b386121856 r437: fixed handling of a corner case with multi-valued indexing 2007-10-10 12:51:38 -05:00
Andrew Tridgell
f2bf06f25c r435: a major upgrade for ldb
- added the ability to mark record attributes as being CASE_INSENSITIVE, WILDCARD or INTEGER.

 - added the ability to support objectclass subclasses, and to search by a parent class

 - added internal support for case insensitive versus case sensitive
   indexing (not UTF8 compliant yet)

 - cleaned up a number of const warnings

 - added a number of helper functions for fetching integers, strings and doubles

 - added a in-memory cache for important database properties, supported by a
   database sequence number

 - changed some variable names to avoid conflicts with C++
2007-10-10 12:51:38 -05:00
Tim Potter
e96f3a2005 r382: More C++ friendliness fixes. 2007-10-10 12:51:36 -05:00
Andrew Tridgell
8acecc7f27 r381: make the code more C++ friendly 2007-10-10 12:51:36 -05:00
Andrew Tridgell
af34710d4d 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.
2007-10-10 12:51:11 -05:00
Richard Sharpe
7b34fbe0f2 r141: A number of changes to get things working on FreeBSD and reduce the breakage
caused by someone recently ...

1. Add configure check HAVE_COMPARISON_FN_T to see if this is defined. I
have not checked this on Linux yet, but will do so soon.

2. Add the definitions of malloc_p, realloc_p etc.

3. Check for LDAP and don't build stuff that depends on LDAP if we don't\
have it.

It currently builds on FreeBSD but there is one warning printed out at the end.
2007-10-10 12:51:11 -05:00
Andrew Tridgell
e9e85c4644 added the rest of the ldb_modify() code, which required a fairly large
change in the ldb API. The API is now much closer to LDAP.
-
Andrew Tridgell
dc6f41f9e7 make a more recent snapshot of ldb available to interested
people. Note that I decided to make it LGPL.

ldb is not finished yet, but enough of it is there for people to get
an idea of what it does, and quite a few simple tests work
-