mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-22 06:11:32 +02:00
BUG/MINOR: ssl: can't open directories anymore
The commit 6be66ec ("MINOR: ssl: directories are loaded like crt-list") broke the directory loading of the certificates. The <crtlist> wasn't filled by the crtlist_load_cert_dir() function. And the entries were not correctly initialized. Leading to a segfault during startup.
This commit is contained in:
parent
6be66ec7a9
commit
83918e2ef1
@ -4461,6 +4461,7 @@ static int crtlist_load_cert_dir(char *path, struct bind_conf *bind_conf, struct
|
|||||||
}
|
}
|
||||||
memcpy(dir->node.key, path, strlen(path) + 1);
|
memcpy(dir->node.key, path, strlen(path) + 1);
|
||||||
dir->entries = EB_ROOT_UNIQUE; /* it's a directory, files are unique */
|
dir->entries = EB_ROOT_UNIQUE; /* it's a directory, files are unique */
|
||||||
|
LIST_INIT(&dir->ord_entries);
|
||||||
|
|
||||||
n = scandir(path, &de_list, 0, alphasort);
|
n = scandir(path, &de_list, 0, alphasort);
|
||||||
if (n < 0) {
|
if (n < 0) {
|
||||||
@ -4484,6 +4485,11 @@ static int crtlist_load_cert_dir(char *path, struct bind_conf *bind_conf, struct
|
|||||||
goto ignore_entry;
|
goto ignore_entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* directories don't use ssl_conf and filters */
|
||||||
|
entry->fcount = 0;
|
||||||
|
entry->filters = NULL;
|
||||||
|
entry->ssl_conf = NULL;
|
||||||
|
|
||||||
snprintf(fp, sizeof(fp), "%s/%s", path, de->d_name);
|
snprintf(fp, sizeof(fp), "%s/%s", path, de->d_name);
|
||||||
if (stat(fp, &buf) != 0) {
|
if (stat(fp, &buf) != 0) {
|
||||||
memprintf(err, "%sunable to stat SSL certificate from file '%s' : %s.\n",
|
memprintf(err, "%sunable to stat SSL certificate from file '%s' : %s.\n",
|
||||||
@ -4532,9 +4538,8 @@ static int crtlist_load_cert_dir(char *path, struct bind_conf *bind_conf, struct
|
|||||||
cfgerr |= ERR_ALERT | ERR_FATAL;
|
cfgerr |= ERR_ALERT | ERR_FATAL;
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
entry->node.key = ckchs;
|
entry->node.key = ckchs;
|
||||||
entry->ssl_conf = NULL; /* directories don't use ssl_conf */
|
LIST_ADDQ(&dir->ord_entries, &entry->by_crtlist);
|
||||||
ebpt_insert(&dir->entries, &entry->node);
|
ebpt_insert(&dir->entries, &entry->node);
|
||||||
|
|
||||||
/* Successfully processed the bundle */
|
/* Successfully processed the bundle */
|
||||||
@ -4553,7 +4558,7 @@ static int crtlist_load_cert_dir(char *path, struct bind_conf *bind_conf, struct
|
|||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
entry->node.key = ckchs;
|
entry->node.key = ckchs;
|
||||||
entry->ssl_conf = NULL; /* directories don't use ssl_conf */
|
LIST_ADDQ(&dir->ord_entries, &entry->by_crtlist);
|
||||||
ebpt_insert(&dir->entries, &entry->node);
|
ebpt_insert(&dir->entries, &entry->node);
|
||||||
|
|
||||||
ignore_entry:
|
ignore_entry:
|
||||||
@ -4577,8 +4582,9 @@ end:
|
|||||||
free(entry);
|
free(entry);
|
||||||
}
|
}
|
||||||
free(dir);
|
free(dir);
|
||||||
|
} else {
|
||||||
|
*crtlist = dir;
|
||||||
}
|
}
|
||||||
|
|
||||||
return cfgerr;
|
return cfgerr;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user