mirror of
https://github.com/hanzoai/datastore.git
synced 2026-09-26 13:55:07 +00:00
Fix abort in clickhouse-client --login when no host is passed explicitly
`Client::login` read `hosts_and_ports.front()`, but `hosts_and_ports` is only filled from explicit `--host` arguments; the default host is added later, in `Client::connect`. Running `clickhouse client --login` without `--host` (e.g. with the host coming from `--connection`, the config file, or the `CLICKHOUSE_HOST` environment variable) failed a libc++ hardening assertion: `front() called on an empty vector`. Resolve the host from the configuration when `hosts_and_ports` is empty, the same way `connect` does. Also fix the client docs, which listed the option as `login` instead of `--login`. Closes: https://github.com/ClickHouse/ClickHouse/issues/103603 Co-Authored-By: Claude Fable 5 <[email protected]>
This commit is contained in:
co-authored by
Claude Fable 5
parent
e470a89a29
commit
e5f80bbc8d
@@ -482,7 +482,12 @@ catch (...)
|
||||
#if USE_JWT_CPP && USE_SSL
|
||||
void Client::login()
|
||||
{
|
||||
std::string host = hosts_and_ports.front().host;
|
||||
/// `hosts_and_ports` is filled from explicit --host arguments only; the default host is added
|
||||
/// later, in `connect`. A host given via config, --connection or the environment is still
|
||||
/// sitting in the configuration at this point.
|
||||
std::string host = hosts_and_ports.empty()
|
||||
? getClientConfiguration().getString("host", "localhost")
|
||||
: hosts_and_ports.front().host;
|
||||
std::string auth_url = getClientConfiguration().getString("oauth-url", "");
|
||||
std::string client_id = getClientConfiguration().getString("oauth-client-id", "");
|
||||
std::string audience = getClientConfiguration().getString("oauth-audience", "");
|
||||
|
||||
Reference in New Issue
Block a user