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);