From nobody Thu Dec 1 14:26:11 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 4NNJKH5zP4z4jLNC; Thu, 1 Dec 2022 14:26:11 +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 4NNJKH5HCPz3wCm; Thu, 1 Dec 2022 14:26:11 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1669904771; 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=ouunsBtEIBtcPJ3taXjZnWTc3Jq4So+6Sfsd9xXr6hk=; b=po99tyIa36X70wntoXkf5dNuD45nEhXh5DZKmqBK8DgmNqZSaUwapCozIlZIeP0YcCd7NI eGhTZ1HstUSJspw/sC1o6aYjcxWrBUf0pLf638Dz+Zn1ZJ1B3pn14ILyvsFIqWskAVJNfC aEmGKmNSFMGw4B8jLJRujgtrtoHHidrywJeb9jBc/0++TrHoeVesaCd5RDEqj3wE9aB5Oi A3NhqjlONu4pQOytENO/YGtjZtPnD4UuvFIZs+ha0HQyTcQPQT3USI5sD+ENwuoIUWKFbv /WJo2ickRLBXp/QkUqSih0VRaZTTQbMyoQD7ILtFnYqxvi+PSHyA6qKQVMYSeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1669904771; 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=ouunsBtEIBtcPJ3taXjZnWTc3Jq4So+6Sfsd9xXr6hk=; b=Gc6U2DVM36EwyYUspSD8wDW/xcvpHoWHv2rO0+AaoybAvEyi7+KIwA2NKciyAQKFol8Hqq u1mmbjngTKRQmXWP8X0028GFsMOrCcvUd+F05FNpLegjwMbvWoNRhHwyD6eEypRah8vMfV pWUEry5KZV4oozkR5D8SQy3LJ5+tywZoe45Yotpxp7aGFF2Hc+Ns0lAv98d4arqZnLvQRr erFnqfY1QXr3nji/r7gUAVobTvH+BXV6WaNnqmG8rUVZcpet0kEN7ya6xh1MQD/3I1wh/O iDfcCNc9A/804njf7LGKji61flD3GM3bwDHslRI6a8XQQfJwxhXLYNoIURQsjw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1669904771; a=rsa-sha256; cv=none; b=ORybyWcJFEDo2IlDXfnIcWM/eBwfNLVYihd6OLV5wKey6S58u03Ws7X2VwGV7SsxGYzOB/ uVxfiu3Um/xhKIH6X2u1XRYxpnnM9fG9rhX1IbekJHZ49CYU4+AfnUoTEzNTeSf3VDbzHS 4nBmSP0IHcGABsh+5qjEKZDm6p865LdTFXNGRWjXAYFyWoH/62B3auIYHQpPeAP+vT5Fmd HF0jDRmuzTcXE36wGwwZdO5f1WIdETJ1O5A0JYZv0yiViFlN1Jc7CVbqgddc1gRu9dV5vO fVbFWWRTYv5stGyHwD1rqZz1WADjrKcwu6LWph6EG0DIanfOVBOvMy7OozO6oQ== 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 4NNJKH4NwlzfWg; Thu, 1 Dec 2022 14:26:11 +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 2B1EQBg9079762; Thu, 1 Dec 2022 14:26:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2B1EQBsb079761; Thu, 1 Dec 2022 14:26:11 GMT (envelope-from git) Date: Thu, 1 Dec 2022 14:26:11 GMT Message-Id: <202212011426.2B1EQBsb079761@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: 593699ac6446 - stable/12 - 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/12 X-Git-Reftype: branch X-Git-Commit: 593699ac64463aafd30d16ed206b230c4ba0dafc Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by cy: URL: https://cgit.FreeBSD.org/src/commit/?id=593699ac64463aafd30d16ed206b230c4ba0dafc commit 593699ac64463aafd30d16ed206b230c4ba0dafc Author: Cy Schubert AuthorDate: 2022-11-26 18:19:55 +0000 Commit: Cy Schubert CommitDate: 2022-12-01 14:25:53 +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); }