aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavel Raiskup <pavel@raiskup.cz>2010-05-15 21:58:50 +0200
committerDaniel Stenberg <daniel@haxx.se>2010-05-15 21:58:50 +0200
commite4af5d6efcf9c8ddae087009df1782d890a0e13b (patch)
treecf9e89a6b5bca657687c61b2482385d9235936ab
parent43b816538fbbac07ca7ccc2dc647c972c3ee072a (diff)
ftp wildcard: fix int32_t and size/group mixups
-rw-r--r--include/curl/curl.h4
-rw-r--r--lib/ftplistparser.c24
2 files changed, 10 insertions, 18 deletions
diff --git a/include/curl/curl.h b/include/curl/curl.h
index d59e01de6..a2e26bad0 100644
--- a/include/curl/curl.h
+++ b/include/curl/curl.h
@@ -231,7 +231,7 @@ struct curl_fileinfo {
char *filename;
curlfiletype filetype;
time_t time;
- int32_t perm;
+ unsigned int perm;
int uid;
int gid;
curl_off_t size;
@@ -246,7 +246,7 @@ struct curl_fileinfo {
char *target; /* pointer to the target filename of a symlink */
} strings;
- int32_t flags;
+ unsigned int flags;
/* used internally */
char * b_data;
diff --git a/lib/ftplistparser.c b/lib/ftplistparser.c
index 9d42e8f37..faf314fe2 100644
--- a/lib/ftplistparser.c
+++ b/lib/ftplistparser.c
@@ -465,7 +465,7 @@ size_t ftp_parselist(char *buffer, size_t size, size_t nmemb, void *connptr)
}
}
else if(parser->item_length == 10) {
- int32_t perm;
+ unsigned int perm;
if(c != ' ') {
PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST);
return bufflen;
@@ -560,7 +560,7 @@ size_t ftp_parselist(char *buffer, size_t size, size_t nmemb, void *connptr)
finfo->b_data[parser->item_offset + parser->item_length - 1] = 0;
parser->offsets.group = parser->item_offset;
parser->state.UNIX.main = PL_UNIX_SIZE;
- parser->state.UNIX.sub.group = PL_UNIX_SIZE_PRESPACE;
+ parser->state.UNIX.sub.size = PL_UNIX_SIZE_PRESPACE;
parser->item_offset = 0;
parser->item_length = 0;
}
@@ -624,7 +624,7 @@ size_t ftp_parselist(char *buffer, size_t size, size_t nmemb, void *connptr)
case PL_UNIX_TIME_PART1:
parser->item_length++;
if(c == ' ') {
- parser->state.UNIX.sub.size = PL_UNIX_TIME_PREPART2;
+ parser->state.UNIX.sub.time = PL_UNIX_TIME_PREPART2;
}
else if(!ISALNUM(c) && c != '.') {
PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST);
@@ -646,7 +646,7 @@ size_t ftp_parselist(char *buffer, size_t size, size_t nmemb, void *connptr)
case PL_UNIX_TIME_PART2:
parser->item_length++;
if(c == ' ') {
- parser->state.UNIX.sub.size = PL_UNIX_TIME_PREPART3;
+ parser->state.UNIX.sub.time = PL_UNIX_TIME_PREPART3;
}
else if(!ISALNUM(c) && c != '.') {
PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST);
@@ -917,21 +917,13 @@ size_t ftp_parselist(char *buffer, size_t size, size_t nmemb, void *connptr)
finfo->size = curlx_strtoofft(finfo->b_data + parser->item_offset,
&endptr, 10);
if(!*endptr) {
- if(finfo->size < CURL_LLONG_MAX &&
- finfo->size > CURL_LLONG_MIN) {
-
- }
- else if(finfo->size == CURL_LLONG_MAX ||
- finfo->size == CURL_LLONG_MIN) {
+ if(finfo->size == CURL_LLONG_MAX ||
+ finfo->size == CURL_LLONG_MIN) {
if(errno == ERANGE) {
PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST);
return bufflen;
}
}
- else {
- PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST);
- return bufflen;
- }
}
else {
PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST);
@@ -974,7 +966,7 @@ size_t ftp_parselist(char *buffer, size_t size, size_t nmemb, void *connptr)
return bufflen;
}
parser->state.NT.main = PL_WINNT_DATE;
- parser->state.NT.sub.filename = 0;
+ parser->state.NT.sub.filename = PL_WINNT_FILENAME_PRESPACE;
}
break;
case PL_WINNT_FILENAME_WINEOL:
@@ -986,7 +978,7 @@ size_t ftp_parselist(char *buffer, size_t size, size_t nmemb, void *connptr)
return bufflen;
}
parser->state.NT.main = PL_WINNT_DATE;
- parser->state.NT.sub.filename = 0;
+ parser->state.NT.sub.filename = PL_WINNT_FILENAME_PRESPACE;
}
else {
PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST);