1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-24 21:34:56 +03:00
Commit Graph

700 Commits

Author SHA1 Message Date
Matthias Dieter Wallnöfer
fea02ce177 ldb:ldb_autotransaction_request - error string shouldn't be set here
A generic error string should be set independently of the access
mechanism to an LDB operation. Hence it should be handled in "ldb_wait"
and "ldb_request"

Signed-off-by: Andrew Tridgell <tridge@samba.org>

Autobuild-User: Andrew Tridgell <tridge@samba.org>
Autobuild-Date: Tue Oct 11 10:15:18 CEST 2011 on sn-devel-104
2011-10-11 10:15:18 +02:00
Matthias Dieter Wallnöfer
21d053d120 ldb:pyldb.c - py_ldb_* modification calls - error string shouldn't be set here
As discussed with Jelmer, we shouldn't be setting a generic LDB error string
only for the Python bindings alone. This should be done in "ldb_request"
and "ldb_wait" - the common place for all possible LDB access mechanisms.

Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-10-11 08:42:07 +02:00
Matthias Dieter Wallnöfer
7599d59d1a ldb:ldb.c/"ldb_wait" - make "ldb_wait" always return an error string
Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-10-11 08:42:07 +02:00
Matthias Dieter Wallnöfer
500d1ba546 ldb:ldb.c/"ldb_wait" - change "ldb_wait" slightly in order to introduce error messages
In this occasion remove a redundant check for "LDB_ASYNC_DONE":

if (handle->state == LDB_ASYNC_DONE ||    if (handle->state == LDB_ASYNC_DONE)
    handle->status != LDB_SUCCESS) {              return handle->status;
        return handle->status;         == if (handle->status != LDB_SUCCESS)
}                                                 return handle->status;
...                                       ...
return LDB_SUCCESS;                       return LDB_SUCCESS;

Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-10-11 08:42:07 +02:00
Matthias Dieter Wallnöfer
8cab94e827 ldb:ldb.c/"ldb_request" - make "ldb_request" always return an error string
Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-10-11 08:42:07 +02:00
Matthias Dieter Wallnöfer
f2a3125dcb ldb:ldb.c - "ldb_set_errstring" can be implemented by using "ldb_asprintf_errstring"
Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-10-11 08:42:07 +02:00
Matthias Dieter Wallnöfer
0f41868691 ldb:ldb_autotransaction_request - fix a typo in a comment
Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-10-11 08:42:07 +02:00
Stefan Metzmacher
f47b4055e8 ldb: change version to 1.1.3 after pyldb changes
metze

Autobuild-User: Stefan Metzmacher <metze@samba.org>
Autobuild-Date: Mon Oct 10 14:24:25 CEST 2011 on sn-devel-104
2011-10-10 14:24:25 +02: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
Stefan Metzmacher
ec910d94d3 ldb/ldb_controls: allow oid up to 255 chars
We have char oid[256], so allow sscanf() to consume 255 chars.

metze
2011-10-07 12:20:48 +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
Andrew Tridgell
b3476f00a6 ldb: fixed memory leak in control string parsing
if parsing fails, free ctrl

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
2011-10-06 14:34:21 +11:00
Matthias Dieter Wallnöfer
2e76b798fe ldb:"ldb_extended" -make the call more similar to "ldb_search"
For example NULL out the LDB result pointer on failures.

Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-09-19 10:57:03 +10:00
Jelmer Vernooij
6589f1712f pyldb: Drop unnecessary dependency on pytalloc-util.
Autobuild-User: Jelmer Vernooij <jelmer@samba.org>
Autobuild-Date: Sun Sep 18 17:23:40 CEST 2011 on sn-devel-104
2011-09-18 17:23:40 +02:00
Rusty Russell
376511ed4d tdb_compat: adapt to tdb2 API change.
Add the ecode arg to all the log functions, and log it.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2011-09-14 07:13:13 +09:30
Matthias Dieter Wallnöfer
3a759e0375 ldb:pyldb.c - "py_ldb_rename" remove superflous "ldb" pointer
Reviewed-by: Jelmer

Autobuild-User: Matthias Dieter Wallnöfer <mdw@samba.org>
Autobuild-Date: Tue Sep 13 18:11:18 CEST 2011 on sn-devel-104
2011-09-13 18:11:18 +02:00
Matthias Dieter Wallnöfer
80f6932e3e ldb:ldb_controls.c - remove duplicate definition of "LDB_CONTROL_CMP"
And fix the comment

Reviewed-by: Jelmer
2011-09-11 17:33:08 +02:00
Matthias Dieter Wallnöfer
e3213bb4d0 ldb:pyldb.c - point out that "PyLdbResult_AsResult" does not convert everything
Reviewed-by: Jelmer
2011-09-11 17:32:58 +02:00
Andrew Tridgell
ccaab14ac4 ldb: make the 'spy' code more paranoid
the spy code in ldb_tdb was added a while ago to overcome a memory
hierarchy problem with async ldb errors. Recently we started to get
valgrind errors related to the order of free in the spy code. This
patch ensures that we don't try to use a freed spy pointer. This
prevents the valgrind errors, although I suspect that the memory
hierarchy we have here is more complex than it needs to be

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>

Autobuild-User: Andrew Tridgell <tridge@samba.org>
Autobuild-Date: Thu Sep  1 08:54:23 CEST 2011 on sn-devel-104
2011-09-01 08:54:23 +02:00
Andrew Tridgell
4d6c120fb7 ldb: fixed ldbsearch when no baseDN specified and cross-ncs is used
Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
2011-09-01 15:23:09 +10:00
Andrew Tridgell
8ab3c843b1 pyldb: added OID_COMPARATOR constants
This also changes the other constants to remove the LDB_ prefix, which
is redundent

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
2011-09-01 15:23:09 +10:00
Andrew Tridgell
4655a5bf7c pyldb: fixed a warning
Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
2011-08-25 07:39:37 +10:00
Jelmer Vernooij
31912781ca wafsamba: Only install .pc files if libraries are public. 2011-08-21 03:22:05 +02:00
Matthias Dieter Wallnöfer
aefde815ac ldb:ldb_controls.c - cosmetic indentation fix 2011-08-19 19:31:04 +02: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 Bartlett
813bdf466d ldb: Remove use after free in error case
Autobuild-User: Andrew Bartlett <abartlet@samba.org>
Autobuild-Date: Sat Aug 13 13:49:44 CEST 2011 on sn-devel-104
2011-08-13 13:49:44 +02:00
Andrew Tridgell
cba88a2b62 ldb: fix the canonicalisation of booleans
we were canonicalising "FALSE" to "FALS"

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
2011-08-09 11:56:23 +02:00
Stefan Metzmacher
a5fdf05d6c pyldb: fix uninitialized memory bug in PyArg_ParseTuple() argument
"s#", &str, &len) required 'len' as 'int' not as 'Py_ssize_t'.
With Py_ssize_t the 2nd half of a 64bit Py_ssize_t, will be
uninitialized as 'int' is only 32bit.

metze
2011-08-08 16:45:27 +02:00
Jelmer Vernooij
3bcb8710fd pyldb: Generate ABI file. 2011-08-07 17:17:18 +02:00
Jelmer Vernooij
fdff105854 pyldb: Consistently use pyldb_ prefix. 2011-08-07 17:08:56 +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
a8293a5baa ldb: added signatures for 1.1.2 2011-08-04 16:17:24 +10:00
Andrew Tridgell
39576e9d65 ldb: raise minor version
needed for new module function ldb_dn_replace_components()

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
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
Andrew Tridgell
a7f3545b82 pyldb: return a copy of key constant DNs via python interface
this prevents an easy coding error where the caller modifies one of
the key DNs for the database, by using an add_child function or
similar

Pair-Programmed-With: Amitay Isaacs <amitay@gmail.com>
Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
2011-08-03 14:25:38 +10:00
Andrew Tridgell
7ce4aca029 pyldb: added binary_encode() and binary_decode() methods
this gives access to RFC2254 encoding from python

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
Pair-Programmed-With: Amitay Isaacs <amitay@gmail.com>
2011-07-29 18:17:44 +10:00
Andrew Tridgell
d815ce094e ldb: added a test for an invalid search expression
this tests the fix for invalid expressions in & and | expressions

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
Pair-Programmed-With: Amitay Isaacs <amitay@gmail.com>
2011-07-29 18:17:44 +10:00
Andrew Tridgell
e3b76bd620 ldb: fixed a search expression parse bug
when a secondary component of a & or | expression was invalid, it was
ignored rather than giving an error. For example:

 (|(objectclass=user)(samaccountname=foo\blah))

was treated as being:

 (objectclass=user)

whereas it should be an error, as foo\blah is invalid

Pair-Programmed-With: Amitay Isaacs <amitay@gmail.com>
Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
2011-07-29 18:17:44 +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
a36af1a501 pyldb: use dn.is_child_of() instead of dn.compare_base()
the compare_base() C API doesn't really fit well in python, as it
returns 0 for true. Better to have a boolean function for the python
interface.

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
2011-07-21 11:44:36 +10:00
Matthieu Patou
3f6df9f9e3 pyldb: add unit test for ldbDn.compare_base 2011-07-21 11:44:34 +10:00
Matthieu Patou
521556ceed ldb-python: add a function to Dn object to compare the Dn with a base DN 2011-07-21 11:44:34 +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 Tridgell
c60a48948a ldb: don't return special DNs on non-base searches
to look at a special DN, give the full DN

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
2011-07-13 12:51:05 +02:00
Andrew Tridgell
58e89443e2 ldb: don't shortcut dn comparison for mismatched special DNs
DNs that start with @ can't be compared via string comparison with
normal DNs

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
2011-07-13 12:51:05 +02:00
Matthieu Patou
f97e4f6b8f ldb-tdb: Introduce a flag on ltdb_add_internal to indicate whether unique value test should be performed or not
The function ltdb_add_internal is called either from ltdb_add or
ltdb_rename. In case of add we enforce the unique test (unless it has
been relaxed by a upper module through the
LDB_FLAG_INTERNAL_DISABLE_SINGLE_VALUE_CHECK flag), but for rename as it
is translated by a delete + a add we relax the test as we can have one
or more attribute which are supposed to be single valued but that are
not (ie. when we have a couple of deleted value on a single valued
attribute), we have already done the tests on insert so make the
assumption that the values are OK.

Without this patch deleting a subnet that has been affected to more than
one site fails as the delete is in fact a rename to GUID\0DEL ... with
an attribute siteObject that has 1 active link value and 1 inactive link
value

Autobuild-User: Matthieu Patou <mat@samba.org>
Autobuild-Date: Wed Jul 13 02:29:20 CEST 2011 on sn-devel-104
2011-07-13 02:29:20 +02:00
Andrew Bartlett
fe8fe384f3 ldb: set -Wl,-no-undefined only on standalone build
This ensures that the flag is not propogated to other projects, such
as Samba's source3 waf build.

Andrew Bartlett

Autobuild-User: Andrew Bartlett <abartlet@samba.org>
Autobuild-Date: Tue Jul  5 10:37:30 CEST 2011 on sn-devel-104
2011-07-05 10:37:30 +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