public inbox for kernel-tls-handshake@lists.linux.dev
 help / color / mirror / Atom feed
From: Chuck Lever <cel@kernel.org>
To: <kernel-tls-handshake@lists.linux.dev>
Cc: Chuck Lever <chuck.lever@oracle.com>
Subject: [PATCH 2/5] tlshd: Remove unneeded variable "error"
Date: Tue, 10 Jun 2025 09:25:47 -0400	[thread overview]
Message-ID: <20250610132550.39715-3-cel@kernel.org> (raw)
In-Reply-To: <20250610132550.39715-1-cel@kernel.org>

From: Chuck Lever <chuck.lever@oracle.com>

Clean up: Commit c380357cf8f1 ("tlshd: Demote warnings about missing
options") removed some debug messages that used the local "error"
variable. "error" is passed to glib, but the returned value is no
longer checked or used.

Fixes: c380357cf8f1 ("tlshd: Demote warnings about missing options")
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
 src/tlshd/config.c | 44 ++++++++++++++------------------------------
 1 file changed, 14 insertions(+), 30 deletions(-)

diff --git a/src/tlshd/config.c b/src/tlshd/config.c
index f4907ebb1a54..e050d3df6050 100644
--- a/src/tlshd/config.c
+++ b/src/tlshd/config.c
@@ -193,15 +193,13 @@ out:
  */
 bool tlshd_config_get_client_truststore(char **bundle)
 {
-	GError *error = NULL;
 	gchar *pathname;
 
 	pathname = g_key_file_get_string(tlshd_configuration, "authenticate.client",
-					 "x509.truststore", &error);
-	if (!pathname) {
-		g_error_free(error);
+					 "x509.truststore", NULL);
+	if (!pathname)
 		return false;
-	} else if (access(pathname, F_OK)) {
+	if (access(pathname, F_OK)) {
 		tlshd_log_debug("tlshd cannot access \"%s\"", pathname);
 		g_free(pathname);
 		return false;
@@ -228,17 +226,14 @@ bool tlshd_config_get_client_truststore(char **bundle)
 bool tlshd_config_get_client_certs(gnutls_pcert_st *certs,
 				   unsigned int *certs_len)
 {
-	GError *error = NULL;
 	gnutls_datum_t data;
 	gchar *pathname;
 	int ret;
 
 	pathname = g_key_file_get_string(tlshd_configuration, "authenticate.client",
-					"x509.certificate", &error);
-	if (!pathname) {
-		g_error_free(error);
+					"x509.certificate", NULL);
+	if (!pathname)
 		return false;
-	}
 
 	if (!tlshd_config_read_datum(pathname, &data, TLSHD_OWNER,
 				     TLSHD_CERT_MODE)) {
@@ -272,17 +267,14 @@ bool tlshd_config_get_client_certs(gnutls_pcert_st *certs,
  */
 bool tlshd_config_get_client_privkey(gnutls_privkey_t *privkey)
 {
-	GError *error = NULL;
 	gnutls_datum_t data;
 	gchar *pathname;
 	int ret;
 
 	pathname = g_key_file_get_string(tlshd_configuration, "authenticate.client",
-					"x509.private_key", &error);
-	if (!pathname) {
-		g_error_free(error);
+					"x509.private_key", NULL);
+	if (!pathname)
 		return false;
-	}
 
 	if (!tlshd_config_read_datum(pathname, &data, TLSHD_OWNER,
 				     TLSHD_PRIVKEY_MODE)) {
@@ -323,15 +315,13 @@ bool tlshd_config_get_client_privkey(gnutls_privkey_t *privkey)
  */
 bool tlshd_config_get_server_truststore(char **bundle)
 {
-	GError *error = NULL;
 	gchar *pathname;
 
 	pathname = g_key_file_get_string(tlshd_configuration, "authenticate.server",
-					 "x509.truststore", &error);
-	if (!pathname) {
-		g_error_free(error);
+					 "x509.truststore", NULL);
+	if (!pathname)
 		return false;
-	} else if (access(pathname, F_OK)) {
+	if (access(pathname, F_OK)) {
 		tlshd_log_debug("tlshd cannot access \"%s\"", pathname);
 		g_free(pathname);
 		return false;
@@ -358,17 +348,14 @@ bool tlshd_config_get_server_truststore(char **bundle)
 bool tlshd_config_get_server_certs(gnutls_pcert_st *certs,
 				   unsigned int *certs_len)
 {
-	GError *error = NULL;
 	gnutls_datum_t data;
 	gchar *pathname;
 	int ret;
 
 	pathname = g_key_file_get_string(tlshd_configuration, "authenticate.server",
-					"x509.certificate", &error);
-	if (!pathname) {
-		g_error_free(error);
+					"x509.certificate", NULL);
+	if (!pathname)
 		return false;
-	}
 
 	if (!tlshd_config_read_datum(pathname, &data, TLSHD_OWNER,
 				     TLSHD_CERT_MODE)) {
@@ -402,17 +389,14 @@ bool tlshd_config_get_server_certs(gnutls_pcert_st *certs,
  */
 bool tlshd_config_get_server_privkey(gnutls_privkey_t *privkey)
 {
-	GError *error = NULL;
 	gnutls_datum_t data;
 	gchar *pathname;
 	int ret;
 
 	pathname = g_key_file_get_string(tlshd_configuration, "authenticate.server",
-					"x509.private_key", &error);
-	if (!pathname) {
-		g_error_free(error);
+					"x509.private_key", NULL);
+	if (!pathname)
 		return false;
-	}
 
 	if (!tlshd_config_read_datum(pathname, &data, TLSHD_OWNER,
 				     TLSHD_PRIVKEY_MODE)) {
-- 
2.49.0


  parent reply	other threads:[~2025-06-10 13:25 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-10 13:25 [PATCH 0/5] Kick off ktls-utils 1.2 development Chuck Lever
2025-06-10 13:25 ` [PATCH 1/5] tlshd: Fix a minor race Chuck Lever
2025-06-10 13:25 ` Chuck Lever [this message]
2025-06-10 13:25 ` [PATCH 3/5] workflows: Limit permission of the makefile.yml action Chuck Lever
2025-06-10 13:25 ` [PATCH 4/5] tlshd: Add default keyrings for NFS Chuck Lever
2025-06-10 13:25 ` [PATCH 5/5] tlshd: Relocate TLSHD_ALLPERMS Chuck Lever

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250610132550.39715-3-cel@kernel.org \
    --to=cel@kernel.org \
    --cc=chuck.lever@oracle.com \
    --cc=kernel-tls-handshake@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox