From: Andrew Bartlett Date: Wed, 29 May 2024 23:23:01 +0000 (+1200) Subject: ldb_wrap: Provide a way to avoid Samba using ldb_wrap() X-Git-Tag: tdb-1.4.11~406 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e178f6b0e962b0ac96d447196765c21c770ede63;p=thirdparty%2Fsamba.git ldb_wrap: Provide a way to avoid Samba using ldb_wrap() ldb_wrap is a caching mechansim, and it should probably be removed but for now provide a way to avoid it in specific cases where we know it is harmful. Signed-off-by: Andrew Bartlett Reviewed-by: Jo Sutton --- diff --git a/lib/ldb/include/ldb.h b/lib/ldb/include/ldb.h index 0a93b560180..f29392ad4ea 100644 --- a/lib/ldb/include/ldb.h +++ b/lib/ldb/include/ldb.h @@ -273,6 +273,12 @@ enum ldb_debug_level {LDB_DEBUG_FATAL, LDB_DEBUG_ERROR, */ #define LDB_FLG_DONT_CREATE_DB 64 +/** + * Allow DB create time flags that have meaning only to our + * calling application or modules. These must be in this range: + */ +#define LDB_FLG_PRIVATE_MASK 0xff000000 + /* structures for ldb_parse_tree handling code */ diff --git a/source4/dsdb/samdb/samdb.c b/source4/dsdb/samdb/samdb.c index 42375a8437b..cbcafeb44d2 100644 --- a/source4/dsdb/samdb/samdb.c +++ b/source4/dsdb/samdb/samdb.c @@ -116,7 +116,12 @@ int samdb_connect_url(TALLOC_CTX *mem_ctx, *ldb_ret = ldb; return LDB_SUCCESS; } - + + if (flags & SAMBA_LDB_WRAP_CONNECT_FLAG_NO_SHARE_CONTEXT) { + *ldb_ret = ldb; + return LDB_SUCCESS; + } + if (!ldb_wrap_add(url, ev_ctx, lp_ctx, session_info, NULL, flags, ldb)) { *errstring = talloc_asprintf(mem_ctx, "Failed to add cached DB reference" diff --git a/source4/dsdb/samdb/samdb.h b/source4/dsdb/samdb/samdb.h index 3b62b60c52f..ec07cae6ad3 100644 --- a/source4/dsdb/samdb/samdb.h +++ b/source4/dsdb/samdb/samdb.h @@ -435,4 +435,6 @@ struct dsdb_encrypted_connection_state { */ #define SAMBA_LMDB_LEVEL_ONE_FEATURE "lmdbLevelOne" +#define SAMBA_LDB_WRAP_CONNECT_FLAG_NO_SHARE_CONTEXT 0x01000000 + #endif /* __SAMDB_H__ */