struct lls_parse_result *lpr;
int ret, ll;
struct client_task *ct;
- char *kf = NULL, *user, *errctx, *home = para_homedir();
+ char *kf = NULL, *user, *errctx;
ret = lls(lls_parse(argc, argv, cmd, &lpr, &errctx));
if (ret < 0)
kf = para_strdup(CLIENT_OPT_STRING_VAL(KEY_FILE, lpr));
else {
struct stat statbuf;
- 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");
free(kf);
+ 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);
}
}
*ct_ptr = ct;
ret = lls_num_inputs(lpr);
out:
- free(home);
if (ret < 0) {
if (errctx)
PARA_ERROR_LOG("%s\n", errctx);