46 |
char msg[STRLEN]; |
char msg[STRLEN]; |
47 |
const char *command= "QUIT\r\n"; |
const char *command= "QUIT\r\n"; |
48 |
|
|
49 |
if ( port_recv(p, buf, sizeof(buf), 0) <= 0 ) { |
ASSERT(p); |
50 |
|
|
51 |
|
if(port_recv(p, buf, sizeof(buf), 0) <= 0) { |
52 |
log("FTP: error receiving data -- %s\n", STRERROR); |
log("FTP: error receiving data -- %s\n", STRERROR); |
53 |
return FALSE; |
return FALSE; |
54 |
} |
} |
56 |
chomp(buf); |
chomp(buf); |
57 |
|
|
58 |
sscanf(buf, "%d %s", &status, msg); |
sscanf(buf, "%d %s", &status, msg); |
59 |
if ( status != 220 ) { |
if(status != 220) { |
60 |
log("FTP error: %s\n", buf); |
log("FTP error: %s\n", buf); |
61 |
return FALSE; |
return FALSE; |
62 |
} |
} |
63 |
|
|
64 |
if ( port_send(p, command, strlen(command), 0) < 0 ) { |
if(port_send(p, command, strlen(command), 0) < 0) { |
65 |
log("FTP: error sending data -- %s\n", STRERROR); |
log("FTP: error sending data -- %s\n", STRERROR); |
66 |
return FALSE; |
return FALSE; |
67 |
} |
} |
68 |
|
|
69 |
if ( port_recv(p, buf, sizeof(buf), 0) <= 0 ) { |
if(port_recv(p, buf, sizeof(buf), 0) <= 0) { |
70 |
log("FTP: error receiving data -- %s\n", STRERROR); |
log("FTP: error receiving data -- %s\n", STRERROR); |
71 |
return FALSE; |
return FALSE; |
72 |
} |
} |
74 |
chomp(buf); |
chomp(buf); |
75 |
|
|
76 |
sscanf(buf, "%d %s", &status, msg); |
sscanf(buf, "%d %s", &status, msg); |
77 |
if ( status != 221 ) { |
if(status != 221) { |
78 |
log("FTP error: %s\n", buf); |
log("FTP error: %s\n", buf); |
79 |
return FALSE; |
return FALSE; |
80 |
} |
} |