From nobody Sun Nov 27 02:44:06 2022 X-Original-To: dev-commits-src-main@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 4NKXx31XDzz4hmR9; Sun, 27 Nov 2022 02:44:07 +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 4NKXx30jZMz3R2J; Sun, 27 Nov 2022 02:44:07 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1669517047; 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=axuxEb4dGE0NLIO6OD/h0m7uwUZGTlpBxMCagSbz50w=; b=HeoKLW1x8OBzxJAKamOe5PY0+kRrJs74zcfQ21AY2A/PUNso8BTmvhtX6DnLC/D2vaXN5X nZ5bxx0LzAjgbBaqfE/nb+JPcKiODzy2I696PuOqaI+PHcGbyPOim16XstZ1YkkhoQOe6i 8XJ3E96Pk6zmy2sHVK8RunCFjwBKzvopvw5bB7Kj48s6Ed/cPHZvGsTxxxQOalM75r+2K+ bCriqayiIE55fuzhhsAAE0CSZZyNFVqzxG0Og56VKuHMx6cKTEpQ3OZ4qb2HvVhcG5jECh tr5W3uViKBYd2CsNPYxNhcIzW64dyEb4XoHOJFts2lFRYis521EJB9RXMl8m9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1669517047; 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=axuxEb4dGE0NLIO6OD/h0m7uwUZGTlpBxMCagSbz50w=; b=SoEsHl7lsARsAcTvVaGg+oCcxX5L4M887PkIKr6aqMjnkpTp+jkSWOly+v0dXeGgkSoF/O /mTDG8orqUJcCpZEnD/zpX4iV6AVjaTLjjXnKqZ7dX08/bApv6JxFxJinDAqkHjX7MT+ZW QbrrZiqik0Dwx1i/6Wy0P9qTXeXrjB20JoeOkcXxwvBrx9VCDbLFv2lHjz8IQGo6Iq50kd 6z5UXANF4LnyiHNfhOVmb1aupIt9VqgefP82taT3a+HPQilQXZCtcwIAZjxi58jatmIU7w 4kwfyr245sTtWkKuY5BptAr5uLYa5Y4Q48G+EXB0Ib6zxk7/BrS7IFBBw8oyBg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1669517047; a=rsa-sha256; cv=none; b=AqzVxUjsa+UZcp68jiRDD86Jvt1TiLl3R5KExFwdp6MGH2gGH5OInhK2zUkvvz+Ic8uAEu xVXt8LH81lYt+6qpDTXiCYRE308ZRntlofCt7YLen7QhEfZwW5uovf3QGM+ULi2tZyqExP ji4tjBd29bkPBTnLXZl5e5z2j5+Xns9DdEdFOCl4vstv12lODE308HYw2LCUAIpUjMzLHm em/6J46icD6dDa7PwrysdcXZb8USOoPKvMkNXmNElZLEw0jJfRIbfvF8AX+u7mtGMxgvNc OLkLAxDHScAJKb+3chPhpjM2DzkCFqZuiAK4TtY0fZgJ3Zx3JgS6zPy5NfOZ+A== 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 4NKXx26tg7zjVt; Sun, 27 Nov 2022 02:44:06 +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 2AR2i6Ie088324; Sun, 27 Nov 2022 02:44:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2AR2i6Q6088323; Sun, 27 Nov 2022 02:44:06 GMT (envelope-from git) Date: Sun, 27 Nov 2022 02:44:06 GMT Message-Id: <202211270244.2AR2i6Q6088323@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Cy Schubert Subject: git: 5040a7a9aa67 - main - heimdal: Add missing iprop error checks. List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: 5040a7a9aa67861a095bae6edfbc67572cd24457 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by cy: URL: https://cgit.FreeBSD.org/src/commit/?id=5040a7a9aa67861a095bae6edfbc67572cd24457 commit 5040a7a9aa67861a095bae6edfbc67572cd24457 Author: Cy Schubert AuthorDate: 2022-11-26 18:19:55 +0000 Commit: Cy Schubert CommitDate: 2022-11-27 02:41:52 +0000 heimdal: Add missing iprop error checks. Inspired by upstream 9d6dd21256f87988605fa75172be9cc92535064c. Obtained from: Heimdal 9d6dd21256f87988605fa75172be9cc92535064c MFC after: 3 days --- 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); }