Skip to content

Commit

Permalink
Add extended logging to ldap routines and internals (#520)
Browse files Browse the repository at this point in the history
  • Loading branch information
reshke authored Jul 27, 2023
1 parent b403369 commit 8ad4666
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
6 changes: 5 additions & 1 deletion sources/auth.c
Original file line number Diff line number Diff line change
Expand Up @@ -955,7 +955,7 @@ static inline int od_auth_backend_sasl_continue(od_server_t *server,
}
#endif
od_debug(&instance->logger, "auth", NULL, server,
"continue SASL authentication");
"continue SASL authentication using password %s", password);

/* SASLResponse Message */
machine_msg_t *msg = od_scram_create_client_final_message(
Expand Down Expand Up @@ -1031,6 +1031,10 @@ int od_auth_backend(od_server_t *server, machine_msg_t *msg,
"failed to parse authentication message");
return -1;
}

od_debug(&instance->logger, "auth", NULL, server,
"recieved msg type %u", auth_type);

msg = NULL;

switch (auth_type) {
Expand Down
15 changes: 10 additions & 5 deletions sources/backend.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,11 @@ static inline int od_backend_startup(od_server_t *server,
{ NULL, 0 }
};


od_debug(&instance->logger, "startup", NULL, server,
"startup server connection with user %s & database %s", route->id.user, route->id.database);


for (size_t i = 0; i < route->rule->backend_startup_vars_sz; i++) {
argv[i << 1].name = route->rule->backend_startup_vars[i].name;
argv[i << 1].len =
Expand Down Expand Up @@ -171,13 +176,13 @@ static inline int od_backend_startup(od_server_t *server,
while (1) {
msg = od_read(&server->io, UINT32_MAX);
if (msg == NULL) {
od_error(&instance->logger, "startup", NULL, server,
od_error(&instance->logger, "startup", client, server,
"read error: %s", od_io_error(&server->io));
return -1;
}

kiwi_be_type_t type = *(char *)machine_msg_data(msg);
od_debug(&instance->logger, "startup", NULL, server,
od_debug(&instance->logger, "startup", client, server,
"received packet type: %s",
kiwi_be_type_to_string(type));

Expand All @@ -200,7 +205,7 @@ static inline int od_backend_startup(od_server_t *server,
machine_msg_free(msg);
if (rc == -1) {
od_error(
&instance->logger, "startup", NULL,
&instance->logger, "startup", client,
server,
"failed to parse BackendKeyData message");
return -1;
Expand All @@ -218,7 +223,7 @@ static inline int od_backend_startup(od_server_t *server,
if (rc == -1) {
machine_msg_free(msg);
od_error(
&instance->logger, "startup", NULL,
&instance->logger, "startup", client,
server,
"failed to parse ParameterStatus message");
return -1;
Expand Down Expand Up @@ -260,7 +265,7 @@ static inline int od_backend_startup(od_server_t *server,
return -1;
default:
machine_msg_free(msg);
od_debug(&instance->logger, "startup", NULL, server,
od_debug(&instance->logger, "startup", client, server,
"unexpected message: %s",
kiwi_be_type_to_string(type));
return -1;
Expand Down
3 changes: 3 additions & 0 deletions sources/ldap.c
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,9 @@ od_retcode_t od_ldap_server_prepare(od_logger_t *logger, od_ldap_server_t *serv,
LDAP_SCOPE_SUBTREE, filter, attributes, 0,
&search_message);

od_debug(logger, "auth_ldap", client, NULL,
"basedn search entries with filter: %s and attrib %s ", filter, attributes[0])

if (rc != LDAP_SUCCESS) {
od_error(logger, "auth_ldap", client, NULL,
"basednn search result: %d", rc);
Expand Down

0 comments on commit 8ad4666

Please sign in to comment.