/[monit]/monit/ssl.c
ViewVC logotype

Diff of /monit/ssl.c

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

revision 1.6 by chopp, Wed Oct 23 14:01:26 2002 UTC revision 1.7 by chopp, Fri Oct 25 15:50:46 2002 UTC
# Line 192  int embed_ssl_socket (ssl_connection * s Line 192  int embed_ssl_socket (ssl_connection * s
192  #endif  #endif
193  }  }
194    
195    /**
196     * Updates some data in the ssl connection
197     * @param ssl reference to ssl connection
198     * @return TRUE, if not successful FALSE
199     */
200    
201  int update_ssl_cert_data(ssl_connection *ssl) {  int update_ssl_cert_data(ssl_connection *ssl) {
202    
# Line 221  int update_ssl_cert_data(ssl_connection Line 226  int update_ssl_cert_data(ssl_connection
226  }  }
227    
228  /**  /**
229     * Compare certificate with given md5 sum
230     * @param ssl reference to ssl connection
231     * @param md5sum string of the md5sum to test against
232     * @return TRUE, if sums do not match FALSE
233     */
234    
235    int check_ssl_md5sum(ssl_connection * ssl, char *md5sum) {
236    
237      int i= 0;
238    
239      while (( i < ssl->cert_md5_len ) &&
240             ( md5sum[2*i] != '\0' ) &&
241             ( md5sum[2*i+1] != '\0' )) {
242    
243        unsigned char c=
244          (md5sum[2*i] > 57 ? md5sum[2*i] - 87 : md5sum[2*i] - 48) * 0x10+
245          (md5sum[2*i+1] > 57 ? md5sum[2*i+1] - 87 : md5sum[2*i+1] - 48);
246    
247        if ( c!=ssl->cert_md5[i] ) {
248    
249          return FALSE;
250          
251        }
252    
253        i ++;
254    
255      }
256    
257      return TRUE;
258    
259    }
260    
261    
262    /**
263   * Open a socket against hostname:port with the given protocol.   * Open a socket against hostname:port with the given protocol.
264   * This socket is sent through a ssl connection.   * This socket is sent through a ssl connection.
265   * The protocol is normaly either SOCK_STREAM or SOCK_DGRAM.   * The protocol is normaly either SOCK_STREAM or SOCK_DGRAM.

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

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