Reformat code

This commit is contained in:
Andrey Borodin 2019-06-26 10:49:51 +05:00
parent 7b6fb2ded7
commit 99b1979ea5
2 changed files with 31 additions and 31 deletions

View File

@ -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;

View File

@ -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] = '%';