Skip to content

Commit 884eee5

Browse files
Remove db_user_namespace.
This feature was intended to be a temporary measure to support per-database user names. A better one hasn't materialized in the ~21 years since it was added, and nobody claims to be using it, so let's just remove it. Reviewed-by: Michael Paquier, Magnus Hagander Discussion: https://postgr.es/m/20230630200509.GA2830328%40nathanxps13 Discussion: https://postgr.es/m/20230630215608.GD2941194%40nathanxps13
1 parent 2c2eb0d commit 884eee5

File tree

8 files changed

+0
-105
lines changed

8 files changed

+0
-105
lines changed

doc/src/sgml/client-auth.sgml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1253,11 +1253,6 @@ omicron bryanh guest1
12531253
attacks.
12541254
</para>
12551255

1256-
<para>
1257-
The <literal>md5</literal> method cannot be used with
1258-
the <xref linkend="guc-db-user-namespace"/> feature.
1259-
</para>
1260-
12611256
<para>
12621257
To ease transition from the <literal>md5</literal> method to the newer
12631258
SCRAM method, if <literal>md5</literal> is specified as a method

doc/src/sgml/config.sgml

Lines changed: 0 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1188,58 +1188,6 @@ include_dir 'conf.d'
11881188
</para>
11891189
</listitem>
11901190
</varlistentry>
1191-
1192-
<varlistentry id="guc-db-user-namespace" xreflabel="db_user_namespace">
1193-
<term><varname>db_user_namespace</varname> (<type>boolean</type>)
1194-
<indexterm>
1195-
<primary><varname>db_user_namespace</varname> configuration parameter</primary>
1196-
</indexterm>
1197-
</term>
1198-
<listitem>
1199-
<para>
1200-
This parameter enables per-database user names. It is off by default.
1201-
This parameter can only be set in the <filename>postgresql.conf</filename>
1202-
file or on the server command line.
1203-
</para>
1204-
1205-
<para>
1206-
If this is on, you should create users as <replaceable>username@dbname</replaceable>.
1207-
When <replaceable>username</replaceable> is passed by a connecting client,
1208-
<literal>@</literal> and the database name are appended to the user
1209-
name and that database-specific user name is looked up by the
1210-
server. Note that when you create users with names containing
1211-
<literal>@</literal> within the SQL environment, you will need to
1212-
quote the user name.
1213-
</para>
1214-
1215-
<para>
1216-
With this parameter enabled, you can still create ordinary global
1217-
users. Simply append <literal>@</literal> when specifying the user
1218-
name in the client, e.g., <literal>joe@</literal>. The <literal>@</literal>
1219-
will be stripped off before the user name is looked up by the
1220-
server.
1221-
</para>
1222-
1223-
<para>
1224-
<varname>db_user_namespace</varname> causes the client's and
1225-
server's user name representation to differ.
1226-
Authentication checks are always done with the server's user name
1227-
so authentication methods must be configured for the
1228-
server's user name, not the client's. Because
1229-
<literal>md5</literal> uses the user name as salt on both the
1230-
client and server, <literal>md5</literal> cannot be used with
1231-
<varname>db_user_namespace</varname>.
1232-
</para>
1233-
1234-
<note>
1235-
<para>
1236-
This feature is intended as a temporary measure until a
1237-
complete solution is found. At that time, this option will
1238-
be removed.
1239-
</para>
1240-
</note>
1241-
</listitem>
1242-
</varlistentry>
12431191
</variablelist>
12441192
</sect2>
12451193

src/backend/libpq/auth.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -873,11 +873,6 @@ CheckMD5Auth(Port *port, char *shadow_pass, const char **logdetail)
873873
char *passwd;
874874
int result;
875875

876-
if (Db_user_namespace)
877-
ereport(FATAL,
878-
(errcode(ERRCODE_INVALID_AUTHORIZATION_SPECIFICATION),
879-
errmsg("MD5 authentication is not supported when \"db_user_namespace\" is enabled")));
880-
881876
/* include the salt to use for computing the response */
882877
if (!pg_strong_random(md5Salt, 4))
883878
{

src/backend/libpq/hba.c

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1741,19 +1741,7 @@ parse_hba_line(TokenizedAuthLine *tok_line, int elevel)
17411741
else if (strcmp(token->string, "reject") == 0)
17421742
parsedline->auth_method = uaReject;
17431743
else if (strcmp(token->string, "md5") == 0)
1744-
{
1745-
if (Db_user_namespace)
1746-
{
1747-
ereport(elevel,
1748-
(errcode(ERRCODE_CONFIG_FILE_ERROR),
1749-
errmsg("MD5 authentication is not supported when \"db_user_namespace\" is enabled"),
1750-
errcontext("line %d of configuration file \"%s\"",
1751-
line_num, file_name)));
1752-
*err_msg = "MD5 authentication is not supported when \"db_user_namespace\" is enabled";
1753-
return NULL;
1754-
}
17551744
parsedline->auth_method = uaMD5;
1756-
}
17571745
else if (strcmp(token->string, "scram-sha-256") == 0)
17581746
parsedline->auth_method = uaSCRAM;
17591747
else if (strcmp(token->string, "pam") == 0)

src/backend/postmaster/postmaster.c

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,6 @@ int AuthenticationTimeout = 60;
236236

237237
bool log_hostname; /* for ps display and logging */
238238
bool Log_connections = false;
239-
bool Db_user_namespace = false;
240239

241240
bool enable_bonjour = false;
242241
char *bonjour_name;
@@ -2272,24 +2271,6 @@ ProcessStartupPacket(Port *port, bool ssl_done, bool gss_done)
22722271
if (port->database_name == NULL || port->database_name[0] == '\0')
22732272
port->database_name = pstrdup(port->user_name);
22742273

2275-
if (Db_user_namespace)
2276-
{
2277-
/*
2278-
* If user@, it is a global user, remove '@'. We only want to do this
2279-
* if there is an '@' at the end and no earlier in the user string or
2280-
* they may fake as a local user of another database attaching to this
2281-
* database.
2282-
*/
2283-
if (strchr(port->user_name, '@') ==
2284-
port->user_name + strlen(port->user_name) - 1)
2285-
*strchr(port->user_name, '@') = '\0';
2286-
else
2287-
{
2288-
/* Append '@' and dbname */
2289-
port->user_name = psprintf("%s@%s", port->user_name, port->database_name);
2290-
}
2291-
}
2292-
22932274
if (am_walsender)
22942275
MyBackendType = B_WAL_SENDER;
22952276
else

src/backend/utils/misc/guc_tables.c

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1545,15 +1545,6 @@ struct config_bool ConfigureNamesBool[] =
15451545
false,
15461546
NULL, NULL, NULL
15471547
},
1548-
{
1549-
{"db_user_namespace", PGC_SIGHUP, CONN_AUTH_AUTH,
1550-
gettext_noop("Enables per-database user names."),
1551-
NULL
1552-
},
1553-
&Db_user_namespace,
1554-
false,
1555-
NULL, NULL, NULL
1556-
},
15571548
{
15581549
{"default_transaction_read_only", PGC_USERSET, CLIENT_CONN_STATEMENT,
15591550
gettext_noop("Sets the default read-only status of new transactions."),

src/backend/utils/misc/postgresql.conf.sample

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@
9696
#authentication_timeout = 1min # 1s-600s
9797
#password_encryption = scram-sha-256 # scram-sha-256 or md5
9898
#scram_iterations = 4096
99-
#db_user_namespace = off
10099

101100
# GSSAPI using Kerberos
102101
#krb_server_keyfile = 'FILE:${sysconfdir}/krb5.keytab'

src/include/libpq/pqcomm.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,6 @@ typedef ProtocolVersion MsgType;
103103

104104
typedef uint32 PacketLen;
105105

106-
extern PGDLLIMPORT bool Db_user_namespace;
107-
108106
/*
109107
* In protocol 3.0 and later, the startup packet length is not fixed, but
110108
* we set an arbitrary limit on it anyway. This is just to prevent simple

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy