Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mdb_iamproxy default socket_path rework (+ include bug fix with socket_path) #569

Merged
merged 2 commits into from Feb 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions sources/config_reader.c
Original file line number Diff line number Diff line change
Expand Up @@ -1304,14 +1304,9 @@ static int od_config_reader_rule_settings(od_config_reader_t *reader,
if (!od_config_reader_yes_no(
reader, &rule->enable_mdb_iamproxy_auth))
return NOT_OK_RESPONSE;
if (rule->mdb_iamproxy_socket_path == NULL)
rule->mdb_iamproxy_socket_path =
"/var/run/iam-auth-proxy/iam-auth-proxy.sock";
break;
}
case OD_LAUTH_MDB_IAMPROXY_SOCKET_PATH: {
if (rule->mdb_iamproxy_socket_path != NULL)
free(rule->mdb_iamproxy_socket_path);
if (!od_config_reader_string(
reader, &rule->mdb_iamproxy_socket_path))
return NOT_OK_RESPONSE;
Expand Down
12 changes: 10 additions & 2 deletions sources/mdb_iamproxy.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,16 @@ int mdb_iamproxy_authenticate_user(const char *username, const char *token,
memset(&exchange_socket, 0, sizeof(exchange_socket));
exchange_socket.sun_family = AF_UNIX;
saddr = (struct sockaddr *)&exchange_socket;
od_snprintf(exchange_socket.sun_path, sizeof(exchange_socket.sun_path),
"%s", MDB_IAMPROXY_DEFAULT_SOCKET_FILE);
// if socket path setted use config value, if it's NULL use default
if (client->rule->mdb_iamproxy_socket_path == NULL) {
od_snprintf(exchange_socket.sun_path,
sizeof(exchange_socket.sun_path), "%s",
MDB_IAMPROXY_DEFAULT_SOCKET_FILE);
} else {
od_snprintf(exchange_socket.sun_path,
sizeof(exchange_socket.sun_path), "%s",
client->rule->mdb_iamproxy_socket_path);
}

/*SETUP IO*/
machine_io_t *io;
Expand Down
Loading