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

Diff of /monit/ssl.c

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

revision 1.30 by hauk, Fri Sep 19 03:44:17 2003 UTC revision 1.31 by chopp, Fri Sep 19 12:12:33 2003 UTC
# Line 118  static int allow_self_certfication= FALS Line 118  static int allow_self_certfication= FALS
118  static int allow_any_purpose= FALSE;  static int allow_any_purpose= FALSE;
119    
120  /* Error handling */  /* Error handling */
121  static int handle_connection_error(int, ssl_connection *, char *);  static int handle_connection_error(int, ssl_connection *, char *, int);
122  static void handle_ssl_error(char *);  static void handle_ssl_error(char *);
123  #define SSLERROR ERR_error_string(ERR_get_error(),NULL)  #define SSLERROR ERR_error_string(ERR_get_error(),NULL)
124    
# Line 236  int embed_ssl_socket (ssl_connection *ss Line 236  int embed_ssl_socket (ssl_connection *ss
236            
237      }      }
238    
239      if (!handle_connection_error(ssl_error, ssl, "embed_ssl_socket()")) {      if (!handle_connection_error(ssl_error, ssl, "embed_ssl_socket()", SSL_TIMEOUT)) {
240    
241        goto sslerror;        goto sslerror;
242    
243      }      }
244    
245        if (!BIO_should_retry(ssl->socket_bio)) {
246    
247          goto sslerror;
248          
249        }
250    
251    
252    }    }
253    
254    ssl->cipher= (char *) SSL_get_cipher(ssl->handler);    ssl->cipher= (char *) SSL_get_cipher(ssl->handler);
# Line 1064  int embed_accepted_ssl_socket(ssl_connec Line 1071  int embed_accepted_ssl_socket(ssl_connec
1071      }      }
1072    
1073      if (!handle_connection_error(ssl_error, ssl,      if (!handle_connection_error(ssl_error, ssl,
1074                                   "embed_accepted_ssl_socket()")) {                                   "embed_accepted_ssl_socket()", SSL_TIMEOUT)) {
1075    
1076        goto sslerror;        goto sslerror;
1077    
1078      }      }
1079    
1080        if (!BIO_should_retry(ssl->socket_bio)) {
1081    
1082          goto sslerror;
1083          
1084        }
1085    
1086    }    }
1087    
1088    ssl->cipher= (char *) SSL_get_cipher(ssl->handler);    ssl->cipher= (char *) SSL_get_cipher(ssl->handler);
# Line 1866  static int ssl_entropy_stop(void) { Line 1879  static int ssl_entropy_stop(void) {
1879   * @return TRUE if non fatal, FALSE if non fatal and retry   * @return TRUE if non fatal, FALSE if non fatal and retry
1880   */   */
1881  static int handle_connection_error(int code, ssl_connection *ssl,  static int handle_connection_error(int code, ssl_connection *ssl,
1882                                     char *operation) {                                     char *operation, int timeout) {
1883    
1884    int ssl_error= 0;    int ssl_error= 0;
1885    
1886    switch ((ssl_error= SSL_get_error(ssl->handler, code))) {    switch ((ssl_error= SSL_get_error(ssl->handler, code))) {
1887            
1888    case SSL_ERROR_WANT_READ:    case SSL_ERROR_WANT_READ:
1889          if (can_read(ssl->socket, timeout))
1890              return TRUE;
1891          else
1892              log("%s: %s: Openssl read timeout error!\n", prog, operation);
1893              return FALSE;
1894          
1895    case SSL_ERROR_WANT_WRITE:    case SSL_ERROR_WANT_WRITE:
1896      return TRUE;        if (can_read(ssl->socket, timeout))
1897              return TRUE;
1898          else
1899              log("%s: %s: Openssl write timeout error!\n", prog, operation);
1900              return FALSE;
1901            
1902    case SSL_ERROR_SYSCALL:    case SSL_ERROR_SYSCALL:
1903      log("%s: %s: Openssl syscall error: %s!\n", prog, operation,      log("%s: %s: Openssl syscall error: %s!\n", prog, operation,

Legend:
Removed from v.1.30  
changed lines
  Added in v.1.31

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