Subject: Re: libssh2_knownhost_*

Re: libssh2_knownhost_*

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Thu, 28 May 2009 19:55:07 +0200 (CEST)

On Thu, 28 May 2009, Alexander Lamaison wrote:

> Oh dear. That's a shame :( I had a look at this article
> http://msdn.microsoft.com/en-us/library/ms235460.aspx and it says the
> problem only occurs when libssh2 or its client is linked to the CRT
> statically (/MT). Although I imagine this is uncommon, I don't think it
> would be good to forbid this (unless, of course, we already do?).

I don't think we do this anywhere.

>> Posssibly we should consider the API to instead make full lines and let the
>> app save those whereever it seems fit. Most people will not be able to get
>> FILE * pointers to store in memory anywaay. We'd need somsthing similar
>> done for the read function too then.
>
> I hadn't realised that knownhost_get wasn't returning lines and I
> agree that a line-based API is necessary.

The entire knownhost concept is about keeping a collection of known hosts and
knownhost_get() is about traversing that list. It really has nothing to do
with files or file formats, it just gives the app all info about known hosts.

Using that info, an app can produce a known_hosts file or whatever file format
it needs.

> I think this can be combined with Peter's suggestion. _read/_write work
> with lines and _readfile/_writefile open and close files based on a filename
> and call _read/_write inside a loop. If anyone needs a data-store that
> isn't a real file, it would be very little work to make their own
> _read/_write loop.

Yeps. I'll tweak the API towards this.

>> I think I would instead suggest that if you really want to maintain the
>> known_host file as much as possible you shouldn't use the savefile option
>> but instead rather append new keys to the existing file.
>
> I don't ;) But I thought it worth mentioning in case anyone does. The one
> case is important, the encoding of each entry, seems to be saved by hostline
> and honoured by dumpfile. Do I understand this correctly?

That's correct. When a host+key is read from a single line in a known_host
file, libssh2 will remember all the necessary details that enables it to
produce an identical output line.

-- 
  / daniel.haxx.se
------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT 
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, & 
iPhoneDevCamp as they present alongside digital heavyweights like Barbarian 
Group, R/GA, & Big Spaceship. http://p.sf.net/sfu/creativitycat-com 
_______________________________________________
libssh2-devel mailing list
libssh2-devel_at_lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libssh2-devel
Received on 2009-05-28