fix: bearer token creation truncates client_name and returns wrong expiry for existing tokens (#22167)
* Initial plan * fix: bearer token creation returns wrong expiry and truncates client_name Two bugs in src/web/api/http_auth.c: 1. bearer_create_token_internal: strncpyz used sizeof(bt->cloud_account_id) (16 bytes) instead of sizeof(bt->client_name) (64 bytes) when storing the client name, silently truncating it to 15 characters. This broke the dedup logic in bearer_create_token (strncmp would never match names longer than 15 chars) and saved incorrect data to on-disk token files. 2. bearer_create_token: when an existing matching token was found in the in-memory dictionary, the function returned the local `expires_s` variable (initialized to 0) instead of bt->expires_s (the actual token expiration). This caused bearer_get_token_json_response to return "expiration": 0 (Unix epoch) to the dashboard, making the dashboard believe the bearer token had already expired even though it was valid. Agent-Logs-Url: https://github.com/netdata/netdata/sessions/c468bb15-629f-46e3-ae1d-dd9694dc656d Co-authored-by: ilyam8 <22274335+ilyam8@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: ilyam8 <22274335+ilyam8@users.noreply.github.com>