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

73 Commits

Author SHA1 Message Date
Stefan Metzmacher
b97b8f5dcb r20184: change ldb_attrib_handler into ldb_schema_attribute, which has a pointer
to a ldb_schema_syntax struct.

the default attribute handler is now registered dynamicly as "*"
attribute, instead of having its own code path.

ldb_schema_attribute's can be added to the ldb_schema given a
ldb_schema_syntax struct or the syntax name

we may also need to introduce a ldb_schema_matching_rule,
and add a pointer to a default ldb_schema_matching_rule
in the ldb_schema_syntax.

metze
2007-10-10 14:29:19 -05:00
Simo Sorce
3929c086d5 r19832: better prototypes for the linearization functions:
- ldb_dn_get_linearized
  returns a const string

- ldb_dn_alloc_linearized
  allocs astring with the linearized dn
2007-10-10 14:28:22 -05:00
Simo Sorce
a580c871d3 r19831: Big ldb_dn optimization and interfaces enhancement patch
This patch changes a lot of the code in ldb_dn.c, and also
removes and add a number of manipulation functions around.

The aim is to avoid validating a dn if not necessary as the
validation code is necessarily slow. This is mainly to speed up
internal operations where input is not user generated and so we
can assume the DNs need no validation. The code is designed to
keep the data as a string if possible.

The code is not yet 100% perfect, but pass all the tests so far.
A memleak is certainly present, I'll work on that next.

Simo.
2007-10-10 14:28:22 -05:00
Simo Sorce
889fb983ba r19531: Make struct ldb_dn opaque and local to ldb_dn.c 2007-10-10 14:24:44 -05:00
Andrew Tridgell
1347ad254e r19402: - use the new tdb_lockall_read() to make ldb_search() more efficient,
by avoiding chain locks on each tdb_fetch() within the search

- use the tdb_get_seqnum() call to avoid re-reading the @BASEINFO
  record when it hasn't changed.

These speed up the LOCAL-DBSPEED test for ldb from 7k ops/sec to a bit
over 11k ops/sec
2007-10-10 14:21:26 -05:00
Simo Sorce
49fc640b5c r19314: Commit tridge's fixes for a big mem leak in ltdb I introduced
when the code has been changed to be async.
With the other committed fixes now this works.
2007-10-10 14:21:07 -05:00
Andrew Tridgell
254cbf09de r18439: 2nd try at a talloc_move() api. This type with the ** ptr interface
exposed.

Unfortunately this generates a large number of type punning
warnings. We'll have to find some magic to hide those.
2007-10-10 14:18:29 -05:00
Andrew Tridgell
c0d9e7d473 r18436: converted ldb to use talloc_move() instead of talloc_steal() when
appropriate.

Note that I also removed the error checks that were being done on the
result of talloc_steal(). They are pointless as talloc_steal() doesn't
have any failure modes that wouldn't cause a segv anyway, and they
tend to clutter the code
2007-10-10 14:18:29 -05:00
Simo Sorce
260868bae5 r17514: Simplify the way to set ldb errors and add another
helper function to set them.
2007-10-10 14:15:31 -05:00
Simo Sorce
1b3b617659 r17370: Fix tdb searches, we need to return an LDAP_REPLY_DONE packet when done.
Awesome how this didn't break everything around...
2007-10-10 14:15:20 -05:00
Simo Sorce
c6aa60c7e6 r17186: "async" word abuse clean-up part 2 2007-10-10 14:10:17 -05:00
Simo Sorce
25fc735404 r17185: Oh, I wanted to do this for sooo long time.
Finally acknowledge that ldb is inherently async and does not have a dual personality anymore
Rename all ldb_async_XXX functions to ldb_XXX except for ldb_async_result, it is now ldb_reply
to reflect the real function of this structure.

Simo.
2007-10-10 14:10:16 -05:00
Simo Sorce
51083de795 r15942: Remove the sync internal ldb calls altogether.
This means that some modules have been disabled as well as they
have not been ported to the async interface

One of them is the ugly objectclass module.
I hope that the change in samldb module will make the MMC happy
without the need of this crappy module, we need proper handling
in a decent schema module.

proxy and ldb_map have also been disabled
ldb_sqlite3 need to be ported as well (currenlty just broken).
2007-10-10 14:08:43 -05:00
Simo Sorce
7d65105e88 r15927: Optimize ldb module traverse while keeping the API intact.
I was sick of jumping inot each module for each request,
even the ones not handle by that module.
2007-10-10 14:08:41 -05:00
Simo Sorce
6af1d738b9 r15913: Error passing in the async code is not in agood shape
Start enhancing it and fix some problems with incorrect evalutaion of the codes

Implement rdn rename (async only)
2007-10-10 14:08:39 -05:00
Simo Sorce
ef1b3e6368 r13996: simplify ldb_async_wait() some more 2007-10-10 13:52:36 -05:00
Simo Sorce
7ef63abae1 r13827: Minor enhancements or cosmetic changes 2007-10-10 13:52:14 -05:00
Simo Sorce
b4202cf030 r13823: make async_wait part of the modules ops 2007-10-10 13:52:13 -05:00
Simo Sorce
0db616ef59 r13818: Make ldb_tdb 'fake' async.
Simo.
2007-10-10 13:52:13 -05:00
Simo Sorce
1e2c13b2d5 r13609: Get in the initial work on making ldb async
Currently only ldb_ildap is async, the plan
is to first make all backend support the async calls,
and then remove the sync functions from backends and
keep the only in the API.

Modules will need to be transformed along the way.

Simo
2007-10-10 13:51:59 -05:00
Simo Sorce
4b5c0493e2 r13289: Check the tree is not NULL
Thanks to Aaron J. Seigo <aseigo@kde.org> for spotting this
2007-10-10 13:51:43 -05:00
Andrew Bartlett
29cb5af827 r13258: Fix the talloc heirachy for ldb_tdb.
In the return value res->msgs, msgs was not a child of res, in the
indexed path.  Instead, it hung directly off the ldb, which was
sometimes a long-term context.

Also remove unused parameters.

Found by --leak-report-full

Andrew Bartlett
2007-10-10 13:51:39 -05:00
Stefan Metzmacher
380938e97f r12829: fix ldb headers, to not include '<...>' files in .c files
this helps in getting symbol -fvisibility=hidden (GCC 4 feature) working later.

metze
2007-10-10 13:50:03 -05:00
Simo Sorce
77125feaff r12733: Merge ldap/ldb controls into main tree
There's still lot of work to do but the patch is stable
enough to be pushed into the main samba4 tree.

Simo.
2007-10-10 13:49:47 -05:00
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