Skip to content

Commit

Permalink
[#230] Force master-key to abort if user file exist
Browse files Browse the repository at this point in the history
  • Loading branch information
jesperpedersen committed Mar 26, 2024
1 parent f13ae08 commit ca773ca
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/admin.c
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,12 @@ master_key(char* password, bool generate_pwd, int pwd_length)
memset(&buf, 0, sizeof(buf));
snprintf(&buf[0], sizeof(buf), "%s/.pgmoneta/master.key", pgmoneta_get_home_directory());

if (pgmoneta_exists(&buf[0]))
{
warnx("The file ~/.pgmoneta/master.key already exists");
goto error;
}

if (stat(&buf[0], &st) == -1)
{
/* Ok */
Expand Down

0 comments on commit ca773ca

Please sign in to comment.