diff --git a/Makefile b/Makefile index 913d77aa..2baa0c0b 100644 --- a/Makefile +++ b/Makefile @@ -13,7 +13,7 @@ BUILD_TYPE=Release COMPILE_CONCURRENCY=8 -.PHONY: clean +.PHONY: clean apply_fmt clean: rm -fr $(TMP_BIN) diff --git a/sources/config_reader.c b/sources/config_reader.c index a8bf806f..cda6fb97 100644 --- a/sources/config_reader.c +++ b/sources/config_reader.c @@ -281,6 +281,9 @@ static int od_config_reader_open(od_config_reader_t *reader, char *config_file) error: od_errorf(reader->error, "failed to open config file '%s'", config_file); + if (file) { + fclose(file); + } return -1; } diff --git a/sources/console.c b/sources/console.c index feb3ea31..37f6ac7f 100644 --- a/sources/console.c +++ b/sources/console.c @@ -262,14 +262,12 @@ static inline int od_console_show_stats(od_client_t *client, od_router_t *router = client->global->router; od_cron_t *cron = client->global->cron; - machine_msg_t *msg; - msg = kiwi_be_write_row_descriptionf( - stream, "sllllllllllllll", "database", "total_xact_count", - "total_query_count", "total_received", "total_sent", - "total_xact_time", "total_query_time", "total_wait_time", - "avg_xact_count", "avg_query_count", "avg_recv", "avg_sent", - "avg_xact_time", "avg_query_time", "avg_wait_time"); - if (msg == NULL) + if (kiwi_be_write_row_descriptionf( + stream, "sllllllllllllll", "database", "total_xact_count", + "total_query_count", "total_received", "total_sent", + "total_xact_time", "total_query_time", "total_wait_time", + "avg_xact_count", "avg_query_count", "avg_recv", "avg_sent", + "avg_xact_time", "avg_query_time", "avg_wait_time") == NULL) return NOT_OK_RESPONSE; void *argv[] = { stream }; @@ -293,11 +291,8 @@ static inline od_retcode_t od_console_show_errors(od_client_t *client, void *argv[] = { stream }; - machine_msg_t *msg; - msg = kiwi_be_write_row_descriptionf(stream, "sl", "error_type", - "count"); - - if (msg == NULL) { + if (kiwi_be_write_row_descriptionf(stream, "sl", "error_type", + "count") == NULL) { return NOT_OK_RESPONSE; } @@ -325,8 +320,7 @@ static inline int od_console_show_errors_per_route_cb(od_route_t *route, machine_msg_t *stream = argv[0]; assert(stream); - if (!route || !route->extra_logging_enabled || - od_route_is_dynamic(route)) { + if (!route || !route->extra_logging_enabled) { return OK_RESPONSE; } @@ -446,11 +440,8 @@ od_console_show_errors_per_route(od_client_t *client, machine_msg_t *stream) void *argv[] = { stream }; - machine_msg_t *msg; - msg = kiwi_be_write_row_descriptionf(stream, "sssl", "error_type", - "user", "database", "count"); - - if (msg == NULL) { + if (kiwi_be_write_row_descriptionf(stream, "sssl", "error_type", "user", + "database", "count") == NULL) { return NOT_OK_RESPONSE; } @@ -464,14 +455,10 @@ static inline int od_console_show_version(machine_msg_t *stream) { assert(stream); - machine_msg_t *msg; - msg = kiwi_be_write_row_descriptionf(stream, "s", "version"); - - if (msg == NULL) + if (kiwi_be_write_row_descriptionf(stream, "s", "version") == NULL) return NOT_OK_RESPONSE; int offset; - msg = kiwi_be_write_data_row(stream, &offset); - if (msg == NULL) + if (kiwi_be_write_data_row(stream, &offset) == NULL) return NOT_OK_RESPONSE; char data[128]; diff --git a/sources/frontend.c b/sources/frontend.c index f772d320..a1b1879a 100644 --- a/sources/frontend.c +++ b/sources/frontend.c @@ -1358,7 +1358,12 @@ void od_frontend(void *arg) * here we ignore module retcode because auth already failed * we just inform side modules that usr was trying to log in */ - module->auth_complete_cb(client, rc); + od_list_foreach(&modules->link, i) + { + od_module_t *module; + module = od_container_of(i, od_module_t, link); + module->auth_complete_cb(client, rc); + } goto cleanup; } diff --git a/sources/ldap.c b/sources/ldap.c index 5d075a3a..818700e8 100644 --- a/sources/ldap.c +++ b/sources/ldap.c @@ -162,8 +162,7 @@ static inline od_retcode_t od_ldap_server_prepare(od_logger_t *logger, count = ldap_count_entries(serv->conn, search_message); od_debug(logger, "auth_ldap", NULL, NULL, - "basedn search msg: %s, count: %d", search_message, - count); + "basedn search entries count: %d", count); if (count != 1) { if (count == 0) { // TODO: report err 2 client @@ -477,16 +476,12 @@ od_retcode_t od_ldap_endpoint_free(od_ldap_endpoint_t *le) if (le->ldapsearchattribute) { free(le->ldapsearchattribute); } - if (le->ldapscope) { free(le->ldapscope); } if (le->ldapbasedn) { free(le->ldapbasedn); } - if (le->ldapbinddn) { - free(le->ldapbasedn); - } // preparsed connect url if (le->ldapurl) { free(le->ldapurl); @@ -495,6 +490,8 @@ od_retcode_t od_ldap_endpoint_free(od_ldap_endpoint_t *le) od_list_unlink(&le->link); free(le); + + return OK_RESPONSE; } od_retcode_t od_ldap_endpoint_add(od_ldap_endpoint_t *ldaps,