Skip to content

Commit 1318a6e

Browse files
committed
Turn on build rigor, fix issues
1 parent b9785c1 commit 1318a6e

File tree

4 files changed

+26
-23
lines changed

4 files changed

+26
-23
lines changed

ngx_http_bot_verifier_module.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -230,11 +230,11 @@ ngx_http_bot_verifier_module_merge_loc_conf(ngx_conf_t *cf, void *parent, void *
230230
ngx_http_bot_verifier_module_loc_conf_t *prev = (ngx_http_bot_verifier_module_loc_conf_t *) parent;
231231
ngx_http_bot_verifier_module_loc_conf_t *conf = (ngx_http_bot_verifier_module_loc_conf_t *) child;
232232

233-
ngx_conf_merge_value(conf->enabled, prev->enabled, 0);
234-
ngx_conf_merge_value(conf->redis.port, prev->redis.port, 6379);
235-
ngx_conf_merge_value(conf->redis.connection_timeout, prev->redis.connection_timeout, 10);
236-
ngx_conf_merge_value(conf->redis.read_timeout, prev->redis.read_timeout, 10);
237-
ngx_conf_merge_value(conf->redis.expiry, prev->redis.expiry, 3600);
233+
ngx_conf_merge_value(conf->enabled, prev->enabled, 0);
234+
ngx_conf_merge_uint_value(conf->redis.port, prev->redis.port, 6379);
235+
ngx_conf_merge_uint_value(conf->redis.connection_timeout, prev->redis.connection_timeout, 10);
236+
ngx_conf_merge_uint_value(conf->redis.read_timeout, prev->redis.read_timeout, 10);
237+
ngx_conf_merge_uint_value(conf->redis.expiry, prev->redis.expiry, 3600);
238238

239239
return NGX_CONF_OK;
240240
}

ngx_http_bot_verifier_provider.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ provider_t *make_provider(char *name, char *valid_domains[], size_t len) {
88
provider->len = len;
99

1010
int i;
11-
for (i = 0; i < provider->len; i++) {
11+
for (i = 0; i < (int)provider->len; i++) {
1212
provider->valid_domains[i] = valid_domains[i];
1313
}
1414

ngx_http_bot_verifier_verifier.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ hostname_matches_provider_domain(ngx_http_request_t *r, char *hostname, ngx_http
2828
capture.data = ngx_hostname.data + captures[i];
2929
capture.len = captures[i + 1] - captures[i];
3030
ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, "Capture: %V", &capture);
31-
for (j = 0; j < loc_conf->provider_len; j++) {
31+
for (j = 0; j < (int)loc_conf->provider_len; j++) {
3232
// TODO: This could be optimized capturing the name of the provider that matched and only iteration through that providers valid domains.
33-
for (k = 0; k < loc_conf->providers[j]->len; k++) {
33+
for (k = 0; k < (int)loc_conf->providers[j]->len; k++) {
3434
ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, "Comparing %s against: %s", capture.data, loc_conf->providers[j]->valid_domains[k]);
3535
if (ngx_strncmp(capture.data, loc_conf->providers[j]->valid_domains[k], strlen(loc_conf->providers[j]->valid_domains[k])) == 0) {
3636
ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, "Found match for %V with %V", &ngx_hostname, &capture);

script/bootstrap

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@
33
set -o nounset
44
set -o errexit
55

6-
NGINX_VERSION=1.14.0
6+
NGINX_VERSION=1.16.0
77

88
DIR=$(pwd)
99
BUILDDIR=$DIR/build
1010
NGINX_DIR=nginx
11+
DEBUG_FLAGS="-g -O0 -Wall -Werror -static-libasan -fsanitize=address -fsanitize=leak -fsanitize=undefined -fsanitize=unreachable -fsanitize=vla-bound -fsanitize=null"
1112

1213
setup_local_directories () {
1314
if [ ! -d $BUILDDIR ]; then
@@ -36,13 +37,13 @@ install_nginx () {
3637
curl -s -L -O "http://nginx.org/download/nginx-$NGINX_VERSION.tar.gz"
3738
tar xzf "nginx-$NGINX_VERSION.tar.gz"
3839
pushd "nginx-$NGINX_VERSION" > /dev/null 2>&1
39-
CFLAGS="-g -O0 -Wall -Werror" ./configure \
40-
--with-debug \
41-
--prefix=$(pwd)/../../build/nginx \
42-
--conf-path=conf/nginx.conf \
43-
--error-log-path=logs/error.log \
44-
--http-log-path=logs/access.log \
45-
--add-module=../echo-nginx-module \
40+
./configure \
41+
--with-debug \
42+
--prefix=$(pwd)/../../build/nginx \
43+
--conf-path=conf/nginx.conf \
44+
--error-log-path=logs/error.log \
45+
--http-log-path=logs/access.log \
46+
--add-module=../echo-nginx-module \
4647
--add-module=../..
4748
make
4849
make install
@@ -57,13 +58,15 @@ install_nginx () {
5758
compile () {
5859
pushd "vendor" > /dev/null 2>&1
5960
pushd "nginx-$NGINX_VERSION" > /dev/null 2>&1
60-
CFLAGS="-g -O0 -Wall -Werror" ./configure \
61-
--with-debug \
62-
--prefix=$(pwd)/../../build/nginx \
63-
--conf-path=conf/nginx.conf \
64-
--error-log-path=logs/error.log \
65-
--http-log-path=logs/access.log \
66-
--add-module=../echo-nginx-module \
61+
./configure \
62+
--with-debug \
63+
--with-threads \
64+
--with-ld-opt="-lasan -lubsan -ldl" \
65+
--prefix=$(pwd)/../../build/nginx \
66+
--conf-path=conf/nginx.conf \
67+
--error-log-path=logs/error.log \
68+
--http-log-path=logs/access.log \
69+
--add-module=../echo-nginx-module \
6770
--add-module=../..
6871
make
6972
make install

0 commit comments

Comments
 (0)