From patchwork Tue Jun 7 08:19:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: marcel@linux-ng.de X-Patchwork-Id: 12871503 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 27804C43334 for ; Tue, 7 Jun 2022 08:19:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238100AbiFGITf (ORCPT ); Tue, 7 Jun 2022 04:19:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46318 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238118AbiFGITe (ORCPT ); Tue, 7 Jun 2022 04:19:34 -0400 Received: from mail.linux-ng.de (srv.linux-ng.de [5.9.18.165]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 8F2E825C6D for ; Tue, 7 Jun 2022 01:19:32 -0700 (PDT) Received: from rpi4.linux-ng.de (unknown [192.168.1.79]) by mail.linux-ng.de (Postfix) with ESMTPS id 6839283DE6D0; Tue, 7 Jun 2022 10:19:31 +0200 (CEST) Received: by rpi4.linux-ng.de (Postfix, from userid 1000) id 275C2BBEC0; Tue, 7 Jun 2022 10:19:31 +0200 (CEST) From: marcel@linux-ng.de To: linux-nfs@vger.kernel.org Cc: Marcel Ritter Subject: [PATCH 1/3] cifs-utils/svcgssd: Fix use-after-free bug (config variables) Date: Tue, 7 Jun 2022 10:19:07 +0200 Message-Id: <20220607081909.1216287-1-marcel@linux-ng.de> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Marcel Ritter This patch fixes a bug when trying to set "principal" in /etc/nfs.conf. Memory gets freed by conf_cleanup() before being used - moving cleanup code resolves that. --- utils/gssd/svcgssd.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/utils/gssd/svcgssd.c b/utils/gssd/svcgssd.c index 881207b3..a242b789 100644 --- a/utils/gssd/svcgssd.c +++ b/utils/gssd/svcgssd.c @@ -211,9 +211,6 @@ main(int argc, char *argv[]) rpc_verbosity = conf_get_num("svcgssd", "RPC-Verbosity", rpc_verbosity); idmap_verbosity = conf_get_num("svcgssd", "IDMAP-Verbosity", idmap_verbosity); - /* We don't need the config anymore */ - conf_cleanup(); - while ((opt = getopt(argc, argv, "fivrnp:")) != -1) { switch (opt) { case 'f': @@ -328,6 +325,9 @@ main(int argc, char *argv[]) daemon_ready(); + /* We don't need the config anymore */ + conf_cleanup(); + nfs4_init_name_mapping(NULL); /* XXX: should only do this once */ rc = event_base_dispatch(evbase); From patchwork Tue Jun 7 08:19:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: marcel@linux-ng.de X-Patchwork-Id: 12871504 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C82A8C43334 for ; Tue, 7 Jun 2022 08:19:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238125AbiFGITm (ORCPT ); Tue, 7 Jun 2022 04:19:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46624 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238118AbiFGITm (ORCPT ); Tue, 7 Jun 2022 04:19:42 -0400 X-Greylist: delayed 52647 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Tue, 07 Jun 2022 01:19:39 PDT Received: from mail.linux-ng.de (srv.linux-ng.de [IPv6:2a01:4f8:160:92e6::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E70152CE04 for ; Tue, 7 Jun 2022 01:19:39 -0700 (PDT) Received: from rpi4.linux-ng.de (unknown [192.168.1.79]) by mail.linux-ng.de (Postfix) with ESMTPS id A7FED83DE6D4; Tue, 7 Jun 2022 10:19:38 +0200 (CEST) Received: by rpi4.linux-ng.de (Postfix, from userid 1000) id 7262BBBEC0; Tue, 7 Jun 2022 10:19:38 +0200 (CEST) From: marcel@linux-ng.de To: linux-nfs@vger.kernel.org Cc: Marcel Ritter Subject: [PATCH 2/3] cifs-utils/svcgssd: Display principal if set Date: Tue, 7 Jun 2022 10:19:08 +0200 Message-Id: <20220607081909.1216287-2-marcel@linux-ng.de> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220607081909.1216287-1-marcel@linux-ng.de> References: <20220607081909.1216287-1-marcel@linux-ng.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Marcel Ritter It's a little irritating to only see the template "<...>@<...>" if you set a specific principal name. So let's show it (if set). --- utils/gssd/svcgssd.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/utils/gssd/svcgssd.c b/utils/gssd/svcgssd.c index a242b789..ce78d8f7 100644 --- a/utils/gssd/svcgssd.c +++ b/utils/gssd/svcgssd.c @@ -295,9 +295,9 @@ main(int argc, char *argv[]) (const gss_OID)GSS_C_NT_HOSTBASED_SERVICE); if (status == FALSE) { printerr(0, "unable to obtain root (machine) credentials\n"); - printerr(0, "do you have a keytab entry for " - "nfs/@ in " - "/etc/krb5.keytab?\n"); + printerr(0, "do you have a keytab entry for %s in" + "/etc/krb5.keytab?\n", + principal ? principal : "nfs/@"); exit(1); } } else { From patchwork Tue Jun 7 08:19:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: marcel@linux-ng.de X-Patchwork-Id: 12871505 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 62A8CC433EF for ; Tue, 7 Jun 2022 08:19:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238118AbiFGITn (ORCPT ); Tue, 7 Jun 2022 04:19:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46652 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238122AbiFGITm (ORCPT ); Tue, 7 Jun 2022 04:19:42 -0400 Received: from mail.linux-ng.de (srv.linux-ng.de [IPv6:2a01:4f8:160:92e6::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 7C1D625C6D for ; Tue, 7 Jun 2022 01:19:40 -0700 (PDT) Received: from rpi4.linux-ng.de (unknown [192.168.1.79]) by mail.linux-ng.de (Postfix) with ESMTPS id 19DC883DE6D5; Tue, 7 Jun 2022 10:19:40 +0200 (CEST) Received: by rpi4.linux-ng.de (Postfix, from userid 1000) id D999ABBEC0; Tue, 7 Jun 2022 10:19:39 +0200 (CEST) From: marcel@linux-ng.de To: linux-nfs@vger.kernel.org Cc: Marcel Ritter Subject: [PATCH 3/3] cifs-utils/svcgssd: Add (undocumented) config options to man page Date: Tue, 7 Jun 2022 10:19:09 +0200 Message-Id: <20220607081909.1216287-3-marcel@linux-ng.de> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220607081909.1216287-1-marcel@linux-ng.de> References: <20220607081909.1216287-1-marcel@linux-ng.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Marcel Ritter There seem to be some undocumented options implemented. Why not mention them in the man page? --- utils/gssd/svcgssd.man | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/utils/gssd/svcgssd.man b/utils/gssd/svcgssd.man index 15ef4c94..8771c035 100644 --- a/utils/gssd/svcgssd.man +++ b/utils/gssd/svcgssd.man @@ -61,6 +61,19 @@ this is equivalent to the option. If set to any other value, that is used like the .B -p option. +.TP +.B verbosity +Value which is equivalent to the number of +.BR -v . +.TP +.B rpc-verbosity +Value which is equivalent to the number of +.BR -r . +.TP +.B idmap-verbosity +Value which is equivalent to the number of +.BR -i . + .SH SEE ALSO .BR rpc.gssd(8),