[sword-svn] r2762 - trunk/src/mgr

scribe at crosswire.org scribe at crosswire.org
Sun Jan 6 12:32:03 MST 2013


Author: scribe
Date: 2013-01-06 12:32:03 -0700 (Sun, 06 Jan 2013)
New Revision: 2762

Modified:
   trunk/src/mgr/installmgr.cpp
Log:
Applied GHelling's SFTP patch to include support for SFTPSouce= entried in the InstallMgr.conf which will use CURL's SFTP functionality to supply the transport.  This is conditionally compiled into the engine based on whether SFTP is supported in the installed CURL development libraries.


Modified: trunk/src/mgr/installmgr.cpp
===================================================================
--- trunk/src/mgr/installmgr.cpp	2013-01-06 19:19:15 UTC (rev 2761)
+++ trunk/src/mgr/installmgr.cpp	2013-01-06 19:32:03 UTC (rev 2762)
@@ -159,6 +159,21 @@
 			is->localShadow = (SWBuf)privatePath + "/" + is->uid;
 			sourceBegin++;
 		}
+
+#ifdef CURLSFTPAVAILABLE
+		sourceBegin = confSection->second.lower_bound("SFTPSource");
+		sourceEnd   = confSection->second.upper_bound("SFTPSource");
+
+		while (sourceBegin != sourceEnd) {
+			InstallSource *is = new InstallSource("SFTP", sourceBegin->second.c_str());
+			sources[is->caption] = is;
+			SWBuf parent = (SWBuf)privatePath + "/" + is->uid + "/file";
+			FileMgr::createParent(parent.c_str());
+			is->localShadow = (SWBuf)privatePath + "/" + is->uid;
+			sourceBegin++;
+		}
+#endif // CURLSFTPAVAILABLE
+
 		sourceBegin = confSection->second.lower_bound("HTTPSource");
 		sourceEnd = confSection->second.upper_bound("HTTPSource");
 
@@ -291,7 +306,12 @@
 
 	int retVal = 0;
 	FTPTransport *trans = 0;
-	if (is->type == "FTP") {
+	if (is->type == "FTP" 
+#ifdef CURLSFTPAVAILABLE
+		|| is->type == "SFTP"
+#endif
+		) {
+
 		trans = createFTPTransport(is->source, statusReporter);
 		trans->setPassive(passive);
 	}
@@ -315,6 +335,11 @@
 	else if (is->type == "HTTPS") {
 		urlPrefix = (SWBuf) "https://";
 	}
+#ifdef CURLSFTPAVAILABLE
+	else if (is->type == "SFTP") {
+		urlPrefix = (SWBuf) "sftp://";
+	}
+#endif
 	else {
 		urlPrefix = (SWBuf) "ftp://";
 	}




More information about the sword-cvs mailing list