diff --git a/ssh-pkcs11-client.c b/ssh-pkcs11-client.c index 3b49cc538..3266e4e44 100644 --- a/ssh-pkcs11-client.c +++ b/ssh-pkcs11-client.c @@ -165,20 +165,14 @@ find_helper(void) char module_path[PATH_MAX + 1]; char *ep; DWORD n; - -#ifdef WINDOWS size_t len = 0; + _dupenv_s(&helper, &len, "SSH_PKCS11_HELPER"); if (helper == NULL || len == 0) { if ((helper = find_helper_in_module_path()) == NULL) helper = _PATH_SSH_PKCS11_HELPER; } -#else - if ((helper = getenv("SSH_PKCS11_HELPER")) == NULL || strlen(helper) == 0) { - if ((helper = find_helper_in_module_path()) == NULL) - helper = _PATH_SSH_PKCS11_HELPER; - } -#endif /* WINDOWS */ + if (!path_absolute(helper)) { error_f("helper \"%s\" unusable: path not absolute", helper); return NULL; diff --git a/ssh-sk-client.c b/ssh-sk-client.c index b6a71dcc9..88b9e8c2e 100644 --- a/ssh-sk-client.c +++ b/ssh-sk-client.c @@ -84,20 +84,14 @@ find_helper(void) char module_path[PATH_MAX + 1]; char *ep; DWORD n; - -#ifdef WINDOWS size_t len = 0; + _dupenv_s(&helper, &len, "SSH_SK_HELPER"); if (helper == NULL || len == 0) { if ((helper = find_helper_in_module_path()) == NULL) helper = _PATH_SSH_SK_HELPER; } -#else - if ((helper = getenv("SSH_SK_HELPER")) == NULL || strlen(helper) == 0) { - if ((helper = find_helper_in_module_path()) == NULL) - helper = _PATH_SSH_SK_HELPER; - } -#endif /* WINDOWS */ + if (!path_absolute(helper)) { error_f("helper \"%s\" unusable: path not absolute", helper); return NULL;