Commit 7df974ee authored by Stephen Frost's avatar Stephen Frost

Disallow superuser names starting with 'pg_' in initdb

As with CREATE ROLE, disallow users from specifying initial
superuser names which begin with 'pg_' in initdb.

Per discussion with Tom.
parent 9eb7a0ac
...@@ -3562,6 +3562,12 @@ main(int argc, char *argv[]) ...@@ -3562,6 +3562,12 @@ main(int argc, char *argv[])
if (strlen(username) == 0) if (strlen(username) == 0)
username = effective_user; username = effective_user;
if (strncmp(username, "pg_", 3) == 0)
{
fprintf(stderr, _("%s: superuser name \"%s\" is reserved; role names can not begin with 'pg_'\n"), progname, username);
exit(1);
}
printf(_("The files belonging to this database system will be owned " printf(_("The files belonging to this database system will be owned "
"by user \"%s\".\n" "by user \"%s\".\n"
"This user must also own the server process.\n\n"), "This user must also own the server process.\n\n"),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment