Skip to content

Commit

Permalink
Merge branch 'msvc++-fix'
Browse files Browse the repository at this point in the history
  • Loading branch information
mkulke committed Nov 13, 2013
2 parents 1ac97b3 + f5fc5b4 commit f77c871
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 1,647 deletions.
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

*.o

*.a

*.so

*.2

*.0
44 changes: 24 additions & 20 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,33 +1,37 @@
v2.03
v2.0.4

- license changed to lgpl
- added support for osx
- Added support for MSVC 2012.
- Documentation migrated from HTML to Markdown.

v2.0.3

- License changed to LGPL.
- Added support for OSX.

v2.0.2

- fixed a bug in the upload routine
- Fixed a bug in the upload routine.

v2.0.1

- fixed a problem with the -DNOSSL compile flag
- removed an unnecessary sys/time.h dependance
- Fixed a problem with the -DNOSSL compile flag.
- Removed an unnecessary sys/time.h dependance.

v2.0.0

- implemented SSL/TLS certification callback
- SSLv2 connections aren't allowed any more
- made library work on win32 systems
- correct pasv reply functionality for misbehaving NAT servers
- cleaned up code and slightly modiefied
interface
- ssl support can be turned off now
- large file support
- fixed error when fxp'ing a rejected file
- logging functionality extended
- callback mechanisms improved
- Implemented SSL/TLS certification callback.
- SSLv2 connections aren't allowed any more.
- Made library work on win32 systems.
- Correct pasv reply functionality for misbehaving NAT servers.
- Cleaned up code and slightly modified interface.
- SSL support can be turned off now.
- Large file support.
- Fixed error when fxp'ing a rejected file.
- Logging functionality extended.
- Callback mechanisms improved.

v1.0.1

- ftplib::Fxp was always returning 0, fixed this
- Quit returns if there's no connection anymore to do QUIT
- fixed bug in secure upload
- ftplib::Fxp was always returning 0, fixed this.
- Quit returns if there's no connection anymore to do QUIT.
- Fixed a bug in secure upload.
25 changes: 24 additions & 1 deletion ftplib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@
typedef int socklen_t;
#endif

#if defined(_WIN32)
#define memccpy _memccpy
#define strdup _strdup
#endif

using namespace std;

/* socket values */
Expand Down Expand Up @@ -858,7 +863,13 @@ int ftplib::FtpOpenPasv(ftphandle *nControl, ftphandle **nData, transfermode mod
cp = strchr(nControl->response,'(');
if (cp == NULL) return -1;
cp++;
#if defined(_WIN32)
unsigned int v_i[6];
sscanf(cp,"%u,%u,%u,%u,%u,%u",&v_i[2],&v_i[3],&v_i[4],&v_i[5],&v_i[0],&v_i[1]);
for (int i = 0; i < 6; i++) v[i] = (unsigned char) v_i[i];
#else
sscanf(cp,"%hhu,%hhu,%hhu,%hhu,%hhu,%hhu",&v[2],&v[3],&v[4],&v[5],&v[0],&v[1]);
#endif
if (nControl->correctpasv) if (!CorrectPasvResponse(v)) return -1;
sin.sa.sa_data[2] = v[2];
sin.sa.sa_data[3] = v[3];
Expand Down Expand Up @@ -1402,7 +1413,13 @@ int ftplib::Fxp(ftplib* src, ftplib* dst, const char *pathSrc, const char *pathD
cp = strchr(dst->mp_ftphandle->response,'(');
if (cp == NULL) return -1;
cp++;
#if defined(_WIN32)
unsigned int v_i[6];
sscanf(cp,"%u,%u,%u,%u,%u,%u",&v_i[2],&v_i[3],&v_i[4],&v_i[5],&v_i[0],&v_i[1]);
for (int i = 0; i < 6; i++) v[i] = (unsigned char) v_i[i];
#else
sscanf(cp,"%hhu,%hhu,%hhu,%hhu,%hhu,%hhu",&v[2],&v[3],&v[4],&v[5],&v[0],&v[1]);
#endif
if (dst->mp_ftphandle->correctpasv) if (!dst->CorrectPasvResponse(v)) return -1;

// PORT src
Expand Down Expand Up @@ -1456,7 +1473,13 @@ int ftplib::Fxp(ftplib* src, ftplib* dst, const char *pathSrc, const char *pathD
cp = strchr(src->mp_ftphandle->response,'(');
if (cp == NULL) return -1;
cp++;
#if defined(_WIN32)
unsigned int v_i[6];
sscanf(cp,"%u,%u,%u,%u,%u,%u",&v_i[2],&v_i[3],&v_i[4],&v_i[5],&v_i[0],&v_i[1]);
for (int i = 0; i < 6; i++) v[i] = (unsigned char) v_i[i];
#else
sscanf(cp,"%hhu,%hhu,%hhu,%hhu,%hhu,%hhu",&v[2],&v[3],&v[4],&v[5],&v[0],&v[1]);
#endif
if (src->mp_ftphandle->correctpasv) if (!src->CorrectPasvResponse(v)) return -1;

// PORT dst
Expand Down Expand Up @@ -1651,4 +1674,4 @@ int ftplib::RawWrite(void* buf, int len, ftphandle* handle)
int ftplib::RawRead(void* buf, int max, ftphandle* handle)
{
return FtpRead(buf, max, handle);
}
}
7 changes: 5 additions & 2 deletions ftplib.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,13 @@
# define DLLIMPORT __declspec (dllimport)
#endif /* Not BUILDING_DLL */

#include <time.h>
#endif

#include <sys/time.h>
#ifndef _WIN32
#include <unistd.h>
#include <sys/time.h>
#endif

#ifdef NOLFS
#define off64_t long
Expand Down Expand Up @@ -200,4 +203,4 @@ class ftplib {
int CorrectPasvResponse(unsigned char *v);
};

#endif
#endif
Loading

0 comments on commit f77c871

Please sign in to comment.