]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - client_common.c
Replace get_homedir() by get_confdir().
[paraslash.git] / client_common.c
index e207684e61121b18333ce3a99b476b8f92511d6c..a2ec50f12929a5b6329ad813c44ce6aff7cde68b 100644 (file)
@@ -582,9 +582,15 @@ int client_parse_config(int argc, char *argv[], struct client_task **ct_ptr,
                kf = para_strdup(CLIENT_OPT_STRING_VAL(KEY_FILE, lpr));
        else {
                struct stat statbuf;
-               const char *home = get_homedir();
-               kf = make_message("%s/.paraslash/key.%s", home, user);
+               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");
+                       if (!home || !*home) {
+                               ret = -ERRNO_TO_PARA_ERROR(EINVAL);
+                               errctx = make_message("HOME unset or empty");
+                               goto out;
+                       }
                        free(kf);
                        kf = make_message("%s/.ssh/id_rsa", home);
                }