diff --git a/src/mgr/ftptrans.cpp b/src/mgr/ftptrans.cpp index 6e17661..452de59 100644 --- a/src/mgr/ftptrans.cpp +++ b/src/mgr/ftptrans.cpp @@ -103,6 +103,10 @@ vector FTPTransport::getDirList(const char *dirURL) { int status = ftpparse(&item, start, end - start); SWLog::getSystemLog()->logWarning("FTPURLGetDir: got item %s\n", item.name); if (status) { + if (strcmp(item.name,".") == 0 || strcmp(item.name,"..") == 0) { + start = end; + continue; + } struct DirEntry i; i.name = item.name; i.size = item.size; diff --git a/src/mgr/installmgr.cpp b/src/mgr/installmgr.cpp index c1ddd1b..ebd6559 100644 --- a/src/mgr/installmgr.cpp +++ b/src/mgr/installmgr.cpp @@ -159,6 +159,18 @@ void InstallMgr::readInstallConf() { is->localShadow = (SWBuf)privatePath + "/" + is->uid; sourceBegin++; } + + 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++; + } sourceBegin = confSection->second.lower_bound("HTTPSource"); sourceEnd = confSection->second.upper_bound("HTTPSource"); @@ -291,7 +303,7 @@ SWLog::getSystemLog()->logDebug("netCopy: %s, %s, %s, %c, %s", (is?is->source.c_ int retVal = 0; FTPTransport *trans = 0; - if (is->type == "FTP") { + if (is->type == "FTP" || is->type == "SFTP") { trans = createFTPTransport(is->source, statusReporter); trans->setPassive(passive); } @@ -315,6 +327,9 @@ SWLog::getSystemLog()->logDebug("netCopy: %s, %s, %s, %c, %s", (is?is->source.c_ else if (is->type == "HTTPS") { urlPrefix = (SWBuf) "https://"; } + else if (is->type == "SFTP") { + urlPrefix = (SWBuf) "sftp://"; + } else { urlPrefix = (SWBuf) "ftp://"; }