Skip to content

Commit dedd3ba

Browse files
committed
Revert "Apply 0006-Add-clause-PASSWORD-val-USING-protocol-to-CREATE-ALT.patch"
This reverts commit ae93312.
1 parent 5ebf482 commit dedd3ba

File tree

4 files changed

+7
-110
lines changed

4 files changed

+7
-110
lines changed

doc/src/sgml/ref/alter_role.sgml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ ALTER ROLE <replaceable class="PARAMETER">role_specification</replaceable> [ WIT
3434
| BYPASSRLS | NOBYPASSRLS
3535
| CONNECTION LIMIT <replaceable class="PARAMETER">connlimit</replaceable>
3636
| [ ENCRYPTED | UNENCRYPTED ] PASSWORD '<replaceable class="PARAMETER">password</replaceable>'
37-
| PASSWORD '<replaceable class="PARAMETER">password</replaceable>' USING '<replaceable class="PARAMETER">protocol</replaceable>'
3837
| VALID UNTIL '<replaceable class="PARAMETER">timestamp</replaceable>'
3938

4039
ALTER ROLE <replaceable class="PARAMETER">name</replaceable> RENAME TO <replaceable>new_name</replaceable>
@@ -170,7 +169,6 @@ ALTER ROLE { <replaceable class="PARAMETER">role_specification</replaceable> | A
170169
<term><literal>NOBYPASSRLS</literal></term>
171170
<term><literal>CONNECTION LIMIT</literal> <replaceable class="parameter">connlimit</replaceable></term>
172171
<term><literal>PASSWORD</> <replaceable class="parameter">password</replaceable></term>
173-
<term><literal>PASSWORD</> <replaceable class="parameter">password</replaceable> USING <replaceable class="parameter">protocol</replaceable></term>
174172
<term><literal>ENCRYPTED</></term>
175173
<term><literal>UNENCRYPTED</></term>
176174
<term><literal>VALID UNTIL</literal> '<replaceable class="parameter">timestamp</replaceable>'</term>

doc/src/sgml/ref/create_role.sgml

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ CREATE ROLE <replaceable class="PARAMETER">name</replaceable> [ [ WITH ] <replac
3434
| BYPASSRLS | NOBYPASSRLS
3535
| CONNECTION LIMIT <replaceable class="PARAMETER">connlimit</replaceable>
3636
| [ ENCRYPTED | UNENCRYPTED ] PASSWORD '<replaceable class="PARAMETER">password</replaceable>'
37-
| PASSWORD '<replaceable class="PARAMETER">password</replaceable>' USING '<replaceable class="PARAMETER">protocol</replaceable>'
3837
| VALID UNTIL '<replaceable class="PARAMETER">timestamp</replaceable>'
3938
| IN ROLE <replaceable class="PARAMETER">role_name</replaceable> [, ...]
4039
| IN GROUP <replaceable class="PARAMETER">role_name</replaceable> [, ...]
@@ -245,23 +244,6 @@ CREATE ROLE <replaceable class="PARAMETER">name</replaceable> [ [ WITH ] <replac
245244
</listitem>
246245
</varlistentry>
247246

248-
<varlistentry>
249-
<term><literal>PASSWORD</> <replaceable class="parameter">password</replaceable> USING <replaceable class="parameter">protocol</replaceable></term>
250-
<listitem>
251-
<para>
252-
Sets the role's password using the requested protocol. (A password
253-
is only of use for roles having the <literal>LOGIN</literal>
254-
attribute, but you can nonetheless define one for roles without it.)
255-
If you do not plan to use password authentication you can omit this
256-
option. The protocols supported are <literal>md5</> to enforce
257-
a password to be MD5-encrypted, and <literal>plain</> to use an
258-
unencrypted password. If the password string is already in
259-
MD5-encrypted format, then it is stored encrypted even if
260-
<literal>plain</> is specified.
261-
</para>
262-
</listitem>
263-
</varlistentry>
264-
265247
<varlistentry>
266248
<term><literal>VALID UNTIL</literal> '<replaceable class="parameter">timestamp</replaceable>'</term>
267249
<listitem>

src/backend/commands/user.c

Lines changed: 7 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -175,58 +175,18 @@ CreateRole(ParseState *pstate, CreateRoleStmt *stmt)
175175

176176
if (strcmp(defel->defname, "password") == 0 ||
177177
strcmp(defel->defname, "encryptedPassword") == 0 ||
178-
strcmp(defel->defname, "unencryptedPassword") == 0 ||
179-
strcmp(defel->defname, "protocolPassword") == 0)
178+
strcmp(defel->defname, "unencryptedPassword") == 0)
180179
{
181180
if (dpassword)
182181
ereport(ERROR,
183182
(errcode(ERRCODE_SYNTAX_ERROR),
184183
errmsg("conflicting or redundant options"),
185184
parser_errposition(pstate, defel->location)));
186185
dpassword = defel;
187-
if (strcmp(defel->defname, "password") == 0)
188-
{
189-
/*
190-
* Password type is enforced with GUC password_encryption
191-
* here.
192-
*/
193-
if (dpassword && dpassword->arg)
194-
password = strVal(dpassword->arg);
195-
}
196-
else if (strcmp(defel->defname, "encryptedPassword") == 0)
197-
{
186+
if (strcmp(defel->defname, "encryptedPassword") == 0)
198187
password_type = PASSWORD_TYPE_MD5;
199-
if (dpassword && dpassword->arg)
200-
password = strVal(dpassword->arg);
201-
}
202188
else if (strcmp(defel->defname, "unencryptedPassword") == 0)
203-
{
204189
password_type = PASSWORD_TYPE_PLAINTEXT;
205-
if (dpassword && dpassword->arg)
206-
password = strVal(dpassword->arg);
207-
}
208-
else if (strcmp(defel->defname, "protocolPassword") == 0)
209-
{
210-
/*
211-
* This is a list of two elements, the password is first and
212-
* then there is the protocol wanted by caller.
213-
*/
214-
if (dpassword && dpassword->arg)
215-
{
216-
char *protocol = strVal(lsecond((List *) dpassword->arg));
217-
218-
password = strVal(linitial((List *) dpassword->arg));
219-
220-
if (strcmp(protocol, "md5") == 0)
221-
password_type = PASSWORD_TYPE_MD5;
222-
else if (strcmp(protocol, "plain") == 0)
223-
password_type = PASSWORD_TYPE_PLAINTEXT;
224-
else
225-
ereport(ERROR,
226-
(errcode(ERRCODE_SYNTAX_ERROR),
227-
errmsg("unsupported password protocol %s", protocol)));
228-
}
229-
}
230190
}
231191
else if (strcmp(defel->defname, "sysid") == 0)
232192
{
@@ -346,6 +306,8 @@ CreateRole(ParseState *pstate, CreateRoleStmt *stmt)
346306
defel->defname);
347307
}
348308

309+
if (dpassword && dpassword->arg)
310+
password = strVal(dpassword->arg);
349311
if (dissuper)
350312
issuper = intVal(dissuper->arg) != 0;
351313
if (dinherit)
@@ -620,57 +582,17 @@ AlterRole(AlterRoleStmt *stmt)
620582

621583
if (strcmp(defel->defname, "password") == 0 ||
622584
strcmp(defel->defname, "encryptedPassword") == 0 ||
623-
strcmp(defel->defname, "protocolPassword") == 0 ||
624585
strcmp(defel->defname, "unencryptedPassword") == 0)
625586
{
626587
if (dpassword)
627588
ereport(ERROR,
628589
(errcode(ERRCODE_SYNTAX_ERROR),
629590
errmsg("conflicting or redundant options")));
630591
dpassword = defel;
631-
if (strcmp(defel->defname, "password") == 0)
632-
{
633-
/*
634-
* Password type is enforced with GUC password_encryption
635-
* here.
636-
*/
637-
if (dpassword && dpassword->arg)
638-
password = strVal(dpassword->arg);
639-
}
640-
else if (strcmp(defel->defname, "encryptedPassword") == 0)
641-
{
592+
if (strcmp(defel->defname, "encryptedPassword") == 0)
642593
password_type = PASSWORD_TYPE_MD5;
643-
if (dpassword && dpassword->arg)
644-
password = strVal(dpassword->arg);
645-
}
646594
else if (strcmp(defel->defname, "unencryptedPassword") == 0)
647-
{
648595
password_type = PASSWORD_TYPE_PLAINTEXT;
649-
if (dpassword && dpassword->arg)
650-
password = strVal(dpassword->arg);
651-
}
652-
else if (strcmp(defel->defname, "protocolPassword") == 0)
653-
{
654-
/*
655-
* This is a list of two elements, the password is first and
656-
* then there is the protocol wanted by caller.
657-
*/
658-
if (dpassword && dpassword->arg)
659-
{
660-
char *protocol = strVal(lsecond((List *) dpassword->arg));
661-
662-
if (strcmp(protocol, "md5") == 0)
663-
password_type = PASSWORD_TYPE_MD5;
664-
else if (strcmp(protocol, "plain") == 0)
665-
password_type = PASSWORD_TYPE_PLAINTEXT;
666-
else
667-
ereport(ERROR,
668-
(errcode(ERRCODE_SYNTAX_ERROR),
669-
errmsg("unsupported password protocol %s", protocol)));
670-
671-
password = strVal(linitial((List *) dpassword->arg));
672-
}
673-
}
674596
}
675597
else if (strcmp(defel->defname, "superuser") == 0)
676598
{
@@ -758,6 +680,8 @@ AlterRole(AlterRoleStmt *stmt)
758680
defel->defname);
759681
}
760682

683+
if (dpassword && dpassword->arg)
684+
password = strVal(dpassword->arg);
761685
if (dissuper)
762686
issuper = intVal(dissuper->arg);
763687
if (dinherit)

src/backend/parser/gram.y

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -936,13 +936,6 @@ AlterOptRoleElem:
936936
{
937937
$$ = makeDefElem("password", NULL, @1);
938938
}
939-
| PASSWORD Sconst USING Sconst
940-
{
941-
$$ = makeDefElem("protocolPassword",
942-
(Node *)list_make2(makeString($2),
943-
makeString($4)),
944-
@1);
945-
}
946939
| ENCRYPTED PASSWORD Sconst
947940
{
948941
$$ = makeDefElem("encryptedPassword",

0 commit comments

Comments
 (0)