From 84abb428f640e4c48a7231ed78383b197ed715a9 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sat, 12 Feb 2011 16:58:10 +0100 Subject: s3: Add an explicit counter to tldap_add_mod_[blobs|str] --- source3/include/tldap_util.h | 8 +++++--- source3/lib/tldap_util.c | 20 ++++++++++++-------- source3/passdb/pdb_ads.c | 18 ++++++++++-------- 3 files changed, 27 insertions(+), 19 deletions(-) diff --git a/source3/include/tldap_util.h b/source3/include/tldap_util.h index d0268fe1d6..6a99a5f78a 100644 --- a/source3/include/tldap_util.h +++ b/source3/include/tldap_util.h @@ -33,10 +33,12 @@ bool tldap_pull_binsid(struct tldap_message *msg, const char *attribute, struct dom_sid *sid); bool tldap_pull_guid(struct tldap_message *msg, const char *attribute, struct GUID *guid); -bool tldap_add_mod_blobs(TALLOC_CTX *mem_ctx, struct tldap_mod **pmods, +bool tldap_add_mod_blobs(TALLOC_CTX *mem_ctx, + struct tldap_mod **pmods, int *pnum_mods, int mod_op, const char *attrib, - DATA_BLOB *values, int num_values); -bool tldap_add_mod_str(TALLOC_CTX *mem_ctx, struct tldap_mod **pmods, + DATA_BLOB *newvals, int num_newvals); +bool tldap_add_mod_str(TALLOC_CTX *mem_ctx, + struct tldap_mod **pmods, int *pnum_mods, int mod_op, const char *attrib, const char *str); bool tldap_make_mod_blob(struct tldap_message *existing, TALLOC_CTX *mem_ctx, struct tldap_mod **pmods, int *pnum_mods, diff --git a/source3/lib/tldap_util.c b/source3/lib/tldap_util.c index 2646348aa1..e42188a2ab 100644 --- a/source3/lib/tldap_util.c +++ b/source3/lib/tldap_util.c @@ -132,7 +132,7 @@ static bool tldap_add_blob_vals(TALLOC_CTX *mem_ctx, struct tldap_mod *mod, } bool tldap_add_mod_blobs(TALLOC_CTX *mem_ctx, - struct tldap_mod **pmods, + struct tldap_mod **pmods, int *pnum_mods, int mod_op, const char *attrib, DATA_BLOB *newvals, int num_newvals) { @@ -148,7 +148,7 @@ bool tldap_add_mod_blobs(TALLOC_CTX *mem_ctx, return false; } - num_mods = talloc_array_length(mods); + num_mods = *pnum_mods; for (i=0; i