]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
f
authorAndre Noll <maan@tuebingen.mpg.de>
Thu, 21 Mar 2024 16:27:44 +0000 (17:27 +0100)
committerAndre Noll <maan@tuebingen.mpg.de>
Fri, 22 Mar 2024 12:52:48 +0000 (13:52 +0100)
client_common.c

index e67a938b4df8aa69c2536505ce86c5017ab469b2..81673a7dc5c422814b0e65cfcda52037acceb580 100644 (file)
@@ -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);