lavf/libssh: factorize open_file function