fix(scheduler,cli): bug-1453/1454/1455/1456 remove dead CA-cert plumbing, fix scheduler HA config bugs
bug-1453: remove unused client-side CA-certificate plumbing. C-side: drop ca_cert_path from xce_cluster_config_t, do_connect()'s ca_cert param, --ca-cert flags on worker/scheduler, and controller's cert population (TLS is server-side only, SSL_VERIFY_NONE everywhere on the client side already, verified zero SSL_CTX_load_verify_locations calls in the C tree). Go-side: delete xcecli's self-signed cert TOFU-pinning flow (cmd/auth/cert/*), CACert field, SetRootCAs/ loadRootCAs, and every call site. bug-1454: fix xcecli_ctx_t leak in scheduler.c sched_init() — the unconditional initial ctx_init was never freed before the HA candidate loop re-initialized it on the first iteration. bug-1455: sched_init()'s memset(sched, 0, ...) was silently wiping sched->cluster_cfg that main.c had populated from --peers just before calling sched_init(), so --peers was always ignored and the scheduler fell back to the hardcoded localhost:9990 single-host default. Restructured sched_init() to take cluster_cfg as an explicit parameter (assigned after the memset) instead of relying on caller-side ordering with a separate sched_set_cluster_cfg() setter, which is now removed. bug-1456: revert an unsafe stack-local xce_client_config_t introduced while fixing bug-1455 — xcecli_ctx_init() stores that pointer as ctx->conf and client_failover.c dereferences it for the ctx's entire life (runtime reconnect), so a per-loop-iteration stack copy would dangle the moment sched_init() returned. Back to mutating the caller-owned, process-lifetime config in place. Verified: full ASAN build (all components), meson test suite 9/9 OK, manual scheduler testsuite 15/15, Go build/vet/test all pass.
This commit is contained in:
parent
619f41f70e
commit
94f50ce6e1
34 changed files with 1999 additions and 2274 deletions
|
|
@ -70,14 +70,13 @@ void xce_cluster_set_connect_fn(xce_connect_fn_t fn)
|
|||
|
||||
/* do_connect: calls the mock when set, otherwise returns NULL (stub for
|
||||
* the real SSL connect via netio — to be wired in a later task). */
|
||||
static void* do_connect(const char* host, int port, const char* ca_cert)
|
||||
static void* do_connect(const char* host, int port)
|
||||
{
|
||||
if (s_connect_fn)
|
||||
return s_connect_fn(host, port, ca_cert);
|
||||
return s_connect_fn(host, port);
|
||||
/* Production path: real SSL connect via netio — stub for now */
|
||||
(void)host;
|
||||
(void)port;
|
||||
(void)ca_cert;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
@ -95,8 +94,6 @@ int xce_cluster_config_validate(const xce_cluster_config_t* cfg)
|
|||
if (cfg->candidates[i].port <= 0)
|
||||
return -EINVAL;
|
||||
}
|
||||
if (cfg->ca_cert_path[0] == '\0')
|
||||
return -EINVAL;
|
||||
if (cfg->identity[0] == '\0')
|
||||
return -EINVAL;
|
||||
if (cfg->candidates_count > 3)
|
||||
|
|
@ -115,8 +112,7 @@ void* xce_connect_cluster(xce_cluster_config_t* cfg)
|
|||
|
||||
for (int i = 0; i < cfg->candidates_count; i++) {
|
||||
void* ep = do_connect(cfg->candidates[i].hostname,
|
||||
cfg->candidates[i].port,
|
||||
cfg->ca_cert_path);
|
||||
cfg->candidates[i].port);
|
||||
if (ep)
|
||||
return ep;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,9 +11,8 @@ static int s_connect_fail_n = 0; /* fail first N attempts, then succeed */
|
|||
static char s_last_host[256] = "";
|
||||
static int s_last_port = 0;
|
||||
|
||||
static void* mock_connect(const char* host, int port, const char* ca_cert)
|
||||
static void* mock_connect(const char* host, int port)
|
||||
{
|
||||
(void)ca_cert;
|
||||
strncpy(s_last_host, host, sizeof(s_last_host) - 1);
|
||||
s_last_port = port;
|
||||
s_connect_call_count++;
|
||||
|
|
@ -32,8 +31,6 @@ static xce_cluster_config_t make_valid_config(void)
|
|||
XCE_MAXHOSTNAME_LEN - 1);
|
||||
cfg.candidates[1].port = 7001;
|
||||
cfg.candidates_count = 2;
|
||||
strncpy(cfg.ca_cert_path, "/etc/xce/ca.pem",
|
||||
sizeof(cfg.ca_cert_path) - 1);
|
||||
strncpy(cfg.identity, "worker-01", sizeof(cfg.identity) - 1);
|
||||
return cfg;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue