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

Diff of /monit/protocols/imap.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 41  Line 41 
41  int check_imap(Port_T p) {  int check_imap(Port_T p) {
42    
43    char buf[STRLEN];    char buf[STRLEN];
   const char *command= "001 LOGOUT\r\n";  
44    const char *ok= "* OK";    const char *ok= "* OK";
45    const char *bye= "* BYE";    const char *bye= "* BYE";
46      const char *command= "001 LOGOUT\r\n";
47    
48    if ( port_recv(p, buf, sizeof(buf), 0) <= 0 ) {    ASSERT(p);
49      
50      if(port_recv(p, buf, sizeof(buf), 0) <= 0) {
51      log("IMAP: error receiving data -- %s\n", STRERROR);      log("IMAP: error receiving data -- %s\n", STRERROR);
52      return FALSE;      return FALSE;
53    }    }
54    
55    chomp(buf);    chomp(buf);
56        
57    if ( strncasecmp(buf, ok, strlen(ok)) != 0 ) {    if(strncasecmp(buf, ok, strlen(ok)) != 0) {
58      log("IMAP error: %s\n", buf);      log("IMAP error: %s\n", buf);
59      return FALSE;      return FALSE;
60    }    }
61        
62    if ( port_send(p, command, strlen(command), 0) < 0 ) {    if(port_send(p, command, strlen(command), 0) < 0) {
63      log("IMAP: error sending data -- %s\n", STRERROR);      log("IMAP: error sending data -- %s\n", STRERROR);
64      return FALSE;      return FALSE;
65    }    }
66    
67    if ( port_recv(p, buf, sizeof(buf), 0) <= 0 ) {    if(port_recv(p, buf, sizeof(buf), 0) <= 0) {
68      log("IMAP: error receiving data -- %s\n", STRERROR);      log("IMAP: error receiving data -- %s\n", STRERROR);
69      return FALSE;      return FALSE;
70    }    }
71    
72    chomp(buf);    chomp(buf);
73        
74    if ( strncasecmp(buf, bye, strlen(bye)) != 0 ) {    if(strncasecmp(buf, bye, strlen(bye)) != 0) {
75      log("IMAP error: %s\n", buf);      log("IMAP error: %s\n", buf);
76      return FALSE;      return FALSE;
77    }    }

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