From nobody Thu Dec 1 14:25:33 2022 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4NNJJZ00CFz4jLMg; Thu, 1 Dec 2022 14:25:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4NNJJY62c7z3sg6; Thu, 1 Dec 2022 14:25:33 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1669904733; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=1JY5qhoXcJLdd0ATdbSKznPc36rIZly8t7ZMI5cZIys=; b=AWlsahRCfx7n7iziCZV3piOeTcAcErQo4Bfc64dyzbwQTPYc6lr3/h3b3I3XUXIuOTQwLc /MlYN7u6xI4mS6XAWwna7LTSjirKmF7Lp8n8/N1QqtPzb9OL6qK5j0Zaj49nL5/WflYhmc ZCrmwsuy5+NVv+/w5GXdgPFd8aJhGxdC6Oy/w0uouJvF/LPiNI5oy0U428eoZpxEXIl+nW FQ6aq3tLTFvMV1zP2ChQzTF35v7K6VmeQ0fLc34Za/7gOCdzzQRN4aegr8iTkGLW3TcB1E anJsX2irEKJam/DDgSyHL40qfwSrYnlUylIOat9jVQrtHf1h7kFHmaAGikQ3zQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1669904733; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=1JY5qhoXcJLdd0ATdbSKznPc36rIZly8t7ZMI5cZIys=; b=uMr5A05MYIDT1aePC12OF3/LHi30awVGCOxSi5b/YnX3sXxEVxsLJD/LBFFSZw+uc94aw6 JQ9SZ4F1CQKNOzMTcTMaZKrYw2TFqK/1Q0LTmLAozfqECc8bDUQdP8GvXyxYYMH4PG1/+4 H52Ap981LeAIg5VvrMBi7+m+PnlMhSDaAsx3umQQAnP9IOzItK2BDRUapmw2QvusZsRMqa x9JM501TzHshmWpS4UnrOYY2+o314rWAUvvdhI3U6XSMag2Zfv3eGs33eio5GXzfUWqYG4 lo/l9VSlus6aVMBKaJNB80Mi3ouJ2L83jwbp9G5Gy/LKAl68AEjNSBO0xZqyxg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1669904733; a=rsa-sha256; cv=none; b=amJbuIQB/XituuCcrOKJm+tyjha/sJGXhRZPJsFaEB0ww9Yjmg8XaJ+ZtE6Bwx77flqEbt 3/5UjEJ/eiC6zk2FsBBe516so3IF8aSdV8jnI7aRgpuj9TTDA3ijLBYavC9SPQECrkEJRE IScLT94+LQY+CAslFitgZNDLDU/lD+aUuAJfrtMx/CAmsxNPip1aUQ/u06L/m2Xmp3DOls UPiVPAZlDtdr5JXljknAdcGVIEluXD4GIEx4R7m8bF3M0xxaF9hICT0Eh6QsQYiiJti7D2 N2YRZvTCNu7ti6v/PdqkuEL1nu24GQyGFhPJr7KHFYfCpuM7UTDCK+KEw1xHkw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4NNJJY55k5zfxW; Thu, 1 Dec 2022 14:25:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 2B1EPXFT079252; Thu, 1 Dec 2022 14:25:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2B1EPXum079251; Thu, 1 Dec 2022 14:25:33 GMT (envelope-from git) Date: Thu, 1 Dec 2022 14:25:33 GMT Message-Id: <202212011425.2B1EPXum079251@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Cy Schubert Subject: git: 9b631c331862 - stable/13 - heimdal: Add missing iprop error checks. List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cy X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 9b631c3318620b07fde837f46794b49aa786a279 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by cy: URL: https://cgit.FreeBSD.org/src/commit/?id=9b631c3318620b07fde837f46794b49aa786a279 commit 9b631c3318620b07fde837f46794b49aa786a279 Author: Cy Schubert AuthorDate: 2022-11-26 18:19:55 +0000 Commit: Cy Schubert CommitDate: 2022-12-01 14:25:11 +0000 heimdal: Add missing iprop error checks. Inspired by upstream 9d6dd21256f87988605fa75172be9cc92535064c. Obtained from: Heimdal 9d6dd21256f87988605fa75172be9cc92535064c (cherry picked from commit 5040a7a9aa67861a095bae6edfbc67572cd24457) --- crypto/heimdal/lib/kadm5/iprop-log.c | 48 ++++++++++++++++++++++-------------- 1 file changed, 30 insertions(+), 18 deletions(-) diff --git a/crypto/heimdal/lib/kadm5/iprop-log.c b/crypto/heimdal/lib/kadm5/iprop-log.c index b201de66d1f6..7e4e1a55ea9a 100644 --- a/crypto/heimdal/lib/kadm5/iprop-log.c +++ b/crypto/heimdal/lib/kadm5/iprop-log.c @@ -134,21 +134,29 @@ print_entry(kadm5_server_context *server_context, op_names[op], ver, t, len); switch(op) { case kadm_delete: - krb5_ret_principal(sp, &source); - krb5_unparse_name(scontext, source, &name1); + ret = krb5_unparse_name(scontext, source, &name1); + if (ret == 0) + ret = krb5_ret_principal(sp, &source); + if (ret) + krb5_err(scontext, 1, ret, "Failed to read a delete record"); printf(" %s\n", name1); free(name1); krb5_free_principal(scontext, source); break; case kadm_rename: ret = krb5_data_alloc(&data, len); + if (ret == 0) + krb5_ret_principal(sp, &source); + if (ret == 0 && krb5_storage_read(sp, data.data, data.length)) + ret = errno; + if (ret == 0) + ret = hdb_value2entry(scontext, &data, &ent); + if (ret == 0) + ret = krb5_unparse_name(scontext, source, &name1); + if (ret == 0) + ret = krb5_unparse_name(scontext, ent.principal, &name2); if (ret) krb5_err (scontext, 1, ret, "kadm_rename: data alloc: %d", len); - krb5_ret_principal(sp, &source); - krb5_storage_read(sp, data.data, data.length); - hdb_value2entry(scontext, &data, &ent); - krb5_unparse_name(scontext, source, &name1); - krb5_unparse_name(scontext, ent.principal, &name2); printf(" %s -> %s\n", name1, name2); free(name1); free(name2); @@ -157,26 +165,30 @@ print_entry(kadm5_server_context *server_context, break; case kadm_create: ret = krb5_data_alloc(&data, len); + if (ret == 0 && krb5_storage_read(sp, data.data, data.length)) + ret = errno; + if (ret == 0) + ret = hdb_value2entry(scontext, &data, &ent); if (ret) krb5_err (scontext, 1, ret, "kadm_create: data alloc: %d", len); - krb5_storage_read(sp, data.data, data.length); - ret = hdb_value2entry(scontext, &data, &ent); - if(ret) - abort(); mask = ~0; goto foo; case kadm_modify: ret = krb5_data_alloc(&data, len); + if (ret == 0) + ret = krb5_ret_int32(sp, &mask); + if (ret == 0 && krb5_storage_read(sp, data.data, data.length)) + ret = errno; + if (ret == 0) + ret = hdb_value2entry(scontext, &data, &ent); if (ret) krb5_err (scontext, 1, ret, "kadm_modify: data alloc: %d", len); - krb5_ret_int32(sp, &mask); - krb5_storage_read(sp, data.data, data.length); - ret = hdb_value2entry(scontext, &data, &ent); - if(ret) - abort(); foo: if(ent.principal /* mask & KADM5_PRINCIPAL */) { - krb5_unparse_name(scontext, ent.principal, &name1); + ret = krb5_unparse_name(scontext, ent.principal, &name1); + if (ret) + krb5_err(scontext, 1, ret, + "Failed to process a create or modify record"); printf(" principal = %s\n", name1); free(name1); } @@ -260,7 +272,7 @@ print_entry(kadm5_server_context *server_context, case kadm_nop : break; default: - abort(); + krb5_errx(scontext, 1, "Unknown record type"); } krb5_storage_seek(sp, end, SEEK_SET); }