Hey
Here's my first public patch (numbered 3 since I made a few ones before
internally). I'm posting it here to attract your reviews and comments on the
general approach on the API etc. It is NOT complete, it has remaining bugs and
it leaks memory.
Some words on my changes:
* The old patch. I did not use the former patch and in fact I didn't even look
at it when I implemented it as I saw no point in doing that. I did read a
bunch of OpenSSH source code to figure out their file format though.
* linked list code. I got a bit tired of the fact that we don't have any
generic linked-list functions within libssh2 so I wrote up the first embryo
for one that I use for this new functionality. The plan would then be to
move all existing code that uses linked lists to use this new set.
* base64 encode. I had to add a base64 encoding function which was missing
in the code base so it helps to "bloat" my patch.
* The API is basically:
_init() - init a bundle of known hosts
_add() - add a known host
_del() - delete a known host
_free() - free an entire bundle of known hosts
_check() - check if a host+key is present in the bundle
And then there's the convenience function:
_parsefile() - reads a ~/.ssh/known_hosts file and add all entries to the
given bundle
Still missing in the API:
A) I think we also want a _writefile() or similar that can write a
known_hosts, or perhaps append to it...
B) there's currently no accessor to the bundle so there's no actual way for
an app to access the list of hosts. Any suggestions on how such a one
would work best?
* there's no docs other than some comments in the code/headers yet
* the patch includes changes to example/simple/ssh2_exec.c that makes use of
a few of these functions. Using that I've verified that the functions in
fact can verify my localhost's key agains my ~/.ssh/known_hosts file
* diffstat says:
example/simple/ssh2_exec.c | 42 ++-
include/libssh2.h | 117 ++++++++++
src/Makefile.am | 3
src/hostkey.c | 486 +++++++++++++++++++++++++++++++++++++++++++++
src/kex.c | 14 -
src/libssh2_priv.h | 38 +++
src/misc.c | 129 +++++++++++
src/misc.h | 61 +++++
8 files changed, 864 insertions(+), 26 deletions(-)
Fire away!
-- / daniel.haxx.se
------------------------------------------------------------------------------
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image
processing features enabled. http://p.sf.net/sfu/kodak-com
_______________________________________________
libssh2-devel mailing list
libssh2-devel_at_lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libssh2-devel