[sword-devel] SFTP Support

Greg Hellings greg.hellings at gmail.com
Fri Dec 28 11:42:54 MST 2012


Further digging with help from our friends has revealed this nugget:

$ curl-config --protocols

produces a newline-delimited list of protocols that the particular
build of libcurl supports. curl-config is a shell script which can be
run on the build system and should satisfy both the requirements of
native builds and cross-compiling support. We could use this to set a
compiler macro indicating support (or not) for SFTP in the target
libcurl library.

If someone wants to tackle that in the autotools world, I can add
detection to CMake as well. A simple command such as
$ curl-config --protocols | grep SFTP | wc -l
1

in Fedora will result in a value of 1 or greater if SFTP is supported
while it should produce 0 if SFTP support is left out. An Ubuntu
system produce this output:
$ curl-config --protocols | grep SFTP | wc -l
0

And it even works for cross-compiling:
$ /usr/i686-w64-mingw32/sys-root/mingw/bin/curl-config --protocols |
grep SFTP | wc -l
1


This appears to be our best way forward if we want to enable
compile-time enabling or disabling of this option.

--Greg

On Mon, Dec 24, 2012 at 8:43 AM, Greg Hellings <greg.hellings at gmail.com> wrote:
> Troy,
>
> On Sun, Dec 23, 2012 at 10:39 PM, Troy A. Griffitts
> <scribe at crosswire.org> wrote:
>> Dear Greg,
>>
>> Looking to apply this SFTP patch, could you give me some background as to
>> why the check to ignore across all transports for '.' and '..'?
>
> Our downloading method runs recursively from the given directory until
> it runs out of directory depth. FTP servers don't usually seem to
> return . and .. as valid paths, and the HTTP(S) transport attempts to
> parse the returned HTML page to avoid the link to the parent
> directory. But whatever options are passed by cURL to the SFTP
> transport resulted in it returning . and .. as paths within the
> current directory. Because '.' came first in the list, the installmgr
> was running through an infinite loop whenever it tried to pull data
> from the server.
>
> I added it at the level of all transports because we don't want to
> either loop infinitely on '.' or accidentally pull a whole server
> recursively by following '..' to the root of the server. It might be a
> server config option that permits it, but I wanted to avoid the
> possibility of the InlstallMgr class getting choked up on it.
>
> --Greg
>
>>
>> Thanks,
>>
>> Troy
>>
>>
>>
>>
>> On 12/03/2012 04:06 PM, Greg Hellings wrote:
>>
>> The attached patch will introduce support for SFTPSource transports in
>> the SWORD engine, allowing a user to access remote repositories over
>> SFTP (which is enabled by default when a user enables SSH).
>>
>> --Greg
>>
>>
>>
>> _______________________________________________
>> sword-devel mailing list: sword-devel at crosswire.org
>> http://www.crosswire.org/mailman/listinfo/sword-devel
>> Instructions to unsubscribe/change your settings at above page
>>
>>
>>
>> _______________________________________________
>> sword-devel mailing list: sword-devel at crosswire.org
>> http://www.crosswire.org/mailman/listinfo/sword-devel
>> Instructions to unsubscribe/change your settings at above page



More information about the sword-devel mailing list