From 602d247e0ba9a69c22f087abaf44de7d12114538 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Thu, 25 Oct 2018 21:45:05 +0200 Subject: [PATCH] auth4: Use dom_sid_str_buf Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison --- source4/auth/sam.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/source4/auth/sam.c b/source4/auth/sam.c index bc95de223f4..38c4a248027 100644 --- a/source4/auth/sam.c +++ b/source4/auth/sam.c @@ -632,16 +632,14 @@ _PUBLIC_ NTSTATUS authsam_update_user_info_dc(TALLOC_CTX *mem_ctx, n = user_info_dc->num_sids; for (i = 0; i < n; i++) { struct dom_sid *sid = &user_info_dc->sids[i]; - char sid_buf[DOM_SID_STR_BUFLEN] = {0,}; - char dn_str[DOM_SID_STR_BUFLEN*2] = {0,}; + struct dom_sid_buf sid_buf; + char dn_str[sizeof(sid_buf.buf)*2]; DATA_BLOB dn_blob = data_blob_null; - int len; - len = dom_sid_string_buf(sid, sid_buf, sizeof(sid_buf)); - if ((len < 0) || (len+1 > sizeof(sid_buf))) { - return NT_STATUS_INVALID_SID; - } - snprintf(dn_str, sizeof(dn_str), "", sid_buf); + snprintf(dn_str, + sizeof(dn_str), + "", + dom_sid_str_buf(sid, &sid_buf)); dn_blob = data_blob_string_const(dn_str); /*