Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb72f557

Browse files
committed
Revert "apply 0003-Switch-password_encryption-to-a-enum.patch"
This reverts commit6b8921c.
1 parentea5de7d commitb72f557

File tree

5 files changed

+31
-58
lines changed

5 files changed

+31
-58
lines changed

‎doc/src/sgml/config.sgml

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1163,7 +1163,7 @@ include_dir 'conf.d'
11631163
</varlistentry>
11641164

11651165
<varlistentry id="guc-password-encryption" xreflabel="password_encryption">
1166-
<term><varname>password_encryption</varname> (<type>enum</type>)
1166+
<term><varname>password_encryption</varname> (<type>boolean</type>)
11671167
<indexterm>
11681168
<primary><varname>password_encryption</> configuration parameter</primary>
11691169
</indexterm>
@@ -1175,17 +1175,8 @@ include_dir 'conf.d'
11751175
<xref linkend="sql-alterrole">
11761176
without writing either <literal>ENCRYPTED</> or
11771177
<literal>UNENCRYPTED</>, this parameter determines whether the
1178-
password is to be encrypted.
1179-
</para>
1180-
1181-
<para>
1182-
A value set to <literal>on</> or <literal>md5</> corresponds to a
1183-
MD5-encrypted password, <literal>off</> or <literal>plain</>
1184-
corresponds to an unencrypted password.
1185-
</para>
1186-
1187-
<para>
1188-
The default is <literal>md5</>.
1178+
password is to be encrypted. The default is <literal>on</>
1179+
(encrypt the password).
11891180
</para>
11901181
</listitem>
11911182
</varlistentry>

‎src/backend/commands/user.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ Oidbinary_upgrade_next_pg_authid_oid = InvalidOid;
4444

4545

4646
/* GUC parameter */
47-
intPassword_encryption=PASSWORD_TYPE_MD5;
47+
externboolPassword_encryption;
4848

4949
/* Hook to check passwords in CreateRole() and AlterRole() */
5050
check_password_hook_typecheck_password_hook=NULL;
@@ -80,7 +80,7 @@ CreateRole(CreateRoleStmt *stmt)
8080
ListCell*item;
8181
ListCell*option;
8282
char*password=NULL;/* user password */
83-
intpassword_type=Password_encryption;
83+
boolencrypt_password=Password_encryption;/* encrypt password? */
8484
charencrypted_password[MD5_PASSWD_LEN+1];
8585
boolissuper= false;/* Make the user a superuser? */
8686
boolinherit= true;/* Auto inherit privileges? */
@@ -139,9 +139,9 @@ CreateRole(CreateRoleStmt *stmt)
139139
errmsg("conflicting or redundant options")));
140140
dpassword=defel;
141141
if (strcmp(defel->defname,"encryptedPassword")==0)
142-
password_type=PASSWORD_TYPE_MD5;
142+
encrypt_password=true;
143143
elseif (strcmp(defel->defname,"unencryptedPassword")==0)
144-
password_type=PASSWORD_TYPE_PLAINTEXT;
144+
encrypt_password=false;
145145
}
146146
elseif (strcmp(defel->defname,"sysid")==0)
147147
{
@@ -357,7 +357,7 @@ CreateRole(CreateRoleStmt *stmt)
357357
if (check_password_hook&&password)
358358
(*check_password_hook) (stmt->role,
359359
password,
360-
password_type,
360+
isMD5(password) ?PASSWORD_TYPE_MD5 :PASSWORD_TYPE_PLAINTEXT,
361361
validUntil_datum,
362362
validUntil_null);
363363

@@ -380,7 +380,7 @@ CreateRole(CreateRoleStmt *stmt)
380380

381381
if (password)
382382
{
383-
if (password_type==PASSWORD_TYPE_PLAINTEXT||isMD5(password))
383+
if (!encrypt_password||isMD5(password))
384384
new_record[Anum_pg_authid_rolpassword-1]=
385385
CStringGetTextDatum(password);
386386
else
@@ -492,7 +492,7 @@ AlterRole(AlterRoleStmt *stmt)
492492
ListCell*option;
493493
char*rolename=NULL;
494494
char*password=NULL;/* user password */
495-
intpassword_type=Password_encryption;
495+
boolencrypt_password=Password_encryption;/* encrypt password? */
496496
charencrypted_password[MD5_PASSWD_LEN+1];
497497
intissuper=-1;/* Make the user a superuser? */
498498
intinherit=-1;/* Auto inherit privileges? */
@@ -537,9 +537,9 @@ AlterRole(AlterRoleStmt *stmt)
537537
errmsg("conflicting or redundant options")));
538538
dpassword=defel;
539539
if (strcmp(defel->defname,"encryptedPassword")==0)
540-
password_type=PASSWORD_TYPE_MD5;
540+
encrypt_password=true;
541541
elseif (strcmp(defel->defname,"unencryptedPassword")==0)
542-
password_type=PASSWORD_TYPE_PLAINTEXT;
542+
encrypt_password=false;
543543
}
544544
elseif (strcmp(defel->defname,"superuser")==0)
545545
{
@@ -732,7 +732,7 @@ AlterRole(AlterRoleStmt *stmt)
732732
if (check_password_hook&&password)
733733
(*check_password_hook) (rolename,
734734
password,
735-
password_type,
735+
isMD5(password) ?PASSWORD_TYPE_MD5 :PASSWORD_TYPE_PLAINTEXT,
736736
validUntil_datum,
737737
validUntil_null);
738738

@@ -791,7 +791,7 @@ AlterRole(AlterRoleStmt *stmt)
791791
/* password */
792792
if (password)
793793
{
794-
if (password_type==PASSWORD_TYPE_PLAINTEXT||isMD5(password))
794+
if (!encrypt_password||isMD5(password))
795795
new_record[Anum_pg_authid_rolpassword-1]=
796796
CStringGetTextDatum(password);
797797
else

‎src/backend/utils/misc/guc.c

Lines changed: 13 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
#include"catalog/namespace.h"
3636
#include"commands/async.h"
3737
#include"commands/prepare.h"
38-
#include"commands/user.h"
3938
#include"commands/vacuum.h"
4039
#include"commands/variable.h"
4140
#include"commands/trigger.h"
@@ -396,20 +395,6 @@ static const struct config_enum_entry force_parallel_mode_options[] = {
396395
{NULL,0, false}
397396
};
398397

399-
staticconststructconfig_enum_entrypassword_encryption_options[]= {
400-
{"off",PASSWORD_TYPE_PLAINTEXT, false},
401-
{"on",PASSWORD_TYPE_MD5, false},
402-
{"md5",PASSWORD_TYPE_MD5, false},
403-
{"plain",PASSWORD_TYPE_PLAINTEXT, false},
404-
{"true",PASSWORD_TYPE_MD5, true},
405-
{"false",PASSWORD_TYPE_PLAINTEXT, true},
406-
{"yes",PASSWORD_TYPE_MD5, true},
407-
{"no",PASSWORD_TYPE_PLAINTEXT, true},
408-
{"1",PASSWORD_TYPE_MD5, true},
409-
{"0",PASSWORD_TYPE_PLAINTEXT, true},
410-
{NULL,0, false}
411-
};
412-
413398
/*
414399
* Options for enum values stored in other modules
415400
*/
@@ -440,6 +425,8 @@ boolcheck_function_bodies = true;
440425
booldefault_with_oids= false;
441426
boolSQL_inheritance= true;
442427

428+
boolPassword_encryption= true;
429+
443430
intlog_min_error_statement=ERROR;
444431
intlog_min_messages=WARNING;
445432
intclient_min_messages=NOTICE;
@@ -1338,6 +1325,17 @@ static struct config_bool ConfigureNamesBool[] =
13381325
true,
13391326
NULL,NULL,NULL
13401327
},
1328+
{
1329+
{"password_encryption",PGC_USERSET,CONN_AUTH_SECURITY,
1330+
gettext_noop("Encrypt passwords."),
1331+
gettext_noop("When a password is specified in CREATE USER or "
1332+
"ALTER USER without writing either ENCRYPTED or UNENCRYPTED, "
1333+
"this parameter determines whether the password is to be encrypted.")
1334+
},
1335+
&Password_encryption,
1336+
true,
1337+
NULL,NULL,NULL
1338+
},
13411339
{
13421340
{"transform_null_equals",PGC_USERSET,COMPAT_OPTIONS_CLIENT,
13431341
gettext_noop("Treats \"expr=NULL\" as \"expr IS NULL\"."),
@@ -3901,18 +3899,6 @@ static struct config_enum ConfigureNamesEnum[] =
39013899
NULL,NULL,NULL
39023900
},
39033901

3904-
{
3905-
{"password_encryption",PGC_USERSET,CONN_AUTH_SECURITY,
3906-
gettext_noop("Encrypt passwords."),
3907-
gettext_noop("When a password is specified in CREATE USER or "
3908-
"ALTER USER without writing either ENCRYPTED or UNENCRYPTED, "
3909-
"this parameter determines whether the password is to be encrypted.")
3910-
},
3911-
&Password_encryption,
3912-
PASSWORD_TYPE_MD5,password_encryption_options,
3913-
NULL,NULL,NULL
3914-
},
3915-
39163902
/* End-of-list marker */
39173903
{
39183904
{NULL,0,0,NULL,NULL},NULL,0,NULL,NULL,NULL,NULL

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585
#ssl_key_file = 'server.key'# (change requires restart)
8686
#ssl_ca_file = ''# (change requires restart)
8787
#ssl_crl_file = ''# (change requires restart)
88-
#password_encryption =md5# on, off, md5 or plain
88+
#password_encryption =on
8989
#db_user_namespace = off
9090
#row_security = on
9191

‎src/include/commands/user.h

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,10 @@
1414
#include"catalog/objectaddress.h"
1515
#include"nodes/parsenodes.h"
1616

17-
/* Types of password */
18-
typedefenumPasswordType
19-
{
20-
PASSWORD_TYPE_PLAINTEXT=0,
21-
PASSWORD_TYPE_MD5
22-
}PasswordType;
2317

24-
externintPassword_encryption;
18+
/* Hook to check passwords in CreateRole() and AlterRole() */
19+
#definePASSWORD_TYPE_PLAINTEXT0
20+
#definePASSWORD_TYPE_MD51
2521

2622
typedefvoid (*check_password_hook_type) (constchar*username,constchar*password,intpassword_type,Datumvaliduntil_time,boolvaliduntil_null);
2723

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp