diff --git a/src/client/ldap.c b/src/client/ldap.c index 376dbad35..2ce29252e 100644 --- a/src/client/ldap.c +++ b/src/client/ldap.c @@ -840,11 +840,11 @@ static LDAPMod ** get_ldap_write_mod(json_t * j_params, json_t * j_client, int a json_array_append_new(j_mod_value_free_array, json_integer(i)); } } else { - y_log_message(Y_LOG_LEVEL_ERROR, "get_ldap_write_mod - Error allocating resources for mods[%d]->mod_values (%s)", json_string_value(json_object_get(j_format, "property")), i); + y_log_message(Y_LOG_LEVEL_ERROR, "get_ldap_write_mod - Error allocating resources for mods[%zu]->mod_values (%s)", i, json_string_value(json_object_get(j_format, "property"))); has_error = 1; } } else { - y_log_message(Y_LOG_LEVEL_ERROR, "get_ldap_write_mod - Error allocating resources for mods[%d] (%s)", json_string_value(json_object_get(j_format, "property")), i); + y_log_message(Y_LOG_LEVEL_ERROR, "get_ldap_write_mod - Error allocating resources for mods[%zu] (%s)", i, json_string_value(json_object_get(j_format, "property"))); has_error = 1; } } else if (json_object_get(json_object_get(json_object_get(j_params, "data-format"), field), "multiple") != json_true()) { @@ -872,11 +872,11 @@ static LDAPMod ** get_ldap_write_mod(json_t * j_params, json_t * j_client, int a } mods[i]->mod_values[1] = NULL; } else { - y_log_message(Y_LOG_LEVEL_ERROR, "get_ldap_write_mod - Error allocating resources for mods[%d]->mod_values (%s)", json_string_value(json_object_get(j_format, "property")), i); + y_log_message(Y_LOG_LEVEL_ERROR, "get_ldap_write_mod - Error allocating resources for mods[%zu]->mod_values (%s)", i, json_string_value(json_object_get(j_format, "property"))); has_error = 1; } } else { - y_log_message(Y_LOG_LEVEL_ERROR, "get_ldap_write_mod - Error allocating resources for mods[%d] (%s)", json_string_value(json_object_get(j_format, "property")), i); + y_log_message(Y_LOG_LEVEL_ERROR, "get_ldap_write_mod - Error allocating resources for mods[%zu] (%s)", i, json_string_value(json_object_get(j_format, "property"))); has_error = 1; } } else { diff --git a/src/misc.c b/src/misc.c index daa48a082..4cdafd66f 100644 --- a/src/misc.c +++ b/src/misc.c @@ -31,12 +31,13 @@ * SOFTWARE. * */ +#include +#include +#include #include #include #include #include -#include -#include #include #include #include diff --git a/src/module.c b/src/module.c index 0d0f0f6aa..f55d79778 100644 --- a/src/module.c +++ b/src/module.c @@ -46,7 +46,7 @@ json_t * get_module_type_list(struct config_elements * config) { "display_name", user_module->display_name, "description", user_module->description)); } else { - y_log_message(Y_LOG_LEVEL_ERROR, "get_module_type_list - Error pointer_list_get_at for user module at index %d", i); + y_log_message(Y_LOG_LEVEL_ERROR, "get_module_type_list - Error pointer_list_get_at for user module at index %zu", i); } } // Gathering user middleware modules @@ -58,7 +58,7 @@ json_t * get_module_type_list(struct config_elements * config) { "display_name", user_middleware_module->display_name, "description", user_middleware_module->description)); } else { - y_log_message(Y_LOG_LEVEL_ERROR, "get_module_type_list - Error pointer_list_get_at for user_middleware module at index %d", i); + y_log_message(Y_LOG_LEVEL_ERROR, "get_module_type_list - Error pointer_list_get_at for user_middleware module at index %zu", i); } } // Gathering client modules @@ -70,7 +70,7 @@ json_t * get_module_type_list(struct config_elements * config) { "display_name", client_module->display_name, "description", client_module->description)); } else { - y_log_message(Y_LOG_LEVEL_ERROR, "get_module_type_list - Error pointer_list_get_at for client module at index %d", i); + y_log_message(Y_LOG_LEVEL_ERROR, "get_module_type_list - Error pointer_list_get_at for client module at index %zu", i); } } // Gathering user auth scheme modules @@ -82,7 +82,7 @@ json_t * get_module_type_list(struct config_elements * config) { "display_name", scheme_module->display_name, "description", scheme_module->description)); } else { - y_log_message(Y_LOG_LEVEL_ERROR, "get_module_type_list - Error pointer_list_get_at for user auth scheme module at index %d", i); + y_log_message(Y_LOG_LEVEL_ERROR, "get_module_type_list - Error pointer_list_get_at for user auth scheme module at index %zu", i); } } // Gathering plugin modules @@ -94,7 +94,7 @@ json_t * get_module_type_list(struct config_elements * config) { "display_name", plugin_module->display_name, "description", plugin_module->description)); } else { - y_log_message(Y_LOG_LEVEL_ERROR, "get_module_type_list - Error pointer_list_get_at for plugin module at index %d", i); + y_log_message(Y_LOG_LEVEL_ERROR, "get_module_type_list - Error pointer_list_get_at for plugin module at index %zu", i); } } } else { diff --git a/src/plugin/protocol_oidc.c b/src/plugin/protocol_oidc.c index 954fd544f..a5a258370 100644 --- a/src/plugin/protocol_oidc.c +++ b/src/plugin/protocol_oidc.c @@ -3038,11 +3038,11 @@ static int serialize_pushed_request_uri(struct _oidc_config * config, str_authorization_details = json_dumps(j_authorization_details, JSON_COMPACT); } if (config->glewlwyd_config->glewlwyd_config->conn->type==HOEL_DB_TYPE_MARIADB) { - expires_at_clause = msprintf("FROM_UNIXTIME(%u)", (now + (time_t)config->request_uri_duration)); + expires_at_clause = msprintf("FROM_UNIXTIME(%ld)", (now + (time_t)config->request_uri_duration)); } else if (config->glewlwyd_config->glewlwyd_config->conn->type==HOEL_DB_TYPE_PGSQL) { - expires_at_clause = msprintf("TO_TIMESTAMP(%u)", (now + (time_t)config->request_uri_duration )); + expires_at_clause = msprintf("TO_TIMESTAMP(%ld)", (now + (time_t)config->request_uri_duration )); } else { // HOEL_DB_TYPE_SQLITE - expires_at_clause = msprintf("%u", (now + (time_t)config->request_uri_duration)); + expires_at_clause = msprintf("%ld", (now + (time_t)config->request_uri_duration)); } if (u_map_count(additional_parameters)) { if ((j_additional_parameters = json_object()) != NULL) { @@ -3165,11 +3165,11 @@ static int serialize_id_token(struct _oidc_config * config, } else { if (issued_for != NULL && now > 0 && id_token_hash != NULL) { if (config->glewlwyd_config->glewlwyd_config->conn->type==HOEL_DB_TYPE_MARIADB) { - issued_at_clause = msprintf("FROM_UNIXTIME(%u)", (now)); + issued_at_clause = msprintf("FROM_UNIXTIME(%ld)", (now)); } else if (config->glewlwyd_config->glewlwyd_config->conn->type==HOEL_DB_TYPE_PGSQL) { - issued_at_clause = msprintf("TO_TIMESTAMP(%u)", (now)); + issued_at_clause = msprintf("TO_TIMESTAMP(%ld)", (now)); } else { // HOEL_DB_TYPE_SQLITE - issued_at_clause = msprintf("%u", (now)); + issued_at_clause = msprintf("%ld", (now)); } j_query = json_pack("{sss{sssisosos{ss}ssssssss*soso}}", "table", @@ -3402,11 +3402,11 @@ static int serialize_access_token(struct _oidc_config * config, if ((access_token_hash = config->glewlwyd_config->glewlwyd_callback_generate_hash(config->glewlwyd_config, access_token)) != NULL) { if (issued_for != NULL && now > 0) { if (config->glewlwyd_config->glewlwyd_config->conn->type==HOEL_DB_TYPE_MARIADB) { - issued_at_clause = msprintf("FROM_UNIXTIME(%u)", (now)); + issued_at_clause = msprintf("FROM_UNIXTIME(%ld)", (now)); } else if (config->glewlwyd_config->glewlwyd_config->conn->type==HOEL_DB_TYPE_PGSQL) { - issued_at_clause = msprintf("TO_TIMESTAMP(%u)", (now)); + issued_at_clause = msprintf("TO_TIMESTAMP(%ld)", (now)); } else { // HOEL_DB_TYPE_SQLITE - issued_at_clause = msprintf("%u", (now)); + issued_at_clause = msprintf("%ld", (now)); } if (j_authorization_details != NULL) { str_authorization_details = json_dumps(j_authorization_details, JSON_COMPACT); @@ -3645,25 +3645,25 @@ static json_t * serialize_refresh_token(struct _oidc_config * config, if (token_hash != NULL && username != NULL && issued_for != NULL && now > 0 && duration > 0) { json_error_t error; if (config->glewlwyd_config->glewlwyd_config->conn->type==HOEL_DB_TYPE_MARIADB) { - issued_at_clause = msprintf("FROM_UNIXTIME(%u)", (now)); + issued_at_clause = msprintf("FROM_UNIXTIME(%ld)", (now)); } else if (config->glewlwyd_config->glewlwyd_config->conn->type==HOEL_DB_TYPE_PGSQL) { - issued_at_clause = msprintf("TO_TIMESTAMP(%u)", (now)); + issued_at_clause = msprintf("TO_TIMESTAMP(%ld)", (now)); } else { // HOEL_DB_TYPE_SQLITE - issued_at_clause = msprintf("%u", (now)); + issued_at_clause = msprintf("%ld", (now)); } if (config->glewlwyd_config->glewlwyd_config->conn->type==HOEL_DB_TYPE_MARIADB) { - last_seen_clause = msprintf("FROM_UNIXTIME(%u)", (now)); + last_seen_clause = msprintf("FROM_UNIXTIME(%ld)", (now)); } else if (config->glewlwyd_config->glewlwyd_config->conn->type==HOEL_DB_TYPE_PGSQL) { - last_seen_clause = msprintf("TO_TIMESTAMP(%u)", (now)); + last_seen_clause = msprintf("TO_TIMESTAMP(%ld)", (now)); } else { // HOEL_DB_TYPE_SQLITE - last_seen_clause = msprintf("%u", (now)); + last_seen_clause = msprintf("%ld", (now)); } if (config->glewlwyd_config->glewlwyd_config->conn->type==HOEL_DB_TYPE_MARIADB) { - expires_at_clause = msprintf("FROM_UNIXTIME(%u)", (now + (time_t)duration)); + expires_at_clause = msprintf("FROM_UNIXTIME(%ld)", (now + (time_t)duration)); } else if (config->glewlwyd_config->glewlwyd_config->conn->type==HOEL_DB_TYPE_PGSQL) { - expires_at_clause = msprintf("TO_TIMESTAMP(%u)", (now + (time_t)duration )); + expires_at_clause = msprintf("TO_TIMESTAMP(%ld)", (now + (time_t)duration )); } else { // HOEL_DB_TYPE_SQLITE - expires_at_clause = msprintf("%u", (now + (time_t)duration)); + expires_at_clause = msprintf("%ld", (now + (time_t)duration)); } if (j_claims_request != NULL) { if ((str_claims_request = json_dumps(j_claims_request, JSON_COMPACT)) == NULL) { @@ -4162,11 +4162,11 @@ static json_t * generate_authorization_code(struct _oidc_config * config, } time(&now); if (config->glewlwyd_config->glewlwyd_config->conn->type==HOEL_DB_TYPE_MARIADB) { - expiration_clause = msprintf("FROM_UNIXTIME(%u)", (now + (time_t)config->code_duration )); + expiration_clause = msprintf("FROM_UNIXTIME(%ld)", (now + (time_t)config->code_duration )); } else if (config->glewlwyd_config->glewlwyd_config->conn->type==HOEL_DB_TYPE_PGSQL) { - expiration_clause = msprintf("TO_TIMESTAMP(%u)", (now + (time_t)config->code_duration )); + expiration_clause = msprintf("TO_TIMESTAMP(%ld)", (now + (time_t)config->code_duration )); } else { // HOEL_DB_TYPE_SQLITE - expiration_clause = msprintf("%u", (now + (time_t)config->code_duration )); + expiration_clause = msprintf("%ld", (now + (time_t)config->code_duration )); } if (j_authorization_details != NULL) { str_authorization_details = json_dumps(j_authorization_details, JSON_COMPACT); @@ -4928,11 +4928,11 @@ static json_t * validate_refresh_token(struct _oidc_config * config, const char if ((token_hash = config->glewlwyd_config->glewlwyd_callback_generate_hash(config->glewlwyd_config, refresh_token)) != NULL) { time(&now); if (config->glewlwyd_config->glewlwyd_config->conn->type==HOEL_DB_TYPE_MARIADB) { - expires_at_clause = msprintf("> FROM_UNIXTIME(%u)", (now)); + expires_at_clause = msprintf("> FROM_UNIXTIME(%ld)", now); } else if (config->glewlwyd_config->glewlwyd_config->conn->type==HOEL_DB_TYPE_PGSQL) { - expires_at_clause = msprintf("> TO_TIMESTAMP(%u)", now); + expires_at_clause = msprintf("> TO_TIMESTAMP(%ld)", now); } else { // HOEL_DB_TYPE_SQLITE - expires_at_clause = msprintf("> %u", (now)); + expires_at_clause = msprintf("> %ld", (now)); } j_query = json_pack("{sss[ssssssssssssssss]s{sssss{ssss}}}", "table", @@ -5217,11 +5217,11 @@ static int update_refresh_token(struct _oidc_config * config, json_int_t gpor_id char * expires_at_clause, * last_seen_clause; if (config->glewlwyd_config->glewlwyd_config->conn->type==HOEL_DB_TYPE_MARIADB) { - last_seen_clause = msprintf("FROM_UNIXTIME(%u)", (now)); + last_seen_clause = msprintf("FROM_UNIXTIME(%ld)", now); } else if (config->glewlwyd_config->glewlwyd_config->conn->type==HOEL_DB_TYPE_PGSQL) { - last_seen_clause = msprintf("TO_TIMESTAMP(%u)", now); + last_seen_clause = msprintf("TO_TIMESTAMP(%ld)", now); } else { // HOEL_DB_TYPE_SQLITE - last_seen_clause = msprintf("%u", (now)); + last_seen_clause = msprintf("%ld", (now)); } j_query = json_pack("{sss{s{ss}}s{sssI}}", "table", @@ -5238,11 +5238,11 @@ static int update_refresh_token(struct _oidc_config * config, json_int_t gpor_id o_free(last_seen_clause); if (refresh_token_duration) { if (config->glewlwyd_config->glewlwyd_config->conn->type==HOEL_DB_TYPE_MARIADB) { - expires_at_clause = msprintf("FROM_UNIXTIME(%u)", (now + (time_t)refresh_token_duration)); + expires_at_clause = msprintf("FROM_UNIXTIME(%ld)", (now + (time_t)refresh_token_duration)); } else if (config->glewlwyd_config->glewlwyd_config->conn->type==HOEL_DB_TYPE_PGSQL) { - expires_at_clause = msprintf("TO_TIMESTAMP(%u)", (now + (time_t)refresh_token_duration)); + expires_at_clause = msprintf("TO_TIMESTAMP(%ld)", (now + (time_t)refresh_token_duration)); } else { // HOEL_DB_TYPE_SQLITE - expires_at_clause = msprintf("%u", (now + (time_t)refresh_token_duration)); + expires_at_clause = msprintf("%ld", (now + (time_t)refresh_token_duration)); } json_object_set_new(json_object_get(j_query, "set"), "gpor_expires_at", json_pack("{ss}", "raw", expires_at_clause)); o_free(expires_at_clause); @@ -6453,11 +6453,11 @@ static json_t * get_token_metadata(struct _oidc_config * config, const char * to if ((token_hash = config->glewlwyd_config->glewlwyd_callback_generate_hash(config->glewlwyd_config, token)) != NULL) { time(&now); if (config->glewlwyd_config->glewlwyd_config->conn->type==HOEL_DB_TYPE_MARIADB) { - expires_at_clause = msprintf("> FROM_UNIXTIME(%u)", (now)); + expires_at_clause = msprintf("> FROM_UNIXTIME(%ld)", now); } else if (config->glewlwyd_config->glewlwyd_config->conn->type==HOEL_DB_TYPE_PGSQL) { - expires_at_clause = msprintf("> TO_TIMESTAMP(%u)", now); + expires_at_clause = msprintf("> TO_TIMESTAMP(%ld)", now); } else { // HOEL_DB_TYPE_SQLITE - expires_at_clause = msprintf("> %u", (now)); + expires_at_clause = msprintf("> %ld", (now)); } if ((token_type_hint == NULL || 0 == o_strcmp("refresh_token", token_type_hint)) && o_strlen(token) == OIDC_REFRESH_TOKEN_LENGTH) { j_query = json_pack("{sss[ssssssss]s{sssss{ssss}}}", @@ -8064,14 +8064,14 @@ static json_t * generate_device_authorization(struct _oidc_config * config, cons if (device_code_hash != NULL && user_code_hash != NULL) { time(&now); if (config->glewlwyd_config->glewlwyd_config->conn->type==HOEL_DB_TYPE_MARIADB) { - expires_at_clause = msprintf("FROM_UNIXTIME(%u)", (now + expiration)); - last_check_clause = msprintf("FROM_UNIXTIME(%u)", (now - (2*expiration))); + expires_at_clause = msprintf("FROM_UNIXTIME(%ld)", (now + expiration)); + last_check_clause = msprintf("FROM_UNIXTIME(%ld)", (now - (2*expiration))); } else if (config->glewlwyd_config->glewlwyd_config->conn->type==HOEL_DB_TYPE_PGSQL) { - expires_at_clause = msprintf("TO_TIMESTAMP(%u)", (now + expiration)); - last_check_clause = msprintf("TO_TIMESTAMP(%u)", (now - (2*expiration))); + expires_at_clause = msprintf("TO_TIMESTAMP(%ld)", (now + expiration)); + last_check_clause = msprintf("TO_TIMESTAMP(%ld)", (now - (2*expiration))); } else { // HOEL_DB_TYPE_SQLITE - expires_at_clause = msprintf("%u", (now + expiration)); - last_check_clause = msprintf("%u", (now - (2*expiration))); + expires_at_clause = msprintf("%ld", (now + expiration)); + last_check_clause = msprintf("%ld", (now - (2*expiration))); } if (j_authorization_details != NULL) { str_authorization_details = json_dumps(j_authorization_details, JSON_COMPACT); @@ -8228,11 +8228,11 @@ static json_t * validate_device_auth_user_code(struct _oidc_config * config, con user_code_ucase[GLEWLWYD_DEVICE_AUTH_USER_CODE_LENGTH+1] = '\0'; time(&now); if (config->glewlwyd_config->glewlwyd_config->conn->type==HOEL_DB_TYPE_MARIADB) { - expires_at_clause = msprintf("> FROM_UNIXTIME(%u)", (now)); + expires_at_clause = msprintf("> FROM_UNIXTIME(%ld)", now); } else if (config->glewlwyd_config->glewlwyd_config->conn->type==HOEL_DB_TYPE_PGSQL) { - expires_at_clause = msprintf("> TO_TIMESTAMP(%u)", now); + expires_at_clause = msprintf("> TO_TIMESTAMP(%ld)", now); } else { // HOEL_DB_TYPE_SQLITE - expires_at_clause = msprintf("> %u", (now)); + expires_at_clause = msprintf("> %ld", (now)); } if ((user_code_hash = config->glewlwyd_config->glewlwyd_callback_generate_hash(config->glewlwyd_config, user_code_ucase)) != NULL) { j_query = json_pack("{sss[ss]s{sss{ssss}sssi}}", @@ -11770,11 +11770,11 @@ static int serialize_ciba_request(struct _oidc_config * config, if (res == H_OK) { time(&now); if (config->glewlwyd_config->glewlwyd_config->conn->type==HOEL_DB_TYPE_MARIADB) { - expires_at_clause = msprintf("FROM_UNIXTIME(%u)", (now + (time_t)requested_expiry)); + expires_at_clause = msprintf("FROM_UNIXTIME(%ld)", (now + (time_t)requested_expiry)); } else if (config->glewlwyd_config->glewlwyd_config->conn->type==HOEL_DB_TYPE_PGSQL) { - expires_at_clause = msprintf("TO_TIMESTAMP(%u)", (now + (time_t)requested_expiry )); + expires_at_clause = msprintf("TO_TIMESTAMP(%ld)", (now + (time_t)requested_expiry )); } else { // HOEL_DB_TYPE_SQLITE - expires_at_clause = msprintf("%u", (now + (time_t)requested_expiry)); + expires_at_clause = msprintf("%ld", (now + (time_t)requested_expiry)); } j_query = json_pack("{sss{ss ss ss* sO ss* ss* ss ss ss* s{ss} ss ss* ss*}}", "table", GLEWLWYD_PLUGIN_OIDC_TABLE_CIBA, @@ -12345,11 +12345,11 @@ static json_t * get_ciba_requests_for_user(struct _oidc_config * config, const c time(&now); if (config->glewlwyd_config->glewlwyd_config->conn->type==HOEL_DB_TYPE_MARIADB) { - expires_at_clause = msprintf("> FROM_UNIXTIME(%u)", (now)); + expires_at_clause = msprintf("> FROM_UNIXTIME(%ld)", now); } else if (config->glewlwyd_config->glewlwyd_config->conn->type==HOEL_DB_TYPE_PGSQL) { - expires_at_clause = msprintf("> TO_TIMESTAMP(%u)", now); + expires_at_clause = msprintf("> TO_TIMESTAMP(%ld)", now); } else { // HOEL_DB_TYPE_SQLITE - expires_at_clause = msprintf("> %u", (now)); + expires_at_clause = msprintf("> %ld", (now)); } j_query = json_pack("{sss[ssss]s{sssssis{ssss}si}ss}", "table", GLEWLWYD_PLUGIN_OIDC_TABLE_CIBA, @@ -12522,11 +12522,11 @@ static json_t * get_ciba_request_from_user_req_id(struct _oidc_config * config, if (!o_strnullempty(user_req_id)) { time(&now); if (config->glewlwyd_config->glewlwyd_config->conn->type==HOEL_DB_TYPE_MARIADB) { - expires_at_clause = msprintf("> FROM_UNIXTIME(%u)", (now)); + expires_at_clause = msprintf("> FROM_UNIXTIME(%ld)", now); } else if (config->glewlwyd_config->glewlwyd_config->conn->type==HOEL_DB_TYPE_PGSQL) { - expires_at_clause = msprintf("> TO_TIMESTAMP(%u)", now); + expires_at_clause = msprintf("> TO_TIMESTAMP(%ld)", now); } else { // HOEL_DB_TYPE_SQLITE - expires_at_clause = msprintf("> %u", (now)); + expires_at_clause = msprintf("> %ld", (now)); } j_query = json_pack("{sss[sssssssssss]s{sssssis{ssss}si}}", "table", GLEWLWYD_PLUGIN_OIDC_TABLE_CIBA, @@ -12934,11 +12934,11 @@ static json_t * verify_pushed_authorization_request(struct _oidc_config * config if (!o_strnullempty(client_id)) { time(&now); if (config->glewlwyd_config->glewlwyd_config->conn->type==HOEL_DB_TYPE_MARIADB) { - expires_at_clause = msprintf("((gpop_status=0 AND gpop_expires_at> FROM_UNIXTIME(%u)) OR gpop_status=1)", (now)); + expires_at_clause = msprintf("((gpop_status=0 AND gpop_expires_at> FROM_UNIXTIME(%ld)) OR gpop_status=1)", (now)); } else if (config->glewlwyd_config->glewlwyd_config->conn->type==HOEL_DB_TYPE_PGSQL) { - expires_at_clause = msprintf("((gpop_status=0 AND gpop_expires_at> TO_TIMESTAMP(%u)) OR gpop_status=1)", now); + expires_at_clause = msprintf("((gpop_status=0 AND gpop_expires_at> TO_TIMESTAMP(%ld)) OR gpop_status=1)", now); } else { // HOEL_DB_TYPE_SQLITE - expires_at_clause = msprintf("((gpop_status=0 AND gpop_expires_at> %u) OR gpop_status=1)", (now)); + expires_at_clause = msprintf("((gpop_status=0 AND gpop_expires_at> %ld) OR gpop_status=1)", (now)); } if ((request_uri_hash = config->glewlwyd_config->glewlwyd_callback_generate_hash(config->glewlwyd_config, request_uri)) != NULL) { j_query = json_pack("{sss[sssssssssssss]s{ss ss ss s{ss ss}}}", @@ -13297,11 +13297,11 @@ static int disable_tokens_from_session(struct _oidc_config * config, const char time(&now); if (config->glewlwyd_config->glewlwyd_config->conn->type==HOEL_DB_TYPE_MARIADB) { - expires_at_clause = msprintf("> FROM_UNIXTIME(%u)", (now)); + expires_at_clause = msprintf("> FROM_UNIXTIME(%ld)", (now)); } else if (config->glewlwyd_config->glewlwyd_config->conn->type==HOEL_DB_TYPE_PGSQL) { - expires_at_clause = msprintf("> TO_TIMESTAMP(%u)", now); + expires_at_clause = msprintf("> TO_TIMESTAMP(%ld)", now); } else { // HOEL_DB_TYPE_SQLITE - expires_at_clause = msprintf("> %u", (now)); + expires_at_clause = msprintf("> %ld", (now)); } sid_escaped = h_escape_string_with_quotes(config->glewlwyd_config->glewlwyd_config->conn, sid); name_escaped = h_escape_string_with_quotes(config->glewlwyd_config->glewlwyd_config->conn, config->name); diff --git a/src/plugin/register.c b/src/plugin/register.c index 028ccebe8..4a874c9ec 100644 --- a/src/plugin/register.c +++ b/src/plugin/register.c @@ -223,11 +223,11 @@ static json_t * register_generate_email_verification_code(struct _register_confi // Disable existing sessions for the specified e-mail address time(&now); if (config->glewlwyd_config->glewlwyd_config->conn->type==HOEL_DB_TYPE_MARIADB) { - expires_at_clause = msprintf("> FROM_UNIXTIME(%u)", (now)); + expires_at_clause = msprintf("> FROM_UNIXTIME(%ld)", (now)); } else if (config->glewlwyd_config->glewlwyd_config->conn->type==HOEL_DB_TYPE_PGSQL) { - expires_at_clause = msprintf("> TO_TIMESTAMP(%u)", now); + expires_at_clause = msprintf("> TO_TIMESTAMP(%ld)", now); } else { // HOEL_DB_TYPE_SQLITE - expires_at_clause = msprintf("> %u", (now)); + expires_at_clause = msprintf("> %ld", (now)); } j_query = json_pack("{sss{si}s{sssss{ssss}si}}", "table", @@ -274,11 +274,11 @@ static json_t * register_generate_email_verification_code(struct _register_confi body) == U_OK) { y_log_message(Y_LOG_LEVEL_WARNING, "Security - Register new user - code sent to email %s at IP Address %s", email, ip_source); if (config->glewlwyd_config->glewlwyd_config->conn->type==HOEL_DB_TYPE_MARIADB) { - expires_at_clause = msprintf("FROM_UNIXTIME(%u)", (now + (time_t)json_integer_value(json_object_get(config->j_parameters, "verification-code-duration")))); + expires_at_clause = msprintf("FROM_UNIXTIME(%ld)", (now + (time_t)json_integer_value(json_object_get(config->j_parameters, "verification-code-duration")))); } else if (config->glewlwyd_config->glewlwyd_config->conn->type==HOEL_DB_TYPE_PGSQL) { - expires_at_clause = msprintf("TO_TIMESTAMP(%u)", (now + (time_t)json_integer_value(json_object_get(config->j_parameters, "verification-code-duration")))); + expires_at_clause = msprintf("TO_TIMESTAMP(%ld)", (now + (time_t)json_integer_value(json_object_get(config->j_parameters, "verification-code-duration")))); } else { // HOEL_DB_TYPE_SQLITE - expires_at_clause = msprintf("%u", (now + (time_t)json_integer_value(json_object_get(config->j_parameters, "verification-code-duration")))); + expires_at_clause = msprintf("%ld", (now + (time_t)json_integer_value(json_object_get(config->j_parameters, "verification-code-duration")))); } j_query = json_pack("{sss{ssssssssss?sss{ss}ssss}}", "table", @@ -377,11 +377,11 @@ static json_t * register_verify_email_token(struct _register_config * config, co if ((token_hash = config->glewlwyd_config->glewlwyd_callback_generate_hash(config->glewlwyd_config, token)) != NULL) { time(&now); if (config->glewlwyd_config->glewlwyd_config->conn->type==HOEL_DB_TYPE_MARIADB) { - expires_at_clause = msprintf("> FROM_UNIXTIME(%u)", (now)); + expires_at_clause = msprintf("> FROM_UNIXTIME(%ld)", (now)); } else if (config->glewlwyd_config->glewlwyd_config->conn->type==HOEL_DB_TYPE_PGSQL) { - expires_at_clause = msprintf("> TO_TIMESTAMP(%u)", now); + expires_at_clause = msprintf("> TO_TIMESTAMP(%ld)", now); } else { // HOEL_DB_TYPE_SQLITE - expires_at_clause = msprintf("> %u", (now)); + expires_at_clause = msprintf("> %ld", (now)); } j_query = json_pack("{sss[sss]s{sssss{ssss}si}}", "table", @@ -413,11 +413,11 @@ static json_t * register_verify_email_token(struct _register_config * config, co if ((session_hash = config->glewlwyd_config->glewlwyd_callback_generate_hash(config->glewlwyd_config, session)) != NULL) { time(&now); if (config->glewlwyd_config->glewlwyd_config->conn->type==HOEL_DB_TYPE_MARIADB) { - expires_at_clause = msprintf("FROM_UNIXTIME(%u)", (now + (time_t)json_integer_value(json_object_get(config->j_parameters, "session-duration")))); + expires_at_clause = msprintf("FROM_UNIXTIME(%ld)", (now + (time_t)json_integer_value(json_object_get(config->j_parameters, "session-duration")))); } else if (config->glewlwyd_config->glewlwyd_config->conn->type==HOEL_DB_TYPE_PGSQL) { - expires_at_clause = msprintf("TO_TIMESTAMP(%u)", (now + (time_t)json_integer_value(json_object_get(config->j_parameters, "session-duration")))); + expires_at_clause = msprintf("TO_TIMESTAMP(%ld)", (now + (time_t)json_integer_value(json_object_get(config->j_parameters, "session-duration")))); } else { // HOEL_DB_TYPE_SQLITE - expires_at_clause = msprintf("%u", (now + (time_t)json_integer_value(json_object_get(config->j_parameters, "session-duration")))); + expires_at_clause = msprintf("%ld", (now + (time_t)json_integer_value(json_object_get(config->j_parameters, "session-duration")))); } j_query = json_pack("{sss{sss{ss}ss}s{sssO}}", "table", @@ -487,11 +487,11 @@ static json_t * register_verify_email_code(struct _register_config * config, con if ((code_hash = config->glewlwyd_config->glewlwyd_callback_generate_hash(config->glewlwyd_config, code)) != NULL) { time(&now); if (config->glewlwyd_config->glewlwyd_config->conn->type==HOEL_DB_TYPE_MARIADB) { - expires_at_clause = msprintf("> FROM_UNIXTIME(%u)", (now)); + expires_at_clause = msprintf("> FROM_UNIXTIME(%ld)", (now)); } else if (config->glewlwyd_config->glewlwyd_config->conn->type==HOEL_DB_TYPE_PGSQL) { - expires_at_clause = msprintf("> TO_TIMESTAMP(%u)", now); + expires_at_clause = msprintf("> TO_TIMESTAMP(%ld)", now); } else { // HOEL_DB_TYPE_SQLITE - expires_at_clause = msprintf("> %u", (now)); + expires_at_clause = msprintf("> %ld", (now)); } j_query = json_pack("{sss[s]s{sssssssss{ssss}si}}", "table", @@ -525,11 +525,11 @@ static json_t * register_verify_email_code(struct _register_config * config, con if ((session_hash = config->glewlwyd_config->glewlwyd_callback_generate_hash(config->glewlwyd_config, session)) != NULL) { time(&now); if (config->glewlwyd_config->glewlwyd_config->conn->type==HOEL_DB_TYPE_MARIADB) { - expires_at_clause = msprintf("FROM_UNIXTIME(%u)", (now + (time_t)json_integer_value(json_object_get(config->j_parameters, "session-duration")))); + expires_at_clause = msprintf("FROM_UNIXTIME(%ld)", (now + (time_t)json_integer_value(json_object_get(config->j_parameters, "session-duration")))); } else if (config->glewlwyd_config->glewlwyd_config->conn->type==HOEL_DB_TYPE_PGSQL) { - expires_at_clause = msprintf("TO_TIMESTAMP(%u)", (now + (time_t)json_integer_value(json_object_get(config->j_parameters, "session-duration")))); + expires_at_clause = msprintf("TO_TIMESTAMP(%ld)", (now + (time_t)json_integer_value(json_object_get(config->j_parameters, "session-duration")))); } else { // HOEL_DB_TYPE_SQLITE - expires_at_clause = msprintf("%u", (now + (time_t)json_integer_value(json_object_get(config->j_parameters, "session-duration")))); + expires_at_clause = msprintf("%ld", (now + (time_t)json_integer_value(json_object_get(config->j_parameters, "session-duration")))); } j_query = json_pack("{sss{sss{ss}ss}s{sssO}}", "table", @@ -601,11 +601,11 @@ static json_t * register_check_session(struct _register_config * config, const c if (session_hash != NULL) { time(&now); if (config->glewlwyd_config->glewlwyd_config->conn->type==HOEL_DB_TYPE_MARIADB) { - expires_at_clause = msprintf("> FROM_UNIXTIME(%u)", (now)); + expires_at_clause = msprintf("> FROM_UNIXTIME(%ld)", (now)); } else if (config->glewlwyd_config->glewlwyd_config->conn->type==HOEL_DB_TYPE_PGSQL) { - expires_at_clause = msprintf("> TO_TIMESTAMP(%u)", now); + expires_at_clause = msprintf("> TO_TIMESTAMP(%ld)", now); } else { // HOEL_DB_TYPE_SQLITE - expires_at_clause = msprintf("> %u", (now)); + expires_at_clause = msprintf("> %ld", (now)); } j_query = json_pack("{sss[sssss]s{sssss{ssss}si}}", "table", @@ -669,11 +669,11 @@ static json_t * register_check_username(struct _register_config * config, const if (!o_strnullempty(username)) { time(&now); if (config->glewlwyd_config->glewlwyd_config->conn->type==HOEL_DB_TYPE_MARIADB) { - expires_at_clause = msprintf("> FROM_UNIXTIME(%u)", (now)); + expires_at_clause = msprintf("> FROM_UNIXTIME(%ld)", (now)); } else if (config->glewlwyd_config->glewlwyd_config->conn->type==HOEL_DB_TYPE_PGSQL) { - expires_at_clause = msprintf("> TO_TIMESTAMP(%u)", now); + expires_at_clause = msprintf("> TO_TIMESTAMP(%ld)", now); } else { // HOEL_DB_TYPE_SQLITE - expires_at_clause = msprintf("> %u", (now)); + expires_at_clause = msprintf("> %ld", (now)); } j_query = json_pack("{sss[s]s{sssss{ssss}si}}", "table", @@ -733,11 +733,11 @@ static json_t * register_new_user(struct _register_config * config, const char * if ((session_hash = config->glewlwyd_config->glewlwyd_callback_generate_hash(config->glewlwyd_config, session)) != NULL) { time(&now); if (config->glewlwyd_config->glewlwyd_config->conn->type==HOEL_DB_TYPE_MARIADB) { - expires_at_clause = msprintf("FROM_UNIXTIME(%u)", (now + (time_t)json_integer_value(json_object_get(config->j_parameters, "session-duration")))); + expires_at_clause = msprintf("FROM_UNIXTIME(%ld)", (now + (time_t)json_integer_value(json_object_get(config->j_parameters, "session-duration")))); } else if (config->glewlwyd_config->glewlwyd_config->conn->type==HOEL_DB_TYPE_PGSQL) { - expires_at_clause = msprintf("TO_TIMESTAMP(%u)", (now + (time_t)json_integer_value(json_object_get(config->j_parameters, "session-duration")))); + expires_at_clause = msprintf("TO_TIMESTAMP(%ld)", (now + (time_t)json_integer_value(json_object_get(config->j_parameters, "session-duration")))); } else { // HOEL_DB_TYPE_SQLITE - expires_at_clause = msprintf("%u", (now + (time_t)json_integer_value(json_object_get(config->j_parameters, "session-duration")))); + expires_at_clause = msprintf("%ld", (now + (time_t)json_integer_value(json_object_get(config->j_parameters, "session-duration")))); } j_query = json_pack("{sss{sssssss{ss}ssss}}", "table", @@ -815,11 +815,11 @@ static int register_user_set(struct _register_config * config, const char * user time(&now); if (config->glewlwyd_config->glewlwyd_config->conn->type==HOEL_DB_TYPE_MARIADB) { - expires_at_clause = msprintf("> FROM_UNIXTIME(%u)", (now)); + expires_at_clause = msprintf("> FROM_UNIXTIME(%ld)", (now)); } else if (config->glewlwyd_config->glewlwyd_config->conn->type==HOEL_DB_TYPE_PGSQL) { - expires_at_clause = msprintf("> TO_TIMESTAMP(%u)", now); + expires_at_clause = msprintf("> TO_TIMESTAMP(%ld)", now); } else { // HOEL_DB_TYPE_SQLITE - expires_at_clause = msprintf("> %u", (now)); + expires_at_clause = msprintf("> %ld", (now)); } j_query = json_pack("{sss{sO}s{sssss{ssss}si}}", "table", @@ -860,11 +860,11 @@ static int register_user_password_set(struct _register_config * config, const ch time(&now); if (config->glewlwyd_config->glewlwyd_config->conn->type==HOEL_DB_TYPE_MARIADB) { - expires_at_clause = msprintf("> FROM_UNIXTIME(%u)", (now)); + expires_at_clause = msprintf("> FROM_UNIXTIME(%ld)", (now)); } else if (config->glewlwyd_config->glewlwyd_config->conn->type==HOEL_DB_TYPE_PGSQL) { - expires_at_clause = msprintf("> TO_TIMESTAMP(%u)", now); + expires_at_clause = msprintf("> TO_TIMESTAMP(%ld)", now); } else { // HOEL_DB_TYPE_SQLITE - expires_at_clause = msprintf("> %u", (now)); + expires_at_clause = msprintf("> %ld", (now)); } j_query = json_pack("{sss{si}s{sssss{ssss}si}}", "table", @@ -905,11 +905,11 @@ static int register_user_complete(struct _register_config * config, const char * time(&now); if (config->glewlwyd_config->glewlwyd_config->conn->type==HOEL_DB_TYPE_MARIADB) { - expires_at_clause = msprintf("> FROM_UNIXTIME(%u)", (now)); + expires_at_clause = msprintf("> FROM_UNIXTIME(%ld)", (now)); } else if (config->glewlwyd_config->glewlwyd_config->conn->type==HOEL_DB_TYPE_PGSQL) { - expires_at_clause = msprintf("> TO_TIMESTAMP(%u)", now); + expires_at_clause = msprintf("> TO_TIMESTAMP(%ld)", now); } else { // HOEL_DB_TYPE_SQLITE - expires_at_clause = msprintf("> %u", (now)); + expires_at_clause = msprintf("> %ld", (now)); } j_query = json_pack("{sss{si}s{sssss{ssss}si}}", "table", @@ -981,11 +981,11 @@ static int register_update_email_trigger(struct _register_config * config, const // Disable existing sessions for the specified e-mail address time(&now); if (config->glewlwyd_config->glewlwyd_config->conn->type==HOEL_DB_TYPE_MARIADB) { - expires_at_clause = msprintf("> FROM_UNIXTIME(%u)", (now)); + expires_at_clause = msprintf("> FROM_UNIXTIME(%ld)", (now)); } else if (config->glewlwyd_config->glewlwyd_config->conn->type==HOEL_DB_TYPE_PGSQL) { - expires_at_clause = msprintf("> TO_TIMESTAMP(%u)", now); + expires_at_clause = msprintf("> TO_TIMESTAMP(%ld)", now); } else { // HOEL_DB_TYPE_SQLITE - expires_at_clause = msprintf("> %u", (now)); + expires_at_clause = msprintf("> %ld", (now)); } j_query = json_pack("{sss{si}s{sssssis{ssss}}}", "table", @@ -1027,11 +1027,11 @@ static int register_update_email_trigger(struct _register_config * config, const body) == U_OK) { y_log_message(Y_LOG_LEVEL_WARNING, "Security - Update e-mail - token sent to email %s at IP Address %s", email, ip_source); if (config->glewlwyd_config->glewlwyd_config->conn->type==HOEL_DB_TYPE_MARIADB) { - expires_at_clause = msprintf("FROM_UNIXTIME(%u)", (now + (time_t)json_integer_value(json_object_get(config->j_parameters, "update-email-token-duration")))); + expires_at_clause = msprintf("FROM_UNIXTIME(%ld)", (now + (time_t)json_integer_value(json_object_get(config->j_parameters, "update-email-token-duration")))); } else if (config->glewlwyd_config->glewlwyd_config->conn->type==HOEL_DB_TYPE_PGSQL) { - expires_at_clause = msprintf("TO_TIMESTAMP(%u)", (now + (time_t)json_integer_value(json_object_get(config->j_parameters, "update-email-token-duration")))); + expires_at_clause = msprintf("TO_TIMESTAMP(%ld)", (now + (time_t)json_integer_value(json_object_get(config->j_parameters, "update-email-token-duration")))); } else { // HOEL_DB_TYPE_SQLITE - expires_at_clause = msprintf("%u", (now + (time_t)json_integer_value(json_object_get(config->j_parameters, "update-email-token-duration")))); + expires_at_clause = msprintf("%ld", (now + (time_t)json_integer_value(json_object_get(config->j_parameters, "update-email-token-duration")))); } j_query = json_pack("{sss{sssssssss{ss}ssss}}", "table", @@ -1108,11 +1108,11 @@ static int register_update_email_verify(struct _register_config * config, const if ((token_hash = config->glewlwyd_config->glewlwyd_callback_generate_hash(config->glewlwyd_config, token)) != NULL) { time(&now); if (config->glewlwyd_config->glewlwyd_config->conn->type==HOEL_DB_TYPE_MARIADB) { - expires_at_clause = msprintf("> FROM_UNIXTIME(%u)", (now)); + expires_at_clause = msprintf("> FROM_UNIXTIME(%ld)", (now)); } else if (config->glewlwyd_config->glewlwyd_config->conn->type==HOEL_DB_TYPE_PGSQL) { - expires_at_clause = msprintf("> TO_TIMESTAMP(%u)", now); + expires_at_clause = msprintf("> TO_TIMESTAMP(%ld)", now); } else { // HOEL_DB_TYPE_SQLITE - expires_at_clause = msprintf("> %u", (now)); + expires_at_clause = msprintf("> %ld", (now)); } j_query = json_pack("{sss[sss]s{sssss{ssss}si}}", "table", @@ -1203,11 +1203,11 @@ static json_t * reset_credentials_check_session(struct _register_config * config if (session_hash != NULL) { time(&now); if (config->glewlwyd_config->glewlwyd_config->conn->type==HOEL_DB_TYPE_MARIADB) { - expires_at_clause = msprintf("> FROM_UNIXTIME(%u)", (now)); + expires_at_clause = msprintf("> FROM_UNIXTIME(%ld)", (now)); } else if (config->glewlwyd_config->glewlwyd_config->conn->type==HOEL_DB_TYPE_PGSQL) { - expires_at_clause = msprintf("> TO_TIMESTAMP(%u)", now); + expires_at_clause = msprintf("> TO_TIMESTAMP(%ld)", now); } else { // HOEL_DB_TYPE_SQLITE - expires_at_clause = msprintf("> %u", (now)); + expires_at_clause = msprintf("> %ld", (now)); } j_query = json_pack("{sss[ss]s{sssss{ssss}si}}", "table", @@ -1308,11 +1308,11 @@ static int register_reset_credentials_trigger(struct _register_config * config, // Disable existing sessions for the specified e-mail address time(&now); if (config->glewlwyd_config->glewlwyd_config->conn->type==HOEL_DB_TYPE_MARIADB) { - expires_at_clause = msprintf("> FROM_UNIXTIME(%u)", (now)); + expires_at_clause = msprintf("> FROM_UNIXTIME(%ld)", (now)); } else if (config->glewlwyd_config->glewlwyd_config->conn->type==HOEL_DB_TYPE_PGSQL) { - expires_at_clause = msprintf("> TO_TIMESTAMP(%u)", now); + expires_at_clause = msprintf("> TO_TIMESTAMP(%ld)", now); } else { // HOEL_DB_TYPE_SQLITE - expires_at_clause = msprintf("> %u", (now)); + expires_at_clause = msprintf("> %ld", (now)); } j_query = json_pack("{sss{si}s{sssssis{ssss}}}", "table", @@ -1354,11 +1354,11 @@ static int register_reset_credentials_trigger(struct _register_config * config, body) == U_OK) { y_log_message(Y_LOG_LEVEL_WARNING, "Security - Reset credentials - token sent to email %s at IP Address %s", email, ip_source); if (config->glewlwyd_config->glewlwyd_config->conn->type==HOEL_DB_TYPE_MARIADB) { - expires_at_clause = msprintf("FROM_UNIXTIME(%u)", (now + (time_t)json_integer_value(json_object_get(config->j_parameters, "reset-credentials-token-duration")))); + expires_at_clause = msprintf("FROM_UNIXTIME(%ld)", (now + (time_t)json_integer_value(json_object_get(config->j_parameters, "reset-credentials-token-duration")))); } else if (config->glewlwyd_config->glewlwyd_config->conn->type==HOEL_DB_TYPE_PGSQL) { - expires_at_clause = msprintf("TO_TIMESTAMP(%u)", (now + (time_t)json_integer_value(json_object_get(config->j_parameters, "reset-credentials-token-duration")))); + expires_at_clause = msprintf("TO_TIMESTAMP(%ld)", (now + (time_t)json_integer_value(json_object_get(config->j_parameters, "reset-credentials-token-duration")))); } else { // HOEL_DB_TYPE_SQLITE - expires_at_clause = msprintf("%u", (now + (time_t)json_integer_value(json_object_get(config->j_parameters, "reset-credentials-token-duration")))); + expires_at_clause = msprintf("%ld", (now + (time_t)json_integer_value(json_object_get(config->j_parameters, "reset-credentials-token-duration")))); } j_query = json_pack("{sss{ssssssss?s{ss}ssss}}", "table", @@ -1435,11 +1435,11 @@ static json_t * register_reset_credentials_check_token(struct _register_config * if ((token_hash = config->glewlwyd_config->glewlwyd_callback_generate_hash(config->glewlwyd_config, token)) != NULL) { time(&now); if (config->glewlwyd_config->glewlwyd_config->conn->type==HOEL_DB_TYPE_MARIADB) { - expires_at_clause = msprintf("> FROM_UNIXTIME(%u)", (now)); + expires_at_clause = msprintf("> FROM_UNIXTIME(%ld)", (now)); } else if (config->glewlwyd_config->glewlwyd_config->conn->type==HOEL_DB_TYPE_PGSQL) { - expires_at_clause = msprintf("> TO_TIMESTAMP(%u)", now); + expires_at_clause = msprintf("> TO_TIMESTAMP(%ld)", now); } else { // HOEL_DB_TYPE_SQLITE - expires_at_clause = msprintf("> %u", (now)); + expires_at_clause = msprintf("> %ld", (now)); } j_query = json_pack("{sss[sss]s{sssss{ssss}si}}", "table", @@ -1513,11 +1513,11 @@ static json_t * reset_credentials_create_session(struct _register_config * confi if ((token_hash = config->glewlwyd_config->glewlwyd_callback_generate_hash(config->glewlwyd_config, token)) != NULL) { time(&now); if (config->glewlwyd_config->glewlwyd_config->conn->type==HOEL_DB_TYPE_MARIADB) { - expires_at_clause = msprintf("FROM_UNIXTIME(%u)", (now + (time_t)json_integer_value(json_object_get(config->j_parameters, "reset-credentials-session-duration")))); + expires_at_clause = msprintf("FROM_UNIXTIME(%ld)", (now + (time_t)json_integer_value(json_object_get(config->j_parameters, "reset-credentials-session-duration")))); } else if (config->glewlwyd_config->glewlwyd_config->conn->type==HOEL_DB_TYPE_PGSQL) { - expires_at_clause = msprintf("TO_TIMESTAMP(%u)", (now + (time_t)json_integer_value(json_object_get(config->j_parameters, "reset-credentials-session-duration")))); + expires_at_clause = msprintf("TO_TIMESTAMP(%ld)", (now + (time_t)json_integer_value(json_object_get(config->j_parameters, "reset-credentials-session-duration")))); } else { // HOEL_DB_TYPE_SQLITE - expires_at_clause = msprintf("%u", (now + (time_t)json_integer_value(json_object_get(config->j_parameters, "reset-credentials-session-duration")))); + expires_at_clause = msprintf("%ld", (now + (time_t)json_integer_value(json_object_get(config->j_parameters, "reset-credentials-session-duration")))); } j_query = json_pack("{sss{ssssssss?s{ss}ssss}}", "table", diff --git a/src/scheme/certificate.c b/src/scheme/certificate.c index 5f9157a28..7c9ee0329 100644 --- a/src/scheme/certificate.c +++ b/src/scheme/certificate.c @@ -257,11 +257,11 @@ static int update_user_certificate_last_used_scheme_storage(struct config_module char * last_used_clause; if (config->conn->type==HOEL_DB_TYPE_MARIADB) { - last_used_clause = msprintf("FROM_UNIXTIME(%u)", time(NULL)); + last_used_clause = msprintf("FROM_UNIXTIME(%ld)", time(NULL)); } else if (config->conn->type==HOEL_DB_TYPE_PGSQL) { - last_used_clause = msprintf("TO_TIMESTAMP(%u)", time(NULL)); + last_used_clause = msprintf("TO_TIMESTAMP(%ld)", time(NULL)); } else { // HOEL_DB_TYPE_SQLITE - last_used_clause = msprintf("%u", time(NULL)); + last_used_clause = msprintf("%ld", time(NULL)); } j_query = json_pack("{sss{s{ss}ss}s{sOssss}}", "table", diff --git a/src/scheme/email.c b/src/scheme/email.c index b78d052ab..7b71cc015 100644 --- a/src/scheme/email.c +++ b/src/scheme/email.c @@ -108,11 +108,11 @@ static int check_code(struct config_module * config, json_t * j_param, const cha if ((code_hash = generate_hash(config->hash_algorithm, code)) != NULL) { time(&now); if (config->conn->type==HOEL_DB_TYPE_MARIADB) { - issued_at_clause = msprintf("> FROM_UNIXTIME(%u)", (now - (time_t)json_integer_value(json_object_get(j_param, "code-duration")))); + issued_at_clause = msprintf("> FROM_UNIXTIME(%ld)", (now - (time_t)json_integer_value(json_object_get(j_param, "code-duration")))); } else if (config->conn->type==HOEL_DB_TYPE_PGSQL) { - issued_at_clause = msprintf("> TO_TIMESTAMP(%u)", (now - (time_t)json_integer_value(json_object_get(j_param, "code-duration")))); + issued_at_clause = msprintf("> TO_TIMESTAMP(%ld)", (now - (time_t)json_integer_value(json_object_get(j_param, "code-duration")))); } else { // HOEL_DB_TYPE_SQLITE - issued_at_clause = msprintf("> %u", (now - (time_t)json_integer_value(json_object_get(j_param, "code-duration")))); + issued_at_clause = msprintf("> %ld", (now - (time_t)json_integer_value(json_object_get(j_param, "code-duration")))); } j_query = json_pack("{sss{sOsssssis{ssss}}}", "table", diff --git a/src/scheme/http.c b/src/scheme/http.c index 7f357881d..79764a381 100644 --- a/src/scheme/http.c +++ b/src/scheme/http.c @@ -73,7 +73,7 @@ static char * format_auth_basic_user(const char * format, json_t * j_user) { while (o_strchr(format_offset, '{') != NULL && o_strchr(format_offset, '}') != NULL && ret == G_OK) { // Append until '{' if (o_strchr(format_offset, '{') != format_offset) { - result = mstrcatf(result, "%.*s", (o_strchr(format_offset, '{') - format_offset), format_offset); + result = mstrcatf(result, "%.*s", (int)(o_strchr(format_offset, '{') - format_offset), format_offset); } // extract string between '{' and '}' sub = o_strndup(o_strchr(format_offset, '{')+1, (size_t)(o_strchr(format_offset, '}')-o_strchr(format_offset, '{')-1)); @@ -434,7 +434,7 @@ int user_auth_scheme_module_validate(struct config_module * config, const struct ret = G_OK; } else { if (response.status != 401 && response.status != 403) { - y_log_message(Y_LOG_LEVEL_WARNING, "user_auth_scheme_module_validate http - Error connecting to webservice %s, response status is %d", request.http_url, response.status); + y_log_message(Y_LOG_LEVEL_WARNING, "user_auth_scheme_module_validate http - Error connecting to webservice %s, response status is %ld", request.http_url, response.status); } ret = G_ERROR_UNAUTHORIZED; } diff --git a/src/scheme/oauth2.c b/src/scheme/oauth2.c index 7bf12cbf7..0bde76041 100644 --- a/src/scheme/oauth2.c +++ b/src/scheme/oauth2.c @@ -214,11 +214,11 @@ static json_t * complete_session_identify(struct config_module * config, struct time(&now); if (config->conn->type==HOEL_DB_TYPE_MARIADB) { - expires_at_clause = msprintf("> FROM_UNIXTIME(%u)", (now)); + expires_at_clause = msprintf("> FROM_UNIXTIME(%ld)", (now)); } else if (config->conn->type==HOEL_DB_TYPE_PGSQL) { - expires_at_clause = msprintf("> TO_TIMESTAMP(%u)", now); + expires_at_clause = msprintf("> TO_TIMESTAMP(%ld)", now); } else { // HOEL_DB_TYPE_SQLITE - expires_at_clause = msprintf("> %u", (now)); + expires_at_clause = msprintf("> %ld", (now)); } j_query = json_pack("{sss[ss]s{sss{ssss}sisO}}", "table", @@ -459,11 +459,11 @@ static json_t * add_session_identify(struct config_module * config, struct _oaut if (i_build_auth_url_get(&i_session) == I_OK) { time(&now); if (config->conn->type==HOEL_DB_TYPE_MARIADB) { - expires_at_clause = msprintf("FROM_UNIXTIME(%u)", (now + (time_t)json_integer_value(json_object_get(oauth2_config->j_parameters, "session_expiration")))); + expires_at_clause = msprintf("FROM_UNIXTIME(%ld)", (now + (time_t)json_integer_value(json_object_get(oauth2_config->j_parameters, "session_expiration")))); } else if (config->conn->type==HOEL_DB_TYPE_PGSQL) { - expires_at_clause = msprintf("TO_TIMESTAMP(%u)", (now + (time_t)json_integer_value(json_object_get(oauth2_config->j_parameters, "session_expiration")))); + expires_at_clause = msprintf("TO_TIMESTAMP(%ld)", (now + (time_t)json_integer_value(json_object_get(oauth2_config->j_parameters, "session_expiration")))); } else { // HOEL_DB_TYPE_SQLITE - expires_at_clause = msprintf("%u", (now + (time_t)json_integer_value(json_object_get(oauth2_config->j_parameters, "session_expiration")))); + expires_at_clause = msprintf("%ld", (now + (time_t)json_integer_value(json_object_get(oauth2_config->j_parameters, "session_expiration")))); } i_export = i_export_session_str(&i_session); j_query = json_pack("{sss{sOs{ss}sssssi}}", @@ -534,11 +534,11 @@ static json_t * add_session_for_user(struct config_module * config, struct _oaut time(&now); if (config->conn->type==HOEL_DB_TYPE_MARIADB) { - expires_at_clause = msprintf("> FROM_UNIXTIME(%u)", (now)); + expires_at_clause = msprintf("> FROM_UNIXTIME(%ld)", (now)); } else if (config->conn->type==HOEL_DB_TYPE_PGSQL) { - expires_at_clause = msprintf("> TO_TIMESTAMP(%u)", now); + expires_at_clause = msprintf("> TO_TIMESTAMP(%ld)", now); } else { // HOEL_DB_TYPE_SQLITE - expires_at_clause = msprintf("> %u", (now)); + expires_at_clause = msprintf("> %ld", (now)); } j_query = json_pack("{sss{si}s{sOsis{ssss}}}", "table", @@ -572,11 +572,11 @@ static json_t * add_session_for_user(struct config_module * config, struct _oaut if (i_build_auth_url_get(&i_session) == I_OK) { time(&now); if (config->conn->type==HOEL_DB_TYPE_MARIADB) { - expires_at_clause = msprintf("FROM_UNIXTIME(%u)", (now + (time_t)json_integer_value(json_object_get(oauth2_config->j_parameters, "session_expiration")))); + expires_at_clause = msprintf("FROM_UNIXTIME(%ld)", (now + (time_t)json_integer_value(json_object_get(oauth2_config->j_parameters, "session_expiration")))); } else if (config->conn->type==HOEL_DB_TYPE_PGSQL) { - expires_at_clause = msprintf("TO_TIMESTAMP(%u)", (now + (time_t)json_integer_value(json_object_get(oauth2_config->j_parameters, "session_expiration")))); + expires_at_clause = msprintf("TO_TIMESTAMP(%ld)", (now + (time_t)json_integer_value(json_object_get(oauth2_config->j_parameters, "session_expiration")))); } else { // HOEL_DB_TYPE_SQLITE - expires_at_clause = msprintf("%u", (now + (time_t)json_integer_value(json_object_get(oauth2_config->j_parameters, "session_expiration")))); + expires_at_clause = msprintf("%ld", (now + (time_t)json_integer_value(json_object_get(oauth2_config->j_parameters, "session_expiration")))); } i_export = i_export_session_str(&i_session); j_query = json_pack("{sss{sOs{ss}sssssi}}", @@ -766,11 +766,11 @@ static json_t * add_registration_for_user(struct config_module * config, struct if (res == H_OK) { time(&now); if (config->conn->type==HOEL_DB_TYPE_MARIADB) { - expires_at_clause = msprintf("FROM_UNIXTIME(%u)", (now + (time_t)json_integer_value(json_object_get(oauth2_config->j_parameters, "session_expiration")))); + expires_at_clause = msprintf("FROM_UNIXTIME(%ld)", (now + (time_t)json_integer_value(json_object_get(oauth2_config->j_parameters, "session_expiration")))); } else if (config->conn->type==HOEL_DB_TYPE_PGSQL) { - expires_at_clause = msprintf("TO_TIMESTAMP(%u)", (now + (time_t)json_integer_value(json_object_get(oauth2_config->j_parameters, "session_expiration")))); + expires_at_clause = msprintf("TO_TIMESTAMP(%ld)", (now + (time_t)json_integer_value(json_object_get(oauth2_config->j_parameters, "session_expiration")))); } else { // HOEL_DB_TYPE_SQLITE - expires_at_clause = msprintf("%u", (now + (time_t)json_integer_value(json_object_get(oauth2_config->j_parameters, "session_expiration")))); + expires_at_clause = msprintf("%ld", (now + (time_t)json_integer_value(json_object_get(oauth2_config->j_parameters, "session_expiration")))); } j_last_id = h_last_insert_id(config->conn); i_export = i_export_session_str(&i_session); @@ -878,11 +878,11 @@ static int complete_session_for_user(struct config_module * config, const char * time(&now); if (config->conn->type==HOEL_DB_TYPE_MARIADB) { - expires_at_clause = msprintf("> FROM_UNIXTIME(%u)", (now)); + expires_at_clause = msprintf("> FROM_UNIXTIME(%ld)", (now)); } else if (config->conn->type==HOEL_DB_TYPE_PGSQL) { - expires_at_clause = msprintf("> TO_TIMESTAMP(%u)", now); + expires_at_clause = msprintf("> TO_TIMESTAMP(%ld)", now); } else { // HOEL_DB_TYPE_SQLITE - expires_at_clause = msprintf("> %u", (now)); + expires_at_clause = msprintf("> %ld", (now)); } j_query = json_pack("{sss[ss]s{sss{ssss}sisO}}", "table", diff --git a/src/scheme/otp.c b/src/scheme/otp.c index ef3d6f389..3748ee837 100644 --- a/src/scheme/otp.c +++ b/src/scheme/otp.c @@ -49,11 +49,11 @@ static int is_current_otp_available(struct config_module * config, json_t * j_pa username_escaped = h_escape_string_with_quotes(config->conn, username); username_clause = msprintf(" = UPPER(%s)", username_escaped); if (config->conn->type==HOEL_DB_TYPE_MARIADB) { - last_used_clause = msprintf("< (FROM_UNIXTIME(%u-gso_totp_time_step_size))", now); + last_used_clause = msprintf("< (FROM_UNIXTIME(%ld-gso_totp_time_step_size))", now); } else if (config->conn->type==HOEL_DB_TYPE_PGSQL) { - last_used_clause = msprintf("< (TO_TIMESTAMP(%u-gso_totp_time_step_size))", now); + last_used_clause = msprintf("< (TO_TIMESTAMP(%ld-gso_totp_time_step_size))", now); } else { // HOEL_DB_TYPE_SQLITE - last_used_clause = msprintf("< (%u-gso_totp_time_step_size)", now); + last_used_clause = msprintf("< (%ld-gso_totp_time_step_size)", now); } j_query = json_pack("{sss[s]s{sOs{ssss}s{ssss}}}", "table", @@ -198,11 +198,11 @@ static int update_otp(struct config_module * config, json_t * j_params, const ch username_escaped = h_escape_string_with_quotes(config->conn, username); username_clause = msprintf(" = UPPER(%s)", username_escaped); if (config->conn->type==HOEL_DB_TYPE_MARIADB) { - last_login_clause = msprintf("FROM_UNIXTIME(%u)", (time(NULL))); + last_login_clause = msprintf("FROM_UNIXTIME(%ld)", (time(NULL))); } else if (config->conn->type==HOEL_DB_TYPE_PGSQL) { - last_login_clause = msprintf("TO_TIMESTAMP(%u)", (time(NULL))); + last_login_clause = msprintf("TO_TIMESTAMP(%ld)", (time(NULL))); } else { // HOEL_DB_TYPE_SQLITE - last_login_clause = msprintf("%u", (time(NULL))); + last_login_clause = msprintf("%ld", (time(NULL))); } j_query = json_pack("{sss{s{ss}}s{s{ssss}sO}}", "table", diff --git a/src/scheme/webauthn.c b/src/scheme/webauthn.c index ed1d56bc8..8ccd1e513 100644 --- a/src/scheme/webauthn.c +++ b/src/scheme/webauthn.c @@ -624,11 +624,11 @@ static json_t * get_credential_from_session(struct config_module * config, json_ mod_name_escaped = h_escape_string_with_quotes(config->conn, json_string_value(json_object_get(j_params, "mod_name"))); username_clause = msprintf(" = (SELECT gswu_id FROM "G_TABLE_WEBAUTHN_USER" WHERE UPPER(gswu_username) = UPPER(%s) AND gswu_mod_name = %s)", username_escaped, mod_name_escaped); if (config->conn->type==HOEL_DB_TYPE_MARIADB) { - expiration_clause = msprintf("> FROM_UNIXTIME(%u)", (now - (time_t)json_integer_value(json_object_get(j_params, "credential-expiration")))); + expiration_clause = msprintf("> FROM_UNIXTIME(%ld)", (now - (time_t)json_integer_value(json_object_get(j_params, "credential-expiration")))); } else if (config->conn->type==HOEL_DB_TYPE_PGSQL) { - expiration_clause = msprintf("> TO_TIMESTAMP(%u)", (now - (time_t)json_integer_value(json_object_get(j_params, "credential-expiration")))); + expiration_clause = msprintf("> TO_TIMESTAMP(%ld)", (now - (time_t)json_integer_value(json_object_get(j_params, "credential-expiration")))); } else { // HOEL_DB_TYPE_SQLITE - expiration_clause = msprintf("> %u", (now - (time_t)json_integer_value(json_object_get(j_params, "credential-expiration")))); + expiration_clause = msprintf("> %ld", (now - (time_t)json_integer_value(json_object_get(j_params, "credential-expiration")))); } j_query = json_pack("{sss[ssssss]s{sss{ssss}sis{ssss}}}", "table", @@ -820,11 +820,11 @@ static json_t * get_assertion_from_session(struct config_module * config, json_t mod_name_escaped = h_escape_string_with_quotes(config->conn, json_string_value(json_object_get(j_params, "mod_name"))); username_clause = msprintf(" = (SELECT gswu_id FROM "G_TABLE_WEBAUTHN_USER" WHERE UPPER(gswu_username) = UPPER(%s) AND gswu_mod_name = %s)", username_escaped, mod_name_escaped); if (config->conn->type==HOEL_DB_TYPE_MARIADB) { - expiration_clause = msprintf("> FROM_UNIXTIME(%u)", (now - (time_t)json_integer_value(json_object_get(j_params, "credential-assertion")))); + expiration_clause = msprintf("> FROM_UNIXTIME(%ld)", (now - (time_t)json_integer_value(json_object_get(j_params, "credential-assertion")))); } else if (config->conn->type==HOEL_DB_TYPE_PGSQL) { - expiration_clause = msprintf("> TO_TIMESTAMP(%u)", (now - (time_t)json_integer_value(json_object_get(j_params, "credential-assertion")))); + expiration_clause = msprintf("> TO_TIMESTAMP(%ld)", (now - (time_t)json_integer_value(json_object_get(j_params, "credential-assertion")))); } else { // HOEL_DB_TYPE_SQLITE - expiration_clause = msprintf("> %u", (now - (time_t)json_integer_value(json_object_get(j_params, "credential-assertion")))); + expiration_clause = msprintf("> %ld", (now - (time_t)json_integer_value(json_object_get(j_params, "credential-assertion")))); } j_query = json_pack("{sss[ssss]s{sss{ssss}sis{ssss}si}}", "table", diff --git a/src/session.c b/src/session.c index 2927edbc2..627be697a 100644 --- a/src/session.c +++ b/src/session.c @@ -391,18 +391,18 @@ int user_session_update(struct config_elements * config, const char * session_ui "gus_current", 1); if (update_login) { if (config->conn->type==HOEL_DB_TYPE_MARIADB) { - expiration_clause = msprintf("FROM_UNIXTIME(%u)", (now + (time_t)config->session_expiration)); + expiration_clause = msprintf("FROM_UNIXTIME(%ld)", (now + (time_t)config->session_expiration)); } else if (config->conn->type==HOEL_DB_TYPE_PGSQL) { - expiration_clause = msprintf("TO_TIMESTAMP(%u)", (now + (time_t)config->session_expiration)); + expiration_clause = msprintf("TO_TIMESTAMP(%ld)", (now + (time_t)config->session_expiration)); } else { // HOEL_DB_TYPE_SQLITE - expiration_clause = msprintf("%u", (now + (time_t)config->session_expiration)); + expiration_clause = msprintf("%ld", (now + (time_t)config->session_expiration)); } if (config->conn->type==HOEL_DB_TYPE_MARIADB) { - last_login_clause = msprintf("FROM_UNIXTIME(%u)", (now)); + last_login_clause = msprintf("FROM_UNIXTIME(%ld)", (now)); } else if (config->conn->type==HOEL_DB_TYPE_PGSQL) { - last_login_clause = msprintf("TO_TIMESTAMP(%u)", (now)); + last_login_clause = msprintf("TO_TIMESTAMP(%ld)", (now)); } else { // HOEL_DB_TYPE_SQLITE - last_login_clause = msprintf("%u", (now)); + last_login_clause = msprintf("%ld", (now)); } json_object_set_new(json_object_get(j_query, "values"), "gus_last_login", json_pack("{ss}", "raw", last_login_clause)); json_object_set_new(json_object_get(j_query, "values"), "gus_expiration", json_pack("{ss}", "raw", expiration_clause)); @@ -464,18 +464,18 @@ int user_session_update(struct config_elements * config, const char * session_ui if (update_login) { // Refresh session for user if (config->conn->type==HOEL_DB_TYPE_MARIADB) { - expiration_clause = msprintf("FROM_UNIXTIME(%u)", (now + (time_t)config->session_expiration)); + expiration_clause = msprintf("FROM_UNIXTIME(%ld)", (now + (time_t)config->session_expiration)); } else if (config->conn->type==HOEL_DB_TYPE_PGSQL) { - expiration_clause = msprintf("TO_TIMESTAMP(%u)", (now + (time_t)config->session_expiration)); + expiration_clause = msprintf("TO_TIMESTAMP(%ld)", (now + (time_t)config->session_expiration)); } else { // HOEL_DB_TYPE_SQLITE - expiration_clause = msprintf("%u", (now + (time_t)config->session_expiration)); + expiration_clause = msprintf("%ld", (now + (time_t)config->session_expiration)); } if (config->conn->type==HOEL_DB_TYPE_MARIADB) { - last_login_clause = msprintf("FROM_UNIXTIME(%u)", (now)); + last_login_clause = msprintf("FROM_UNIXTIME(%ld)", (now)); } else if (config->conn->type==HOEL_DB_TYPE_PGSQL) { - last_login_clause = msprintf("TO_TIMESTAMP(%u)", (now)); + last_login_clause = msprintf("TO_TIMESTAMP(%ld)", (now)); } else { // HOEL_DB_TYPE_SQLITE - last_login_clause = msprintf("%u", (now)); + last_login_clause = msprintf("%ld", (now)); } json_object_set_new(json_object_get(j_query, "set"), "gus_last_login", json_pack("{ss}", "raw", last_login_clause)); json_object_set_new(json_object_get(j_query, "set"), "gus_expiration", json_pack("{ss}", "raw", expiration_clause)); @@ -520,11 +520,11 @@ int user_session_update(struct config_elements * config, const char * session_ui if (res == H_OK) { // Set session scheme for this scheme with the timeout if (config->conn->type==HOEL_DB_TYPE_MARIADB) { - expiration_clause = msprintf("FROM_UNIXTIME(%u)", (now + (time_t)scheme_instance->guasmi_expiration)); + expiration_clause = msprintf("FROM_UNIXTIME(%ld)", (now + (time_t)scheme_instance->guasmi_expiration)); } else if (config->conn->type==HOEL_DB_TYPE_PGSQL) { - expiration_clause = msprintf("TO_TIMESTAMP(%u)", (now + (time_t)scheme_instance->guasmi_expiration)); + expiration_clause = msprintf("TO_TIMESTAMP(%ld)", (now + (time_t)scheme_instance->guasmi_expiration)); } else { // HOEL_DB_TYPE_SQLITE - expiration_clause = msprintf("%u", (now + (time_t)scheme_instance->guasmi_expiration)); + expiration_clause = msprintf("%ld", (now + (time_t)scheme_instance->guasmi_expiration)); } j_query = json_pack("{sss{sOsIs{ss}}}", "table", @@ -539,11 +539,11 @@ int user_session_update(struct config_elements * config, const char * session_ui expiration_clause); if (update_login) { if (config->conn->type==HOEL_DB_TYPE_MARIADB) { - last_login_clause = msprintf("FROM_UNIXTIME(%u)", (now)); + last_login_clause = msprintf("FROM_UNIXTIME(%ld)", (now)); } else if (config->conn->type==HOEL_DB_TYPE_PGSQL) { - last_login_clause = msprintf("TO_TIMESTAMP(%u)", (now)); + last_login_clause = msprintf("TO_TIMESTAMP(%ld)", (now)); } else { // HOEL_DB_TYPE_SQLITE - last_login_clause = msprintf("%u", (now)); + last_login_clause = msprintf("%ld", (now)); } json_object_set_new(json_object_get(j_query, "values"), "guss_last_login", json_pack("{ss}", "raw", last_login_clause)); o_free(last_login_clause); @@ -583,11 +583,11 @@ int user_session_update(struct config_elements * config, const char * session_ui if (res == H_OK) { // Set session scheme password with the timeout if (config->conn->type==HOEL_DB_TYPE_MARIADB) { - expiration_clause = msprintf("FROM_UNIXTIME(%u)", (now + GLEWLWYD_RESET_PASSWORD_DEFAULT_SESSION_EXPIRATION)); + expiration_clause = msprintf("FROM_UNIXTIME(%ld)", (now + GLEWLWYD_RESET_PASSWORD_DEFAULT_SESSION_EXPIRATION)); } else if (config->conn->type==HOEL_DB_TYPE_PGSQL) { - expiration_clause = msprintf("TO_TIMESTAMP(%u)", (now + GLEWLWYD_RESET_PASSWORD_DEFAULT_SESSION_EXPIRATION)); + expiration_clause = msprintf("TO_TIMESTAMP(%ld)", (now + GLEWLWYD_RESET_PASSWORD_DEFAULT_SESSION_EXPIRATION)); } else { // HOEL_DB_TYPE_SQLITE - expiration_clause = msprintf("%u", (now + GLEWLWYD_RESET_PASSWORD_DEFAULT_SESSION_EXPIRATION)); + expiration_clause = msprintf("%ld", (now + GLEWLWYD_RESET_PASSWORD_DEFAULT_SESSION_EXPIRATION)); } j_query = json_pack("{sss{sOsns{ss}}}", "table", @@ -601,11 +601,11 @@ int user_session_update(struct config_elements * config, const char * session_ui expiration_clause); if (update_login) { if (config->conn->type==HOEL_DB_TYPE_MARIADB) { - last_login_clause = msprintf("FROM_UNIXTIME(%u)", (now)); + last_login_clause = msprintf("FROM_UNIXTIME(%ld)", (now)); } else if (config->conn->type==HOEL_DB_TYPE_PGSQL) { - last_login_clause = msprintf("TO_TIMESTAMP(%u)", (now)); + last_login_clause = msprintf("TO_TIMESTAMP(%ld)", (now)); } else { // HOEL_DB_TYPE_SQLITE - last_login_clause = msprintf("%u", (now)); + last_login_clause = msprintf("%ld", (now)); } json_object_set_new(json_object_get(j_query, "values"), "guss_last_login", json_pack("{ss}", "raw", last_login_clause)); o_free(last_login_clause); diff --git a/src/user.c b/src/user.c index ab42e2721..6f754a75a 100644 --- a/src/user.c +++ b/src/user.c @@ -621,14 +621,14 @@ json_t * get_user_profile(struct config_elements * config, const char * username if (user_middleware_module != NULL && user_middleware_module->enabled) { if ((res = is_user_middleware_backend_api_run_enabled(config, user_middleware_module->name)) == G_OK) { if ((result = user_middleware_module->module->user_middleware_module_get_profile(config->config_m, username, json_object_get(j_profile, "user"), user_middleware_module->cls)) != G_OK) { - y_log_message(Y_LOG_LEVEL_ERROR, "get_user_profile - Error user_middleware_module_get_profile at index %d for user %s", i, username); + y_log_message(Y_LOG_LEVEL_ERROR, "get_user_profile - Error user_middleware_module_get_profile at index %zu for user %s", i, username); break; } } else if (res != G_ERROR_NOT_FOUND) { y_log_message(Y_LOG_LEVEL_ERROR, "get_user_profile - Error is_user_middleware_backend_api_run_enabled (1)"); } } else { - y_log_message(Y_LOG_LEVEL_ERROR, "get_user_profile - Error pointer_list_get_at for user_middleware module at index %d", i); + y_log_message(Y_LOG_LEVEL_ERROR, "get_user_profile - Error pointer_list_get_at for user_middleware module at index %zu", i); } } if (result == G_OK) { diff --git a/src/user/http.c b/src/user/http.c index 142f6dbe7..1192e691a 100644 --- a/src/user/http.c +++ b/src/user/http.c @@ -198,7 +198,7 @@ int user_module_check_password(struct config_module * config, const char * usern ret = G_OK; } else { if (response.status != 401 && response.status != 403) { - y_log_message(Y_LOG_LEVEL_WARNING, "user_module_check_password http - Error connecting to webservice %s, response status is %d", request.http_url, response.status); + y_log_message(Y_LOG_LEVEL_WARNING, "user_module_check_password http - Error connecting to webservice %s, response status is %ld", request.http_url, response.status); } ret = G_ERROR_UNAUTHORIZED; }