int err = 0;
/*create context*/
- ctx = (glb_ctx *) malloc(sizeof(*ctx));
+ ctx = (glb_ctx *) calloc(1, sizeof(*ctx));
if (!ctx) {
err = ENOMEM;
goto end;
}
- /*openssl init. -check return value
- ssl_library_init();
- ssl_load_error_strings();
- canl_ctx->ssl_ctx->ssl_meth = ;//choose ssl method SSLv3_method();
- canl_ctx->ssl_ctx = SSL_CTX_new (canl_ctx->ssl_ct->ssl_meth)
- */
-
- /*initial values ...*/
- ctx->err_msg = NULL;
- ctx->err_code = no_error;
- ctx->opened_ios = 0;
-
end:
if (err)
return NULL;
}
/*create io handler*/
- new_io_h = (io_handler *) malloc(sizeof(*new_io_h));
+ new_io_h = (io_handler *) calloc(1, sizeof(*new_io_h));
if (!new_io_h){
err = ENOMEM;
return NULL;
}
- /*read cc and set io_handler accordingly ...*/
- new_io_h->ar = NULL;
- new_io_h->s_addr = NULL;
- new_io_h->sock = -1;
-
/* allocate memory and initialize io content*/
if ((err = init_io_content(g_cc ,new_io_h))){
goto end;
static int set_cert(glb_ctx *cc, X509 *cert)
{
int err = 0;
- CANL_ERROR_ORIGIN err_orig;
+ CANL_ERROR_ORIGIN err_orig = 0;
if (cc->cert_key->cert) {
free(cc->cert_key->cert);
}
end:
- fclose(key_file);
+ err = fclose(key_file);
return err;
}
}
end:
- fclose(cert_file);
+ err = fclose(cert_file);
return err;
}
{
int opened_ios;
char * err_msg;
- CANL_ERROR err_code;
+ unsigned long err_code;
CANL_ERROR_ORIGIN err_orig;
cert_key_store *cert_key;
SSL_CTX *ssl_ctx;
ossl_ctx * s_ctx;
} io_handler;
-void reset_error (glb_ctx *cc, CANL_ERROR err_code);
-void set_error (glb_ctx *cc, CANL_ERROR err_code, CANL_ERROR_ORIGIN err_orig,
+void reset_error (glb_ctx *cc, unsigned long err_code);
+void set_error (glb_ctx *cc, unsigned long err_code, CANL_ERROR_ORIGIN err_orig,
const char *err_format, ...);
void update_error (glb_ctx *cc, const char *err_format, ...);
void free_hostent(struct hostent *h); //TODO is there some standard funcion to free hostent?