diff options
author | Matthias Dieter Wallnöfer <mdw@samba.org> | 2010-12-03 20:20:17 +0100 |
---|---|---|
committer | Matthias Dieter Wallnöfer <mdw@samba.org> | 2010-12-03 20:44:58 +0100 |
commit | 025aa3f0532b6853569ac2a8eb9b4b37ff72b981 (patch) | |
tree | 2dc85b37ae77db9ca2cdcbd3f5ad8ac3530cdb9b | |
parent | d14e0e8ff1e3f9144bf815daec9eb292879a97ca (diff) | |
download | samba-025aa3f0532b6853569ac2a8eb9b4b37ff72b981.tar.gz samba-025aa3f0532b6853569ac2a8eb9b4b37ff72b981.tar.bz2 samba-025aa3f0532b6853569ac2a8eb9b4b37ff72b981.zip |
s4:libnet/libnet_samsync_ldb,c - move away from "samdb_msg_add_string" when possible
Also here we can move to "ldb_msg_add_string" without any impact!
-rw-r--r-- | source4/libnet/libnet_samsync_ldb.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/source4/libnet/libnet_samsync_ldb.c b/source4/libnet/libnet_samsync_ldb.c index bdeced8eef..9626341104 100644 --- a/source4/libnet/libnet_samsync_ldb.c +++ b/source4/libnet/libnet_samsync_ldb.c @@ -652,6 +652,7 @@ static NTSTATUS samsync_ldb_handle_group_member(TALLOC_CTX *mem_ctx, struct ldb_message **msgs; int ret; const char *attrs[] = { NULL }; + const char *str_dn; uint32_t i; msg = ldb_msg_new(mem_ctx); @@ -696,7 +697,10 @@ static NTSTATUS samsync_ldb_handle_group_member(TALLOC_CTX *mem_ctx, } else if (ret > 1) { return NT_STATUS_INTERNAL_DB_CORRUPTION; } else { - samdb_msg_add_string(state->sam_ldb, mem_ctx, msg, "member", ldb_dn_alloc_linearized(mem_ctx, msgs[0]->dn)); + str_dn = ldb_dn_alloc_linearized(msg, msgs[0]->dn); + NT_STATUS_HAVE_NO_MEMORY(str_dn); + ret = ldb_msg_add_string(msg, "member", str_dn); + if (ret != LDB_SUCCESS) return NT_STATUS_NO_MEMORY; } talloc_free(msgs); @@ -893,6 +897,7 @@ static NTSTATUS samsync_ldb_handle_alias_member(TALLOC_CTX *mem_ctx, for (i=0; i<alias_member->sids.num_sids; i++) { struct ldb_dn *alias_member_dn; + const char *str_dn; /* search for members, in the top basedn (normal users are builtin aliases) */ ret = gendb_search(state->sam_ldb, mem_ctx, state->base_dn[SAM_DATABASE_DOMAIN], &msgs, attrs, "(objectSid=%s)", @@ -915,7 +920,10 @@ static NTSTATUS samsync_ldb_handle_alias_member(TALLOC_CTX *mem_ctx, } else { alias_member_dn = msgs[0]->dn; } - samdb_msg_add_string(state->sam_ldb, mem_ctx, msg, "member", ldb_dn_alloc_linearized(mem_ctx, alias_member_dn)); + str_dn = ldb_dn_alloc_linearized(msg, alias_member_dn); + NT_STATUS_HAVE_NO_MEMORY(str_dn); + ret = ldb_msg_add_string(msg, "member", str_dn); + if (ret != LDB_SUCCESS) return NT_STATUS_NO_MEMORY; talloc_free(msgs); } |