diff options
author | Stefan Metzmacher <metze@samba.org> | 2017-06-30 08:14:02 +0200 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2017-07-02 17:35:20 +0200 |
commit | 0fac7e4d7391f3f4aed54f0c7fbc9fd3cc33bf6a (patch) | |
tree | 11df266086c7a15e46dba5a824549955b2dce449 /lib | |
parent | a1158d223711b82eb8d8312fb3f0709d307c0fb7 (diff) | |
download | samba-0fac7e4d7391f3f4aed54f0c7fbc9fd3cc33bf6a.tar.gz |
ldb:includes: protect ldb_modules.h from being used by Samba < 4.7
Samba versions before 4.7 are incompatible with the read_[un]lock()
behaviour introduced into ldb.
This makes sure older Samba versions fail to compile against
ldb >= 1.2.0.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12859
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ldb/include/ldb_module.h | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/lib/ldb/include/ldb_module.h b/lib/ldb/include/ldb_module.h index 0f5feeb084c..8ad212a1e08 100644 --- a/lib/ldb/include/ldb_module.h +++ b/lib/ldb/include/ldb_module.h @@ -35,6 +35,41 @@ #include <ldb.h> +#if defined(_SAMBA_BUILD_) && defined(USING_SYSTEM_LDB) + +/* + * Versions before 1.2.0 doesn't define these values + * so we assime 1.1.29 (which was used in Samba 4.6) + * + * See https://bugzilla.samba.org/show_bug.cgi?id=12859 + */ +#ifndef EXPECTED_SYSTEM_LDB_VERSION_MAJOR +#define EXPECTED_SYSTEM_LDB_VERSION_MAJOR 1 +#endif +#ifndef EXPECTED_SYSTEM_LDB_VERSION_MINOR +#define EXPECTED_SYSTEM_LDB_VERSION_MINOR 1 +#endif +#ifndef EXPECTED_SYSTEM_LDB_VERSION_MINOR +#define EXPECTED_SYSTEM_LDB_VERSION_MINOR 29 +#endif + +/* + * Only Samba versions which expect ldb >= 1.2.0 + * are compatible with read_[un]lock() behaviour. + * + * See https://bugzilla.samba.org/show_bug.cgi?id=12859 + */ +#if EXPECTED_SYSTEM_LDB_VERSION_MAJOR > 1 +#define __LDB_READ_LOCK_COMPATIBLE__ 1 +#elif EXPECTED_SYSTEM_LDB_VERSION_MINOR > 1 +#define __LDB_READ_LOCK_COMPATIBLE__ 1 +#endif +#ifndef __LDB_READ_LOCK_COMPATIBLE__ +#error "Samba < 4.7 is not compatible with this version of ldb due to assumptions around read locks" +#endif + +#endif /* defined(_SAMBA_BUILD_) && defined(USING_SYSTEM_LDB) */ + struct ldb_context; struct ldb_module; |