Subject: Error reporting

Error reporting

From: George Nachman <gnachman_at_llamas.org>
Date: Wed, 5 Dec 2018 22:36:10 -0800

I've noticed that libssh2 does not expose as much detail about errors as I
would like. For example, when scp'ing a file that does not exist, it
reports an error of "Failed to recv file" through
libssh2_session_last_error(). The real error was reported by the server,
and was "scp: ~/test.txt: No such file or directory". My users are confused
by the former and I would like to show them the latter.

My questions are:

1. Is there a good reason not to expose the text the server sends? At least
in the case of the "Failed to recv file" error it wouldn't be difficult to
add it to the error string. But perhaps that buffer can't be malloced or
clients expect that particular string back. Or maybe there's some security
angle I'm not seeing.
2. Would you accept a patch to fix this issue? I think I'd like to see
something along the lines of this:
  Failed to recv file. Server reported: "scp: ~/test.txt: No such file or
directory".

Thanks,
George

_______________________________________________
libssh2-devel https://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2018-12-06