Skip to content

Commit bb09a82

Browse files
authored
wire MYSQL_OPT_SSL and MYSQL_OPT_SSL_CA into the pool builder (#11)
Both options were accepted but ignored in connect() until now. When options.ssl is enabled, apply SslOpts::default() via builder.ssl_opts(...); if options.ssl_ca is also set, use with_root_cert_path(PathBuf::from(ca)). Without SSL_CA the platform trust store is used.
1 parent c431d02 commit bb09a82

7 files changed

Lines changed: 25 additions & 8 deletions

File tree

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ All notable changes to this project are documented in this file.
44

55
Format inspired by [Keep a Changelog](https://keepachangelog.com/). Versioning follows [Semantic Versioning](https://semver.org/). Older entries live under [`changelog/`](changelog/).
66

7+
## [1.1.1] — 2026/05/18
8+
9+
### Fixed
10+
11+
- `MYSQL_OPT_SSL` and `MYSQL_OPT_SSL_CA` are now wired through to the connection builder. When `MYSQL_OPT_SSL` is enabled, `mysql_connect` configures `SslOpts::default()` on the pool (rustls). When `MYSQL_OPT_SSL_CA` is also set, its path is passed to `with_root_cert_path`; otherwise the platform trust store is used. Previously both options were accepted but silently ignored, so connections were always plaintext.
12+
13+
---
14+
715
## [1.1.0] — 2026/05/18
816

917
Built on top of [rust-samp v3.0.0](https://github.com/NullSablex/rust-samp/releases/tag/v3.0.0). The same `.so` / `.dll` now loads on SA-MP and on Open Multiplayer (native component or legacy mode). No Pawn-visible API was removed or renamed.

CHECKLIST.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Checklist: mysql_samp vs MySQL R41-4
22

3-
Coverage of the MySQL R41-4 (BlueG / maddinat0r) Pawn API by **mysql_samp 1.1.0**. Source of truth: [`include/mysql_samp.inc.in`](include/mysql_samp.inc.in) and [`src/lib.rs`](src/lib.rs).
3+
Coverage of the MySQL R41-4 (BlueG / maddinat0r) Pawn API by **mysql_samp 1.1.1**. Source of truth: [`include/mysql_samp.inc.in`](include/mysql_samp.inc.in) and [`src/lib.rs`](src/lib.rs).
44

55
## Connection
66

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "mysql_samp"
3-
version = "1.1.0"
3+
version = "1.1.1"
44
edition = "2024"
55
authors = ["NullSablex <https://github.com/NullSablex>"]
66
repository = "https://github.com/NullSablex/mysql_samp"

docs/api-reference.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Source of truth: [`include/mysql_samp.inc.in`](https://github.com/NullSablex/mys
77
## Constants
88

99
```pawn
10-
#define MYSQL_SAMP_VERSION "1.1.0"
10+
#define MYSQL_SAMP_VERSION "1.1.1"
1111
```
1212

1313
The literal above is regenerated by `build.rs` from `CARGO_PKG_VERSION` on every build, so it always tracks the actual plugin version.

include/mysql_samp.inc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* mysql_samp v1.1.0 - MySQL plugin for SA-MP and Open Multiplayer.
2+
* mysql_samp v1.1.1 - MySQL plugin for SA-MP and Open Multiplayer.
33
* Author: NullSablex
44
* Repository: https://github.com/NullSablex/mysql_samp
55
* License: GPL-3.0
@@ -10,7 +10,7 @@
1010
#endif
1111
#define _mysql_samp_included
1212

13-
#define MYSQL_SAMP_VERSION "1.1.0"
13+
#define MYSQL_SAMP_VERSION "1.1.1"
1414

1515
// Connection options
1616
enum {

src/connection.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
use std::collections::HashMap;
2+
use std::path::PathBuf;
23
use std::time::Duration;
34

45
use mysql::prelude::Queryable;
5-
use mysql::{Opts, OptsBuilder, Pool, PooledConn};
6+
use mysql::{Opts, OptsBuilder, Pool, PooledConn, SslOpts};
67

78
use crate::cache::{CacheEntry, CacheRow};
89
use crate::error::{ErrorState, MysqlError};
@@ -64,7 +65,15 @@ impl ConnectionManager {
6465
builder
6566
};
6667

67-
// TODO: SSL configuration when mysql crate exposes rustls options
68+
let builder = if options.ssl {
69+
let mut ssl_opts = SslOpts::default();
70+
if let Some(ca) = options.ssl_ca.as_deref() {
71+
ssl_opts = ssl_opts.with_root_cert_path(Some(PathBuf::from(ca)));
72+
}
73+
builder.ssl_opts(Some(ssl_opts))
74+
} else {
75+
builder
76+
};
6877

6978
// Force UTF-8 encoding on every connection for safe string escaping
7079
let builder = builder.init(vec!["SET NAMES utf8mb4"]);

0 commit comments

Comments
 (0)