cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: libssh2 patch 11/10

From: James Housley <jim_at_thehousleys.net>
Date: Sat, 11 Nov 2006 18:47:07 -0500

On Nov 11, 2006, at 3:58 PM, Daniel Stenberg wrote:

> On Fri, 10 Nov 2006, James Housley wrote:
>
>> Okay this integrates Curl_scp_connect() and Curl_sftp_connect().
>> The two structures are also combined.
>
> Nice. Good to see fine progress!
>
> The two servers I tried both use publickey auth and none of these
> seemed to work...

IIRC it is possible to enable/disable sftp. So it is possible that
it is not configured, sshd_config(5).

>
> But otherwise I have these comments on the patch:
>
> 1 - it uses strlen(), malloc(), memcpy() on several places where
> just a simple
> strdup() would make less code

Could be true.

>
> 2 - the patch uses S_IFDIR, S_IFLNK and similar which aren't
> libssh2-symbols!
> Shouldn't these use LIBSSH2_SFTP_TYPE_DIRECTORY,
> LIBSSH2_SFTP_TYPE_SYMLINK
> and family instead? Remember that the local host might not have
> support
> for this, but still get info about such data from the server.
>
> Oddly enough, I can't find S_IRUSR, S_IWUSR etc provided by
> libssh2?

The documentation, http://www.libssh2.org/wiki/index.php/
Structures#Accessable_Structures , says

"The permissions field is a bit-set with the same interpretation as
the st_mode field of a POSIX stat struct. In particular, the high-
order bits determine the file type (regular, directory, symlink,
etc.) Use the masks and macros declared in <sys/stat.h> to interpret
the file type."

>
> 3 - Curl_sftp_recv/send and Curl_scp_send/recv are declared to
> return int but
> returns ssize_t. But I also see that this mistake is done in a
> similar
> style for Curl_ssl_send() as well, so you're hardly alone...

I noticed all the commits about an hour ago.

Jim

--
/"\   ASCII Ribbon Campaign  .
\ / - NO HTML/RTF in e-mail  .
  X  - NO Word docs in e-mail .
/ \ -----------------------------------------------------------------
jeh@FreeBSD.org      http://www.FreeBSD.org     The Power to Serve
jim@TheHousleys.Net  http://www.TheHousleys.net
---------------------------------------------------------------------
Fortune Not Found:
Abort, Retry, Ignore?
Received on 2006-11-12