From 9c924ef56502e8971a4398beeaf595715e7e8ad9 Mon Sep 17 00:00:00 2001 From: chenxiaobin19 <1025221611@qq.com> Date: Wed, 7 Sep 2022 11:45:49 +0800 Subject: [PATCH] fix auth_delay\auto_explain\passwordcheck _PG_init not found bug --- contrib/auth_delay/auth_delay.cpp | 2 +- contrib/auto_explain/auto_explain.cpp | 4 ++-- contrib/passwordcheck/passwordcheck.cpp | 2 +- src/gausskernel/optimizer/commands/user.cpp | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/contrib/auth_delay/auth_delay.cpp b/contrib/auth_delay/auth_delay.cpp index 94bedc1b3..2d0d11114 100644 --- a/contrib/auth_delay/auth_delay.cpp +++ b/contrib/auth_delay/auth_delay.cpp @@ -19,7 +19,7 @@ PG_MODULE_MAGIC; -void _PG_init(void); +extern "C" void _PG_init(void); /* GUC Variables */ static int auth_delay_milliseconds; diff --git a/contrib/auto_explain/auto_explain.cpp b/contrib/auto_explain/auto_explain.cpp index 2eaf18bed..28d6949f7 100644 --- a/contrib/auto_explain/auto_explain.cpp +++ b/contrib/auto_explain/auto_explain.cpp @@ -46,8 +46,8 @@ static ExecutorEnd_hook_type prev_ExecutorEnd = NULL; #define auto_explain_enabled() \ (auto_explain_log_min_duration >= 0 && (nesting_level == 0 || auto_explain_log_nested_statements)) -void _PG_init(void); -void _PG_fini(void); +extern "C" void _PG_init(void); +extern "C" void _PG_fini(void); static void explain_ExecutorStart(QueryDesc* queryDesc, int eflags); static void explain_ExecutorRun(QueryDesc* queryDesc, ScanDirection direction, long count); diff --git a/contrib/passwordcheck/passwordcheck.cpp b/contrib/passwordcheck/passwordcheck.cpp index 717a40a58..8a760cda1 100644 --- a/contrib/passwordcheck/passwordcheck.cpp +++ b/contrib/passwordcheck/passwordcheck.cpp @@ -30,7 +30,7 @@ PG_MODULE_MAGIC; /* passwords shorter than this will be rejected */ #define MIN_PWD_LENGTH 8 -extern void _PG_init(void); +extern "C" void _PG_init(void); /* * check_password diff --git a/src/gausskernel/optimizer/commands/user.cpp b/src/gausskernel/optimizer/commands/user.cpp index cb6e619eb..9c2af46f0 100755 --- a/src/gausskernel/optimizer/commands/user.cpp +++ b/src/gausskernel/optimizer/commands/user.cpp @@ -1233,7 +1233,7 @@ void CreateRole(CreateRoleStmt* stmt) int pwd_type = PASSWORD_TYPE_PLAINTEXT; if (isMD5(password)) { pwd_type = PASSWORD_TYPE_MD5; - } else if (!isSHA256(password)) { + } else if (isSHA256(password)) { pwd_type = PASSWORD_TYPE_SHA256; } @@ -2521,7 +2521,7 @@ void AlterRole(AlterRoleStmt* stmt) int pwd_type = PASSWORD_TYPE_PLAINTEXT; if (isMD5(password)) { pwd_type = PASSWORD_TYPE_MD5; - } else if (!isSHA256(password)) { + } else if (isSHA256(password)) { pwd_type = PASSWORD_TYPE_SHA256; }