In libssh-0.9.0, when a path to the known_hosts file is specified, libssh only tries to create the last directory in the path instead of trying to create all the non-existing directories recursively.
For example, if we have an existing empty /A_dir directory:
- If we set SSH_OPTIONS_KNOWNHOSTS with the string "/A_dir/B_dir/known_hosts", /A_dir/B_dir is created normally when writing the known_hosts file
- If we set SSH_OPTIONS_KNOWNHOSTS with the string "/A_dir/B_dir/C_dir/known_hosts", libssh fails trying to create /A_dir/B_dir/C_dir/ because /A_dir/B_dir/ does not exist
Originally reported as https://bugzilla.redhat.com/show_bug.cgi?id=1733914