1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

s3: Convert tldap_add_mod_blobs args to "array, count"

This commit is contained in:
Volker Lendecke 2011-02-12 16:33:26 +01:00
parent 7852527073
commit 6b492a1741
3 changed files with 8 additions and 7 deletions

View File

@ -35,7 +35,7 @@ bool tldap_pull_guid(struct tldap_message *msg, const char *attribute,
struct GUID *guid); 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 mod_op, const char *attrib, int mod_op, const char *attrib,
int num_values, DATA_BLOB *values); DATA_BLOB *values, int num_values);
bool tldap_add_mod_str(TALLOC_CTX *mem_ctx, struct tldap_mod **pmods, bool tldap_add_mod_str(TALLOC_CTX *mem_ctx, struct tldap_mod **pmods,
int mod_op, const char *attrib, const char *str); int mod_op, const char *attrib, const char *str);
bool tldap_make_mod_blob(struct tldap_message *existing, TALLOC_CTX *mem_ctx, bool tldap_make_mod_blob(struct tldap_message *existing, TALLOC_CTX *mem_ctx,

View File

@ -131,9 +131,10 @@ static bool tldap_add_blob_vals(TALLOC_CTX *mem_ctx, struct tldap_mod *mod,
return true; return true;
} }
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 mod_op, const char *attrib, int mod_op, const char *attrib,
int num_newvals, DATA_BLOB *newvals) DATA_BLOB *newvals, int num_newvals)
{ {
struct tldap_mod new_mod; struct tldap_mod new_mod;
struct tldap_mod *mods = *pmods; struct tldap_mod *mods = *pmods;
@ -198,7 +199,7 @@ bool tldap_add_mod_str(TALLOC_CTX *mem_ctx, struct tldap_mod **pmods,
return false; return false;
} }
ret = tldap_add_mod_blobs(mem_ctx, pmods, mod_op, attrib, 1, &utf8); ret = tldap_add_mod_blobs(mem_ctx, pmods, mod_op, attrib, &utf8, 1);
TALLOC_FREE(utf8.data); TALLOC_FREE(utf8.data);
return ret; return ret;
} }
@ -248,7 +249,7 @@ static bool tldap_make_mod_blob_int(struct tldap_message *existing,
DEBUG(10, ("smbldap_make_mod_blob: deleting attribute |%s|\n", DEBUG(10, ("smbldap_make_mod_blob: deleting attribute |%s|\n",
attrib)); attrib));
if (!tldap_add_mod_blobs(mem_ctx, pmods, TLDAP_MOD_DELETE, if (!tldap_add_mod_blobs(mem_ctx, pmods, TLDAP_MOD_DELETE,
attrib, 1, &oldval)) { attrib, &oldval, 1)) {
return false; return false;
} }
} }
@ -261,7 +262,7 @@ static bool tldap_make_mod_blob_int(struct tldap_message *existing,
DEBUG(10, ("smbldap_make_mod: adding attribute |%s| value len " DEBUG(10, ("smbldap_make_mod: adding attribute |%s| value len "
"%d\n", attrib, (int)newval.length)); "%d\n", attrib, (int)newval.length));
if (!tldap_add_mod_blobs(mem_ctx, pmods, TLDAP_MOD_ADD, if (!tldap_add_mod_blobs(mem_ctx, pmods, TLDAP_MOD_ADD,
attrib, 1, &newval)) { attrib, &newval, 1)) {
return false; return false;
} }
} }

View File

@ -331,7 +331,7 @@ static bool pdb_ads_init_ads_from_sam(struct pdb_ads_state *state,
blob = data_blob_const(pw_utf16, pw_utf16_len); blob = data_blob_const(pw_utf16, pw_utf16_len);
ret &= tldap_add_mod_blobs(mem_ctx, pmods, TLDAP_MOD_REPLACE, ret &= tldap_add_mod_blobs(mem_ctx, pmods, TLDAP_MOD_REPLACE,
"unicodePwd", 1, &blob); "unicodePwd", &blob, 1);
if (ret) { if (ret) {
*pnum_mods = talloc_array_length(*pmods); *pnum_mods = talloc_array_length(*pmods);
} }