diff --git a/sources/auth.c b/sources/auth.c index 952ca147..bfa547f5 100644 --- a/sources/auth.c +++ b/sources/auth.c @@ -78,7 +78,7 @@ od_auth_frontend_cleartext(od_client_t *client) if (client->rule->auth_query) { rc = od_auth_query(client->global, client->rule, - client->io.io, + client->io.io, &client->startup.user, &client_password); if (rc == -1) { @@ -91,17 +91,17 @@ od_auth_frontend_cleartext(od_client_t *client) machine_msg_free(msg); return -1; } - if(client_password.password == NULL){ - char peer[128]; - od_getpeername(client->io.io, peer, sizeof(peer), 1, 0); - od_log(&instance->logger, "auth", client, NULL, - "user '%s.%s' incorrect user from %s", - client->startup.database.value, - client->startup.user.value,peer); - od_frontend_error(client, KIWI_INVALID_PASSWORD, - "incorrect user"); - return -1; - } + if(client_password.password == NULL){ + char peer[128]; + od_getpeername(client->io.io, peer, sizeof(peer), 1, 0); + od_log(&instance->logger, "auth", client, NULL, + "user '%s.%s' incorrect user from %s", + client->startup.database.value, + client->startup.user.value,peer); + od_frontend_error(client, KIWI_INVALID_PASSWORD, + "incorrect user"); + return -1; + } } else { client_password.password_len = client->rule->password_len + 1; client_password.password = client->rule->password; @@ -191,7 +191,7 @@ od_auth_frontend_md5(od_client_t *client) if (client->rule->auth_query) { rc = od_auth_query(client->global, client->rule, - client->io.io, + client->io.io, &client->startup.user, &query_password); if (rc == -1) { @@ -204,17 +204,17 @@ od_auth_frontend_md5(od_client_t *client) machine_msg_free(msg); return -1; } - if(query_password.password == NULL){ - char peer[128]; - od_getpeername(client->io.io, peer, sizeof(peer), 1, 0); - od_log(&instance->logger, "auth", client, NULL, - "user '%s.%s' incorrect user from %s", - client->startup.database.value, - client->startup.user.value,peer); - od_frontend_error(client, KIWI_INVALID_PASSWORD, - "incorrect user"); - return -1; - } + if(query_password.password == NULL){ + char peer[128]; + od_getpeername(client->io.io, peer, sizeof(peer), 1, 0); + od_log(&instance->logger, "auth", client, NULL, + "user '%s.%s' incorrect user from %s", + client->startup.database.value, + client->startup.user.value,peer); + od_frontend_error(client, KIWI_INVALID_PASSWORD, + "incorrect user"); + return -1; + } query_password.password_len--; } else { query_password.password_len = client->rule->password_len; diff --git a/sources/auth_query.c b/sources/auth_query.c index 48ae04bf..f9f8cda1 100644 --- a/sources/auth_query.c +++ b/sources/auth_query.c @@ -158,13 +158,13 @@ od_auth_query_format(od_rule_t *rule, kiwi_var_t *user, len = od_snprintf(dst_pos, dst_end - dst_pos, "%s", user->value); dst_pos += len; - } else if (*format_pos == 'h') { - int len; - char peer[128]; - od_getpeername(io, peer, sizeof(peer), 1, 0); - len = od_snprintf(dst_pos, dst_end - dst_pos, "%s", - peer); - dst_pos += len; } else { + } else if (*format_pos == 'h') { + int len; + char peer[128]; + od_getpeername(io, peer, sizeof(peer), 1, 0); + len = od_snprintf(dst_pos, dst_end - dst_pos, "%s", + peer); + dst_pos += len; } else { if (od_unlikely((dst_end - dst_pos) < 2)) break; dst_pos[0] = '%';