From 908ef16567c603be6e16b385c7ab0ba07d9e9eaa Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Mon, 7 Jan 2019 21:03:06 +0100 Subject: [PATCH] libnet: Use dom_sid_str_buf Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison --- source4/libnet/libnet_samsync_ldb.c | 40 +++++++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/source4/libnet/libnet_samsync_ldb.c b/source4/libnet/libnet_samsync_ldb.c index 3171138886c..68e9cd110a6 100644 --- a/source4/libnet/libnet_samsync_ldb.c +++ b/source4/libnet/libnet_samsync_ldb.c @@ -259,6 +259,7 @@ static NTSTATUS samsync_ldb_handle_user(TALLOC_CTX *mem_ctx, char *cn_name; int cn_name_len; const struct dom_sid *user_sid; + struct dom_sid_buf buf; struct ldb_message *msg; struct ldb_message **msgs; struct ldb_message **remote_msgs = NULL; @@ -288,15 +289,19 @@ static NTSTATUS samsync_ldb_handle_user(TALLOC_CTX *mem_ctx, ldap_encode_ndr_dom_sid(mem_ctx, user_sid)); if (ret == -1) { - *error_string = talloc_asprintf(mem_ctx, "LDB for user %s failed: %s", - dom_sid_string(mem_ctx, user_sid), - ldb_errstring(state->sam_ldb)); + *error_string = talloc_asprintf( + mem_ctx, + "LDB for user %s failed: %s", + dom_sid_str_buf(user_sid, &buf), + ldb_errstring(state->sam_ldb)); return NT_STATUS_INTERNAL_DB_CORRUPTION; } else if (ret == 0) { add = true; } else if (ret > 1) { - *error_string = talloc_asprintf(mem_ctx, "More than one user with SID: %s in local LDB", - dom_sid_string(mem_ctx, user_sid)); + *error_string = talloc_asprintf( + mem_ctx, + "More than one user with SID: %s in local LDB", + dom_sid_str_buf(user_sid, &buf)); return NT_STATUS_INTERNAL_DB_CORRUPTION; } else { msg->dn = msgs[0]->dn; @@ -310,18 +315,27 @@ static NTSTATUS samsync_ldb_handle_user(TALLOC_CTX *mem_ctx, ldap_encode_ndr_dom_sid(mem_ctx, user_sid)); if (ret == -1) { - *error_string = talloc_asprintf(mem_ctx, "remote LDAP for user %s failed: %s", - dom_sid_string(mem_ctx, user_sid), - ldb_errstring(state->remote_ldb)); + *error_string = talloc_asprintf( + mem_ctx, + "remote LDAP for user %s failed: %s", + dom_sid_str_buf(user_sid, &buf), + ldb_errstring(state->remote_ldb)); return NT_STATUS_INTERNAL_DB_CORRUPTION; } else if (ret == 0) { - *error_string = talloc_asprintf(mem_ctx, "User exists in samsync but not in remote LDAP domain! (base: %s, SID: %s)", - ldb_dn_get_linearized(state->base_dn[database]), - dom_sid_string(mem_ctx, user_sid)); + *error_string = talloc_asprintf( + mem_ctx, + "User exists in samsync but not in remote " + "LDAP domain! (base: %s, SID: %s)", + ldb_dn_get_linearized( + state->base_dn[database]), + dom_sid_str_buf(user_sid, &buf)); return NT_STATUS_NO_SUCH_USER; } else if (ret > 1) { - *error_string = talloc_asprintf(mem_ctx, "More than one user in remote LDAP domain with SID: %s", - dom_sid_string(mem_ctx, user_sid)); + *error_string = talloc_asprintf( + mem_ctx, + "More than one user in remote LDAP domain " + "with SID: %s", + dom_sid_str_buf(user_sid, &buf)); return NT_STATUS_INTERNAL_DB_CORRUPTION; /* Try to put things in the same location as the remote server */ -- 2.11.4.GIT