Skip to content

Commit

Permalink
[#343] Detect invalid pgagroal_users.conf file
Browse files Browse the repository at this point in the history
  • Loading branch information
jesperpedersen committed Dec 20, 2022
1 parent 07a814b commit 76b4368
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/libpgagroal/configuration.c
Original file line number Diff line number Diff line change
Expand Up @@ -1496,6 +1496,12 @@ pgagroal_read_frontend_users_configuration(void* shm, char* filename)

ptr = strtok(NULL, ":");

if (ptr == NULL)
{
status = PGAGROAL_CONFIGURATION_STATUS_CANNOT_DECRYPT;
goto error;
}

if (pgagroal_base64_decode(ptr, strlen(ptr), &decoded, &decoded_length))
{
status = PGAGROAL_CONFIGURATION_STATUS_CANNOT_DECRYPT;
Expand Down Expand Up @@ -1637,6 +1643,12 @@ pgagroal_read_admins_configuration(void* shm, char* filename)

ptr = strtok(NULL, ":");

if (ptr == NULL)
{
status = PGAGROAL_CONFIGURATION_STATUS_CANNOT_DECRYPT;
goto error;
}

if (pgagroal_base64_decode(ptr, strlen(ptr), &decoded, &decoded_length))
{
status = PGAGROAL_CONFIGURATION_STATUS_CANNOT_DECRYPT;
Expand Down Expand Up @@ -1765,6 +1777,12 @@ pgagroal_read_superuser_configuration(void* shm, char* filename)

ptr = strtok(NULL, ":");

if (ptr == NULL)
{
status = PGAGROAL_CONFIGURATION_STATUS_CANNOT_DECRYPT;
goto error;
}

if (pgagroal_base64_decode(ptr, strlen(ptr), &decoded, &decoded_length))
{
status = PGAGROAL_CONFIGURATION_STATUS_CANNOT_DECRYPT;
Expand Down

0 comments on commit 76b4368

Please sign in to comment.