[sword-devel] SFTP Support

Greg Hellings greg.hellings at gmail.com
Mon Dec 31 07:53:03 MST 2012


Here is the updated patch adding CURLSFTPAVAILABLE support to CMake as
well as to the library code. It defaults to assuming no SFTP support
if either the curl-config executable cannot be found or if it returns
a value other than "1" from the quick detection process we have
settled on.

Users of Windows builds through either VisualStudio or Borland will
need to figure out if curl-config is available on their systems and,
if not, come up with another way to detect and support SFTP for
clients using those builds. On Linux it is a Bash script, so it might
be adaptable to Manfred's XCode system in some way also.

For those in the JSword world, I am sure there are SFTP Java clients
available which could be leveraged if they wanted to add support for
the same functionality to JSword applications.

--Greg

On Sun, Dec 30, 2012 at 9:11 PM, Troy A. Griffitts <scribe at crosswire.org> wrote:
> OK Greg,
>
> I've hacked detection of CURL SFTP into the autotools build (hopefully-- it
> works for me).
>
> I've added a new compile time define with -DCURLSFTPAVAILABLE to go along
> with the existing -DCURLAVAILABLE
>
> If you'd like to update the sftp patch to conditionally compile support in
> based on this define, that would be cool.  I'll do it myself soon if you
> don't have time.
>
> Troy
>
>
>
> On 12/28/2012 11:42 AM, Greg Hellings wrote:
>>
>> 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
>>
>> _______________________________________________
>> 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sftp_sword_support.patch
Type: application/octet-stream
Size: 2773 bytes
Desc: not available
URL: <http://www.crosswire.org/pipermail/sword-devel/attachments/20121231/d9922de1/attachment-0001.obj>


More information about the sword-devel mailing list