Subject: Re: Problem with known_hosts

Re: Problem with known_hosts

From: Pierre-Yves Fontaniere <pyf_at_cc.in2p3.fr>
Date: Thu, 03 Mar 2011 16:33:15 +0100

On 03/03/2011 03:04 PM, Alexander Lamaison wrote:
> On 2 March 2011 15:22, Pierre-Yves Fontaniere<pyf_at_cc.in2p3.fr> wrote:
>
>> I'm not really used to provide patches, and i'm working on AIX also, so the
>> way of doing a patch is somewhat different :)
>> File provided is from a "diff -c".
>>
> The best way to provide the patch is using git diff. This preserves
> the log and authorship information in a way that can simply be
> comitted as-is.
>
> Failing that, please provide the patch from `diff -u`. Context diffs
> can be hard to read for humans.
>
Yep I know, but there's no option -u in "AIX genuine diff" and AIX patch
doesn't work with unified context patch... I will install GNU diff and
patch tools . :)
I attached a diff -u patch to this mail
>> - Some lines to really remove ending '\n' directly when reading lines from
>> knownhosts file.
>>
> Can you explain a bit more about this? What was the code doing wrong before?
>
In fact, the code wasn't doing something wrong. But when i was
debugging, i saw (with simple printf) keys with leading '\n'. So I
thought first the problem was here. I saw later that was not the case
but even if i know that there's no use of function like strlen in the
code, i prefer having a '\n' leading free and zero terminated string.

libssh2_knownhost_readfile is the only place where we use something else
than const char *. So this is the place to format every line and have
zero terminated string without leading '\n'.
I used strrchr which take the buffer from the end and doesn't browse all
the key from the beginning (like it is done later in
libssh2_knownhost_readline).

I let you decide if it is an interesting modification or not. :)
>> - A section to handle correctly multiple hostnames, aliases, IP addr on the
>> same line in knownhosts file.
>>
> For my testing, can you send me an example of what one of these AIX
> entries with multiple aliases contains?
>
This is not specific to AIX :) we use this kind of knownhosts entries on
Linux, Solaris and AIX.

Entry like :

ccsmurf,ccsvli05,ccsvli05.in2p3.fr,ccsmurf.in2p3.fr,134.158.104.140
ssh-rsa
AAAAB3NzaC1yc2EAAAABIwAAAIEAq1iiPKlBbyw3I+wC76ugwt7DGnseVNjzjZf8y7vO+2oiuBkRMdoqh9K3oHzkiloTeAHOZH4V89nUt/WLTqKG4j4/sSwaCD9gRKwFS4me/Pnvi8zqwmF8YrLwQdTGtDZo2iz0Dt4KqAE6fQ9mQ/iTlJMFUKOed8luDDfX6Ba0lBE=

Pierre-yves

_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

Received on 2011-03-03