/[monit]/monit/protocols/ftp.c
ViewVC logotype

Diff of /monit/protocols/ftp.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.7 by chopp, Wed Sep 25 14:54:49 2002 UTC revision 1.8 by hauk, Sat Dec 21 13:56:04 2002 UTC
# Line 46  int check_ftp(Port_T p) { Line 46  int check_ftp(Port_T p) {
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    }    }
# Line 54  int check_ftp(Port_T p) { Line 56  int check_ftp(Port_T p) {
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    }    }
# Line 72  int check_ftp(Port_T p) { Line 74  int check_ftp(Port_T p) {
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    }    }

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.8

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26