From 11a44ce6f885de1c1f78c791cbe85a915934ae8a Mon Sep 17 00:00:00 2001 From: Kamen Mazdrashki Date: Fri, 16 Jul 2010 14:18:49 +0300 Subject: [PATCH] ldb: Mark _DEPRECATED_ ldb_msg_diff() and ldb_msg_canonicalize() functions They are not quite safe to use (requires caller to steal resulting message in own context) and may lead to holding memory for too long. Signed-off-by: Andrew Bartlett --- source4/lib/ldb/include/ldb.h | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/source4/lib/ldb/include/ldb.h b/source4/lib/ldb/include/ldb.h index 065aa31682d..b3d874e36f9 100644 --- a/source4/lib/ldb/include/ldb.h +++ b/source4/lib/ldb/include/ldb.h @@ -86,6 +86,14 @@ struct ldb_val { #ifndef PRINTF_ATTRIBUTE #define PRINTF_ATTRIBUTE(a,b) #endif + +#ifndef _DEPRECATED_ +#if (__GNUC__ >= 3) && (__GNUC_MINOR__ >= 1 ) +#define _DEPRECATED_ __attribute__ ((deprecated)) +#else +#define _DEPRECATED_ +#endif +#endif /*! \endcond */ /* opaque ldb_dn structures, see ldb_dn.c for internals */ @@ -1851,8 +1859,17 @@ struct ldb_message *ldb_msg_copy_shallow(TALLOC_CTX *mem_ctx, struct ldb_message *ldb_msg_copy(TALLOC_CTX *mem_ctx, const struct ldb_message *msg); +/* + * ldb_msg_canonicalize() is now depreciated + * Please use ldb_msg_normalize() instead + * + * NOTE: Returned ldb_message object is allocated + * into *ldb's context. Callers are recommended + * to steal the returned object into a TALLOC_CTX + * with short lifetime. + */ struct ldb_message *ldb_msg_canonicalize(struct ldb_context *ldb, - const struct ldb_message *msg); + const struct ldb_message *msg) _DEPRECATED_; int ldb_msg_normalize(struct ldb_context *ldb, TALLOC_CTX *mem_ctx, @@ -1860,9 +1877,18 @@ int ldb_msg_normalize(struct ldb_context *ldb, struct ldb_message **_msg_out); +/* + * ldb_msg_diff() is now depreciated + * Please use ldb_msg_difference() instead + * + * NOTE: Returned ldb_message object is allocated + * into *ldb's context. Callers are recommended + * to steal the returned object into a TALLOC_CTX + * with short lifetime. + */ struct ldb_message *ldb_msg_diff(struct ldb_context *ldb, struct ldb_message *msg1, - struct ldb_message *msg2); + struct ldb_message *msg2) _DEPRECATED_; /** * return a ldb_message representing the differences between msg1 and msg2. -- 2.11.4.GIT