Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update ctrl list with new advertised address #794

Merged
merged 2 commits into from
Dec 18, 2024

Conversation

ekoby
Copy link
Member

@ekoby ekoby commented Dec 16, 2024

better handle invalid controller responses

better handle invalid controller responses
@ekoby ekoby requested a review from a team as a code owner December 16, 2024 22:30
library/ziti.c Outdated
model_list_iter it = model_list_iterator(&ztx->config.controllers);
while(it) {
char *addr = (char*)model_list_it_element(it);
if (strcmp(addr, ztx->config.controller_url) == 0) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably should be case insensitive?

const char *k;
ziti_controller_detail *detail;
MODEL_MAP_FOREACH(k, detail, &ctrl->endpoints) {
if (strcmp(k, ctrl->url) == 0) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same - case insensitive?

if(detail == NULL) {
detail = alloc_ziti_controller_detail();
}
FREE(detail->name);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if detail was NULL previous, you still need to FREE the name? seems like could be in the else?

if (resp->resp_content == ctrl_content_text) {
resp_obj = string_buf_to_string(resp->content_proc, NULL);
if (resp->body_parse_func) {
error.code = strdup("INVALID_CONTROLLER_RESPONSE");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i've never noticed this before but i'm surprised the code doesn't come from the corresponding CODE_MAP. seems like they could get out of sync this way.

Copy link
Member

@dovholuknf dovholuknf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

case insensitive comparisons seems like a good idea for a domain name?

@ekoby ekoby merged commit bc5f189 into main Dec 18, 2024
9 checks passed
@ekoby ekoby deleted the avoid-crash-on-invalid-redirect branch December 18, 2024 18:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants