1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-25 23:21:54 +03:00
Commit Graph

44 Commits

Author SHA1 Message Date
Andrew Bartlett
a83df55693 ldb: Add ldb_handle_get_event_context()
This will allow us to obtain a private event context for use while we hold
locks in ldb_tdb, that is not shared with the global state of the application.

This will ensure we do not perform other operations while we hold the lock

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2017-05-31 06:34:26 +02:00
Andrew Bartlett
e584fe85a5 ldb: Allow a caller (in particular Samba) to handle the list of attributes with an index
By doing that, Samba will use a binary search to locate the attributes
rather than an O(n) search, during every search or modify of the database.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2017-05-31 06:34:26 +02:00
Jakub Hrozek
317f3c6f3d ldb: Clarify LDB_MODULES_PATH is used
Make it (hopefully more) clear where modules are loaded from.

Signed-off-by: Jakub Hrozek <jakub.hrozek@posteo.se>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlet <abartlet@samba.org>
2017-04-19 15:46:26 +02:00
Stefan Metzmacher
35f92b82b5 ldb: add LDB_FLG_DONT_CREATE_DB
This avoids creating an new tdb files on ldbsearch
or other callers which use LDB_FLG_DONT_CREATE_DB.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Thu Mar  9 16:02:21 CET 2017 on sn-devel-144
2017-03-09 16:02:21 +01:00
Andrew Bartlett
393b8f3c1d ldb: Add helper function ldb_schema_attribute_fill_with_syntax()
This will allow us to avoid calling ldb_schema_attribute_add_with_syntax()
in a tight loop.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2016-12-01 05:54:23 +01:00
Andrew Bartlett
604a4fd438 ldb: Add helper function ldb_schema_attribute_remove_flagged()
This helps us avoid keeping a list of attributes to later remove on @ATTRIBUTES reload

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2016-12-01 05:54:23 +01:00
Stefan Metzmacher
4e1b965005 ldb:controls: add LDB_CONTROL_RECALCULATE_RDN_OID
This will be used by 'samba-tool dbcheck' to fix the rdn attribute name.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12399

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>

(Patch reduced by Andrew Bartlett to only allocate the OID)
2016-12-01 05:54:22 +01:00
Andrew Bartlett
09580103fe ldb: Avoid multiple tiny allocations during full DB scan
LDB_UNPACK_DATA_FLAG_NO_VALUES_ALLOC allows us to consolidate some of these allocations

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>

Autobuild-User(master): Douglas Bagnall <dbagnall@samba.org>
Autobuild-Date(master): Wed Aug 31 10:53:09 CEST 2016 on sn-devel-144
2016-08-31 10:53:09 +02:00
Andrew Bartlett
f6e87188b6 ldb: Add ldb_unpack_data_only_attr_list_flags()
This function allows us to control allocation of memory during parse
of the packed ldb data.

This in turn can have an important performance impact as each
small allocation can have a large overhead

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2016-07-28 10:06:12 +02:00
Michael Adam
f061cccd0a Revert "ldb:dlinklist: avoid -Wtautological-compare errors with gcc6"
This reverts commit 7c9505e651.

Breaks compile for older (<= 4.4) gccs.
Needs to be done differently.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-07-15 00:54:12 +02:00
Ira Cooper
7c9505e651 ldb:dlinklist: avoid -Wtautological-compare errors with gcc6
We expect these macros to generate tautological compares
intentionally, so disabling the warning is just fine.

This lets --pick-developer work with gcc6 and newer.

Pair-Programmed-With: Michael Adam <obnox@samba.org>

Signed-off-by: Michael Adam <obnox@samba.org>
Signed-off-by: Ira Cooper <ira@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Jul 14 05:44:21 CEST 2016 on sn-devel-144
2016-07-14 05:44:20 +02:00
Douglas Bagnall
16fda12282 ldb controls: use uint8_t* for contextID binary blob
It is never a readable string.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2016-03-09 10:32:16 +01:00
Stefan Metzmacher
ad2b5fae7f ldb: add support for LDB_CONTROL_DIRSYNC_EX
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2016-02-17 03:43:23 +01:00
Stefan Metzmacher
f721f27da5 ldb: add LDB_ATTR_FLAG_FORCE_BASE64_LDIF support
This can be used to force ldb_write_ldif() to use base64 for
a specific attribute.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2016-02-17 03:43:23 +01:00
Michael Adam
d44f488317 ldb: remove outdated comment about type argument in dlist
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-02-06 21:48:18 +01:00
Michael Adam
1441824fe6 ldb: remove unneeded argument type from DLIST_CONCATENATE()
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-02-06 21:48:17 +01:00
Michael Adam
a1c5d662d4 ldb: remove uneeded type argument from DLIST_DEMOTE()
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-02-06 21:48:17 +01:00
Michael Adam
66af807fc4 ldb: remove unneeded type arg from DLIST_ADD_END
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-02-06 21:48:17 +01:00
Garming Sam
61a84ca583 lib/ldb: Clarify the intent of ldb_data_unpack_withlist
This patch renames the function to indicate that you are unpacking with respect to some
attribute list, as well as adding some comments.

Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11602
2015-12-17 03:23:20 +01:00
Matthieu Patou
abcd35f942 ldb: introduce ldb_unpack_data_withlist to unpack partial list of attributes
When provided with non NULL list ldb_unpack_data_withlist will only
unpack attributes that are specified in the list (+ distinguished name)
ldb_unpack_data is changed to call ldb_unpack_data_withlist behind the
scene.

(for modifications found by testing, and re-indentation requested in review)
Signed-off-by: Adrian Cochrane <adrianc@catalyst.net.nz>

Sadly a signed-off-by was not available from Matthieu Patou for the original
version of this patch posted to samba-technical for comment, so instead:

(for supervision of Adrian)
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11602
2015-12-17 03:23:20 +01:00
Adrian Cochrane
5137daa10e ldb: Move ldb_(un)pack_data into ldb_module.h for testing
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11602
Signed-off-by: Adrian Cochrane <adrianc@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2015-12-04 06:08:29 +01:00
Andrew Bartlett
1c02f2801e ldb: Fix python bindings to accept a string as a DN
This fixes add_base(), add_child() and is_child_of().

This removes a toally incorrect cast of struct ldb_dn to struct ldb_context.

A helper routine is used instead

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2015-10-26 05:11:21 +01:00
Samuel Cabrero
faa4be0535 ldb: Allow to register extended match rules
This allows to extend LDB by registering extended match rules from outside
the library itself. This is necessary when the implementation requires
knowledge about syntaxes implemented in samba extensions, like the
LDAP_MATCHING_RULE_TRANSITIVE_EVAL match.

Signed-off-by: Samuel Cabrero <samuelcabrero@kernevil.me>
Singed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2014-12-22 00:18:09 +01:00
Matthieu Patou
bf0ee5f6ba ldb: fix a typo in the comment, LDB_FLAGS_MOD_xxx -> LDB_FLAG_MOD_xxx
Change-Id: I99ac6e272aa0f54a2720c58f630ae472068f255b
Signed-off-by: Matthieu Patou <mat@matws.net>
Reviewed-by: Kamen Mazdrashki <kamenim@samba.org>

Autobuild-User(master): Matthieu Patou <mat@samba.org>
Autobuild-Date(master): Tue Sep 30 08:19:55 CEST 2014 on sn-devel-104
2014-09-30 08:19:55 +02:00
Volker Lendecke
1dba07db0d dlinklist: Fix a typo
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>

Autobuild-User(master): Michael Adam <obnox@samba.org>
Autobuild-Date(master): Wed Apr  2 17:11:37 CEST 2014 on sn-devel-104
2014-04-02 17:11:37 +02:00
Stephen Gallagher
813bd0353f ldb: Move doxygen comments for ldb_connect to the right place
Reviewed-by: Andreas Schneider <asn@samba.org>

Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Mon Jan 14 16:21:02 CET 2013 on sn-devel-104
2013-01-14 16:21:02 +01:00
Andrew Tridgell
30ffdda45b ldb: fixed callers for ldb_pack_data() and ldb_unpack_data()
with ltdb_pack_data() and ltdb_unpack_data() now moved into common, we
need to increase the minor version and fixup callers of the API

Note that this relies on struct ldb_val being the same shape as
TDB_DATA, in much the same way as we rely on ldb_val and DATA_BLOB
being the same shape.

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
2012-11-01 15:40:41 +11:00
Andrew Bartlett
395b8e4d58 lib/ldb: Avoid printing secret attributes in ldb trace logs
These are printed when Samba has debug level 10, which is often used for debugging.

Instead, print a note to say that this attribute has been skipped.

Andrew Bartlett
2012-08-29 12:28:38 +10:00
Andrew Bartlett
73f0cb5278 lib/ldb: Do not vasprintf() the tevent debug messages that will not be shown
This malloc() and free() actually shows up quite high on a call profile of
provision of the AD DC.

This allows the debug handler to decide if the argument list should be
printed.

Andrew Bartlett
2012-08-09 20:14:23 +10:00
Matthieu Patou
1c850b2f17 ldb: lay foundation for proper utc/generalized time handling
We use to handle UTCtime and generalized time the same way. The thing is
that it's not the case, they are different in the way they are set (most
of the time) with different format and also stored and return in
different format too.
2012-06-22 23:22:03 -07:00
Matthieu Patou
9ebb081cce ldb: add the VERIFY_NAME control 2012-06-22 23:22:02 -07:00
Andrew Tridgell
9deb650fa2 ldb: added ldb_msg_element_equal_ordered()
this gives us a order sensitive msg element comparison. We need this
to allow dbcheck to fix the order of objectClass attributes.
2012-04-18 07:48:05 +02:00
Andrew Bartlett
501d6d3dd4 ldb: Allow access to the line number while reading ldif from a file 2012-04-10 17:37:31 +10:00
Amitay Isaacs
3a0f7b89d5 ldb: Add handy macros for reporting error inside ldb module
Pair-Programmed-With: Andrew Tridgell <tridge@samba.org>

Autobuild-User: Amitay Isaacs <amitay@samba.org>
Autobuild-Date: Thu Nov 17 05:24:46 CET 2011 on sn-devel-104
2011-11-17 05:24:46 +01:00
Stefan Metzmacher
94899cd83c Revert "ldb: support raw OIDs in control string parsing"
This reverts commit ea41860d32.

This is not needed, because we already have the 'local_oid' magic.

metze
2011-10-07 12:20:49 +02:00
Andrew Tridgell
ea41860d32 ldb: support raw OIDs in control string parsing
this makes it possible to use a raw OID string on the command line or
in python scripts

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
2011-10-06 14:34:21 +11:00
Matthias Dieter Wallnöfer
87b482a89e ldb - two cosmetic fixes
@ldb.h: Removes an invalid comment line
@pyldb.c: Fixes indentation
2011-08-19 19:31:03 +02:00
Andrew Tridgell
23598d56ff ldb: rule_id in ldb_parse_tree should be const
this allows assignment to a constant string without allocation

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
2011-08-04 16:17:25 +10:00
Andrew Tridgell
849d042dd8 ldb: added a new always-fail ldap extended match OID
this is used when rewriting filter rules to replace a filter rule with
one that is guaranteed not to match

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
2011-08-04 16:17:25 +10:00
Andrew Tridgell
841d17ff83 ldb: added ldb_parse_tree_walk()
this walks a ldb parse tree, calling a callback on each node

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
Pair-Programmed-With: Amitay Isaacs <amitay@gmail.com>
2011-08-04 16:17:24 +10:00
Andrew Tridgell
4ba8069e3d ldb: added ldb_dn_replace_components()
this allows you to replace the string part of a DN with the string
part from another DN. This is useful when you want to fix a DN that
has the right GUID but the wrong string part, because the target
object has moved.

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
Pair-Programmed-With: Amitay Isaacs <amitay@gmail.com>
2011-08-04 16:17:24 +10:00
Amitay Isaacs
197996c3df ldb: Expose ldb_handler_fold() funcion
This allows creation of derived syntax handlers from the base directory string.

Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-07-28 15:20:51 +10:00
Andrew Tridgell
23b6af10f6 ldb: added ldb_val_string_cmp()
this should help fix some places where we run past the end of a string

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
2011-07-13 12:51:05 +02:00
Andrew Bartlett
8420a36dc7 ldb: make ldb a top level library for Samba 4.0
Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-07-05 17:24:47 +10:00