1
1

tests/pkd: Fix OpenSSH version check

When running in FIPS mode, the OpenSSH version is not the first string
printed by "ssh -V".  This makes the parser to find the first occurrence
of the version ignoring anything printed before it.

Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Этот коммит содержится в:
Anderson Toshiyuki Sasaki 2019-06-13 13:51:41 +02:00 коммит произвёл Andreas Schneider
родитель 905b027f0f
Коммит 5568e5e520

Просмотреть файл

@ -43,7 +43,8 @@ static int bin_exists(const char *binary) {
static int is_openssh_client_new_enough(void) {
int rc = -1;
FILE *fp = NULL;
char version[1024] = { 0 };
char version_buff[1024] = { 0 };
char *version;
static int version_ok = 0;
unsigned long int major = 0;
@ -59,10 +60,13 @@ static int is_openssh_client_new_enough(void) {
goto done;
}
if (fgets(&version[0], sizeof(version), fp) == NULL) {
do {
if (fgets(&version_buff[0], sizeof(version_buff), fp) == NULL) {
fprintf(stderr, "failed to get OpenSSH client version string\n");
goto errfgets;
}
version = strstr(version_buff, "OpenSSH");
} while(version == NULL);
/* "OpenSSH_<major>.<minor><SP>..." */
if (strlen(version) < 11) {