err = canl_create_io_handler(my_ctx, &my_io_h);
if (err) {
- printf("io handler cannot be created: %s\n",
+ printf("io handler cannot be created:\n[CANL] %s\n",
canl_get_error_message(my_ctx));
goto end;
}
err = canl_ctx_set_ssl_cred(my_ctx, serv_cert, serv_key, proxy_cert,
NULL, NULL);
if (err) {
- printf("[CLIENT] cannot set certificate or key to context: %s\n",
+ printf("[CLIENT] cannot set certificate or key"
+ " to context:\n[CANL] %s\n",
canl_get_error_message(my_ctx));
goto end;
}
err = canl_io_connect(my_ctx, my_io_h, p_server, NULL, port, NULL, 0,
NULL, &timeout);
if (err) {
- printf("[CLIENT] connection to %s cannot be established: %s\n",
+ printf("[CLIENT] connection to %s cannot be established:\n[CANL] %s\n",
p_server, canl_get_error_message(my_ctx));
goto end;
}
printf("[CLIENT] Trying to send sth to the server\n");
err = canl_io_write (my_ctx, my_io_h, buf, buf_len, &timeout);
if (err <= 0) {
- printf("can't write using ssl: %s\n",
+ printf("can't write using ssl:\n[CANL] %s\n",
canl_get_error_message(my_ctx));
goto end;
}
err = canl_create_io_handler(my_ctx, &my_io_h);
if (err) {
- printf("[SERVER] io handler cannot be created: %s\n",
+ printf("[SERVER] io handler cannot be created:\n[CANL] %s\n",
canl_get_error_message(my_ctx));
goto end;
}
err = canl_ctx_set_ssl_cred(my_ctx, serv_cert, serv_key, NULL,
NULL, NULL);
if (err) {
- printf("[SERVER] cannot set certificate or key to context: %s\n",
+ printf("[SERVER] cannot set certificate or key to"
+ " context:\n[CANL] %s\n",
canl_get_error_message(my_ctx));
goto end;
}
/* TODO timeout in this function? and select around it*/
err = canl_io_accept(my_ctx, my_io_h, new_fd, s_addr, 0, &princ, &timeout);
if (err) {
- printf("[SERVER] connection cannot be established: %s\n",
+ printf("[SERVER] connection cannot be established:\n[CANL] %s\n",
canl_get_error_message(my_ctx));
goto end;
}
printf("[SERVER] Trying to send sth to the client\n");
err = canl_io_write (my_ctx, my_io_h, buf, buf_len, &timeout);
if (err <= 0) {
- printf("[SERVER] cannot send message to the client: %s\n",
+ printf("[SERVER] cannot send message to the client:\n[CANL] %s\n",
canl_get_error_message(my_ctx));
goto end;
}
buf[0] = '\0';
err = canl_io_read (my_ctx, my_io_h, buf, sizeof(buf)-1, &timeout);
if (err <= 0) {
- printf("[SERVER] Failed to receive reply from client: %s\n",
+ printf("[SERVER] Failed to receive reply from client:\n[CANL] %s\n",
canl_get_error_message(my_ctx));
goto end;
}
*to = PEM_read_PrivateKey(key_file, NULL, NULL, NULL);
if (!(*to)) {
ssl_err = ERR_peek_error();
- err = set_error(cc, ssl_err, SSL_ERROR, "error while writing key to context");
+ err = set_error(cc, ssl_err, SSL_ERROR, "Cannot read the key "
+ "from the file");
goto end;
}
if (fclose(key_file)){
cert_file = fopen(file, "rb");
if (!cert_file)
return set_error(cc, errno, POSIX_ERROR, "Cannot "
- "open file with cert. chain");
+ "open the file with the cert. chain");
for (;;)
{
break;
}
else {
- ret = set_error(cc, ssl_err, SSL_ERROR, "Cannot get"
- "certificate out of file");
+ ret = set_error(cc, ssl_err, SSL_ERROR, "Cannot read"
+ " the certificate from the file");
goto end;
}
}