Skip to content

Commit

Permalink
Improved connect in mixed IPv4/IPv6 environments and improved TLS con…
Browse files Browse the repository at this point in the history
…nections without a root certificate.

Other internal improvements.
  • Loading branch information
marcobambini committed Jun 30, 2024
1 parent 0c9e926 commit b3342dc
Show file tree
Hide file tree
Showing 3 changed files with 507 additions and 433 deletions.
20 changes: 12 additions & 8 deletions C_SDK/csql.h
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ typedef unsigned long in_addr_t;
#define kMAXCHUNK 100*1024
#define NO_TIMEOUT 0
#define CONNECT_TIMEOUT 5
#if defined(HAVE_BZERO) || defined(bzero)
// do nothing
#else
Expand Down Expand Up @@ -208,13 +208,17 @@ int tls_close(struct tls *_ctx);
int tls_config_set_ca_file(struct tls_config *_config, const char *_ca_file);
int tls_config_set_cert_file(struct tls_config *_config,const char *_cert_file);
int tls_config_set_key_file(struct tls_config *_config, const char *_key_file);
void tls_config_insecure_noverifycert(struct tls_config* config);
void tls_config_insecure_noverifyname(struct tls_config* config);
int tls_config_set_ciphers(struct tls_config *config, const char *ciphers);
ssize_t tls_read(struct tls *_ctx, void *_buf, size_t _buflen);
ssize_t tls_write(struct tls *_ctx, const void *_buf, size_t _buflen);
const char *tls_error(struct tls *_ctx);
const char *tls_config_error(struct tls_config *_config);
void tls_free(struct tls *_ctx);
const char* SSLeay_version(int t);
#endif
/* COMMANDS */
#define kCOMMAND_CONNECT 1
#define kCOMMAND_SELECT 2
Expand Down Expand Up @@ -306,14 +310,14 @@ struct csqldb {
int errcode; // last error code
int useOldProtocol; // flag to set if you want to use the old REALSQLServer protocol
int verifyPeer; // flag to check if peer verification must be performed
int family;
int family;

char *token; // optional token used in token connect
char *hostverification; // optional host verification name to use in SSL peer verification
void *userptr; // optional pointer saved by the user
int encryption; // CUBESQL_ENCRYPTION_NONE - CUBESQL_ENCRYPTION_AES128
// CUBESQL_ENCRYPTION_AES192 - CUBESQL_ENCRYPTION_AES256
// CUBESQL_ENCRYPTION_AES192 - CUBESQL_ENCRYPTION_AES256
csql_aes_encrypt_ctx encryptkey[1]; // session key used to encrypt data
csql_aes_decrypt_ctx decryptkey[1]; // session key used to decrypt data

Expand All @@ -324,9 +328,9 @@ struct csqldb {
inhead request; // request header
outhead reply; // response header

#ifndef CUBESQL_DISABLE_SSL_ENCRYPTION
struct tls *tls_context; // TLS context connection
#endif
#ifndef CUBESQL_DISABLE_SSL_ENCRYPTION
struct tls *tls_context; // TLS context connection
#endif

void (*trace) (const char*, void*); // trace callback
void *data; // user argument to be passed to the callbacks function
Expand Down
Loading

0 comments on commit b3342dc

Please sign in to comment.