From 0e4041d35489add520ff095c8ed8753584814b8e Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Thu, 21 Mar 2024 17:27:44 +0100 Subject: [PATCH] f --- client_common.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/client_common.c b/client_common.c index e67a938b..81673a7d 100644 --- a/client_common.c +++ b/client_common.c @@ -585,8 +585,14 @@ int client_parse_config(int argc, char *argv[], struct client_task **ct_ptr, const char *confdir = get_confdir(); kf = make_message("%s/key.%s", confdir, user); if (stat(kf, &statbuf) != 0) { /* assume file does not exist */ + const char *home = getenv("HOME"); free(kf); - kf = make_message("%s/.ssh/id_rsa", confdir); + if (!home || !*home) { + ret = -ERRNO_TO_PARA_ERROR(EINVAL); + errctx = make_message("HOME unset or empty"); + goto out; + } + kf = make_message("%s/.ssh/id_rsa", home); } } PARA_INFO_LOG("user: %s\n", user); -- 2.39.2