static void get_error_string(glb_ctx *cc, char *code_str);
static canl_err_code update_error_msg(canl_ctx cc, const char *new_msg);
static char *canl_strerror(const canl_err_code c_code);
-static canl_error canl_err_ssl_to_canl(const unsigned long ossl_lib,
+static int canl_err_ssl_to_canl(const unsigned long ossl_lib,
const unsigned long ossl_reason);
/* Save error message into err_msg
/*return appropriate CANL_ERROR according to openssl error code or -1 if
no one found */
-static canl_error
+static int
canl_err_ssl_to_canl(const unsigned long ossl_lib,
const unsigned long ossl_reason)
{
- canl_error ret_err = -1;
+ int ret_err = -1;
int k = 0;
for (k = 0; k < canl_err_descs_num; k++) {
if (canl_err_descs[k].openssl_lib == ossl_lib) {
static canl_err_code resolve_error_code(glb_ctx *cc, unsigned long err_code,
canl_err_origin err_orig)
{
+ int ret = 0;
cc->original_err_code = err_code;
cc->err_orig = err_orig;
break;
case SSL_ERROR:
/* TODO What about CANL_ERR_GeneralSSLError ?*/
- if ((cc->err_code = canl_err_ssl_to_canl(ERR_GET_LIB(err_code),
+ if ((ret = canl_err_ssl_to_canl(ERR_GET_LIB(err_code),
ERR_GET_REASON(err_code))) != -1){
+ cc->err_code = ret;
cc->err_orig = CANL_ERROR;
}
cc->err_code = err_code;
time_t starttime, curtime;
int ret = -1, ret2 = -1;
unsigned long ssl_err = 0;
- int err = 0;
canl_err_origin e_orig = UNKNOWN_ERROR;
long errorcode = 0;
int expected = 0;
if (timeout && (curtime - starttime >= locl_timeout)){
timeout->tv_sec=0;
timeout->tv_usec=0;
- err = ETIMEDOUT;
- update_error (cc, err, POSIX_ERROR, "Connection stuck during"
+ update_error (cc, ETIMEDOUT, POSIX_ERROR, "Connection stuck during"
" handshake: timeout reached");
}
else if (ret2 < 0 && ssl_err)
- return update_error(cc, ssl_err, e_orig, "Error during SSL handshake");
+ update_error(cc, ssl_err, e_orig, "Error during SSL handshake");
else if (ret2 == 0)//TODO is 0 (conn closed by the other side) error?
update_error (cc, ECONNREFUSED, POSIX_ERROR, "Connection closed"
" by the other side");
else
- update_error (cc, err, UNKNOWN_ERROR, "Error during SSL handshake");
+ /*ret2 < 0 && !ssl_err*/
+ update_error (cc, 0, UNKNOWN_ERROR, "Error during SSL handshake"
+ " in communication with the server");
return 1;
}
return 0;
time_t starttime, curtime;
int ret = -1, ret2 = -1;
unsigned long ssl_err = 0;
- int err = 0;
long errorcode = 0;
int expected = 0;
int locl_timeout = -1;
if (timeout && (curtime - starttime >= locl_timeout)){
timeout->tv_sec=0;
timeout->tv_usec=0;
- err = ETIMEDOUT;
- set_error (cc, err, POSIX_ERROR, "Connection stuck"
+ set_error (cc, ETIMEDOUT, POSIX_ERROR, "Connection stuck"
" during handshake: timeout reached");
}
else if (ret2 == 0)
else if (ret2 < 0 && ssl_err)
set_error (cc, ssl_err, SSL_ERROR, "Error during SSL handshake");
else
- set_error (cc, 0, UNKNOWN_ERROR, "Error during SSL handshake");
+ /*ret2 < 0 && !ssl_err*/
+ set_error (cc, 0, UNKNOWN_ERROR, "Error during SSL handshake"
+ " in communication with the server");
return 1;
}
return 0;