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

Diff of /monit/protocols/ssh.c

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

revision 1.10 by martinp, Thu Jan 6 20:51:50 2005 UTC revision 1.11 by hauk, Sat Oct 29 00:24:33 2005 UTC
# Line 43  Line 43 
43   */   */
44  int check_ssh(Socket_T s) {  int check_ssh(Socket_T s) {
45    
   int n;  
46    char  buf[STRLEN];    char  buf[STRLEN];
47    
48    ASSERT(s);    ASSERT(s);
49            
50    if((n= socket_read(s, buf, sizeof(buf))) <= 0) {    if(!socket_readln(s, buf, sizeof(buf))) {
51      log("SSH: error receiving identification string -- %s\n", STRERROR);      log("SSH: error receiving identification string -- %s\n", STRERROR);
52      return FALSE;      return FALSE;
53    }    }
54        
55    if(! Util_startsWith(buf, "SSH-")) {    if(! Util_startsWith(buf, "SSH-")) {
56      log("SSH: protocol error %s\n", buf);      log("SSH: protocol error %s", buf);
57      return FALSE;      return FALSE;
58    }    }
59    
60    /* send identification string back to server */    /* send identification string back to server */
61    if(socket_write(s, buf, n) <= 0) {    if(socket_write(s, buf, strlen(buf)) <= 0) {
62      log("SSH: error sending identification string -- %s\n", STRERROR);      log("SSH: error sending identification string -- %s\n", STRERROR);
63      return FALSE;      return FALSE;
64    }    }

Legend:
Removed from v.1.10  
changed lines
  Added in v.1.11

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