ntpd: Use dom_sid_str_buf
authorVolker Lendecke <vl@samba.org>
Sun, 16 Dec 2018 16:02:54 +0000 (17:02 +0100)
committerJeremy Allison <jra@samba.org>
Tue, 8 Jan 2019 02:40:28 +0000 (03:40 +0100)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source4/ntp_signd/ntp_signd.c

index 5999bf8..5db4892 100644 (file)
@@ -112,6 +112,7 @@ static NTSTATUS ntp_signd_process(struct ntp_signd_connection *ntp_signd_conn,
        MD5_CTX ctx;
        struct samr_Password *nt_hash;
        uint32_t user_account_control;
+       struct dom_sid_buf buf;
        int ret;
 
        ndr_err = ndr_pull_struct_blob_all(input, mem_ctx,
@@ -171,7 +172,7 @@ static NTSTATUS ntp_signd_process(struct ntp_signd_connection *ntp_signd_conn,
        if (ret != LDB_SUCCESS) {
                DEBUG(2, ("Failed to search for SID %s in SAM for NTP signing: "
                          "%s\n",
-                         dom_sid_string(mem_ctx, sid),
+                         dom_sid_str_buf(sid, &buf),
                          ldb_errstring(ntp_signd_conn->ntp_signd->samdb)));
                return signing_failure(ntp_signd_conn,
                                       mem_ctx,
@@ -181,14 +182,15 @@ static NTSTATUS ntp_signd_process(struct ntp_signd_connection *ntp_signd_conn,
 
        if (res->count == 0) {
                DEBUG(2, ("Failed to find SID %s in SAM for NTP signing\n",
-                         dom_sid_string(mem_ctx, sid)));
+                         dom_sid_str_buf(sid, &buf)));
                return signing_failure(ntp_signd_conn,
                                       mem_ctx,
                                       output,
                                       sign_request.packet_id);
        } else if (res->count != 1) {
                DEBUG(1, ("Found SID %s %u times in SAM for NTP signing\n",
-                         dom_sid_string(mem_ctx, sid), res->count));
+                         dom_sid_str_buf(sid, &buf),
+                         res->count));
                return signing_failure(ntp_signd_conn,
                                       mem_ctx,
                                       output,
@@ -202,21 +204,22 @@ static NTSTATUS ntp_signd_process(struct ntp_signd_connection *ntp_signd_conn,
        if (user_account_control & UF_ACCOUNTDISABLE) {
                DEBUG(1, ("Account %s for SID [%s] is disabled\n",
                          ldb_dn_get_linearized(res->msgs[0]->dn),
-                         dom_sid_string(mem_ctx, sid)));
+                         dom_sid_str_buf(sid, &buf)));
                return NT_STATUS_ACCESS_DENIED;
        }
 
        if (!(user_account_control & (UF_INTERDOMAIN_TRUST_ACCOUNT|UF_SERVER_TRUST_ACCOUNT|UF_WORKSTATION_TRUST_ACCOUNT))) {
                DEBUG(1, ("Account %s for SID [%s] is not a trust account\n",
                          ldb_dn_get_linearized(res->msgs[0]->dn),
-                         dom_sid_string(mem_ctx, sid)));
+                         dom_sid_str_buf(sid, &buf)));
                return NT_STATUS_ACCESS_DENIED;
        }
 
        nt_hash = samdb_result_hash(mem_ctx, res->msgs[0], "unicodePwd");
        if (!nt_hash) {
                DEBUG(1, ("No unicodePwd found on record of SID %s "
-                         "for NTP signing\n", dom_sid_string(mem_ctx, sid)));
+                         "for NTP signing\n",
+                         dom_sid_str_buf(sid, &buf)));
                return signing_failure(ntp_signd_conn,
                                       mem_ctx,
                                       output,