Compare commits

..

No commits in common. "master" and "master" have entirely different histories.

7 changed files with 544 additions and 412 deletions

View File

@ -309,7 +309,6 @@ bool pg_md5_encrypt(const char* passwd, const char* salt, size_t salt_len, char*
{
size_t passwd_len = strlen(passwd);
errno_t rc = EOK;
/* the length of salt and password is <= SIZE_MAX */
#ifndef WIN32
if (unlikely(passwd_len >= SIZE_MAX - salt_len)) {
return false;
@ -323,7 +322,6 @@ bool pg_md5_encrypt(const char* passwd, const char* salt, size_t salt_len, char*
char* crypt_buf = (char*)malloc(passwd_len + salt_len + 1);
bool ret = false;
/* the buffer is not exist */
if (crypt_buf == NULL)
return false;

View File

@ -772,15 +772,6 @@ bool pg_sha256_encrypt_for_md5(const char* password, const char* salt, size_t sa
return true;
}
/*
* @Description: calculate the encrypted password for GsSm3.
* @const char* password : the password need be encrypted.
* @const char* salt_s : the content fo the slat.
* @size_t salt_len : the length fo the slat.
* @char* buf : the buffer to store the encrypted key with GsSm3.
* @char* client_key_buf : the buffer to store the key of client.
* @int iteration_count : to record the number of the iteration.
*/
bool GsSm3Encrypt(
const char* password, const char* salt_s, size_t salt_len, char* buf, char* client_key_buf, int iteration_count)
{
@ -808,7 +799,6 @@ bool GsSm3Encrypt(
}
password_len = strlen(password);
/* Tranform string(64Bytes) to binary(32Bytes) */
sha_hex_to_bytes32(salt, (char*)salt_s);
/* calculate k */
pkcs_ret = PKCS5_PBKDF2_HMAC((char*)password,

File diff suppressed because it is too large Load Diff

6
src/gausskernel/optimizer/commands/user.cpp Normal file → Executable file
View File

@ -5911,7 +5911,6 @@ Datum calculate_encrypted_combined_password(const char* password, const char* ro
errno_t rc = EOK;
/* For PG ecological compatibility, we stored both sha256 and md5 password. */
/* the encrypted method of sha256 */
if (!pg_sha256_encrypt(password,
salt_string,
strlen(salt_string),
@ -5922,7 +5921,7 @@ Datum calculate_encrypted_combined_password(const char* password, const char* ro
securec_check(rc, "\0", "\0");
ereport(ERROR, (errcode(ERRCODE_INVALID_PASSWORD), errmsg("first stage encryption password failed")));
}
/* the encrypted method of md5 */
if (!pg_md5_encrypt(password, rolname, strlen(rolname), encrypted_md5_password)) {
rc = memset_s(encrypted_md5_password, MD5_PASSWD_LEN + 1, 0, MD5_PASSWD_LEN + 1);
securec_check(rc, "\0", "\0");
@ -6053,7 +6052,6 @@ static Datum gs_calculate_encrypted_sm3_password(const char* password, const cha
Datum calculate_encrypted_password(bool is_encrypted, const char* password, const char* rolname,
const char* salt_string)
{
/* If the password is '\0' or not exist */
if (password == NULL || password[0] == '\0') {
ereport(ERROR, (errcode(ERRCODE_INVALID_PASSWORD), errmsg("The password could not be NULL.")));
}
@ -6061,7 +6059,6 @@ Datum calculate_encrypted_password(bool is_encrypted, const char* password, cons
char encrypted_md5_password[MD5_PASSWD_LEN + 1] = {0};
Datum datum_value;
/* If the password has encrypted */
if (!is_encrypted || isPWDENCRYPTED(password)) {
return CStringGetTextDatum(password);
}
@ -6071,7 +6068,6 @@ Datum calculate_encrypted_password(bool is_encrypted, const char* password, cons
* if Password_encryption_type is 0, the encrypted password is md5.
* if Password_encryption_type is 1, the encrypted password is sha256 + md5.
* if Password_encryption_type is 2, the encrypted password is sha256.
* if Password_encryption_type is 3, the encrypted password is SM3.
*/
if (u_sess->attr.attr_security.Password_encryption_type == 0) {
if (!pg_md5_encrypt(password, rolname, strlen(rolname), encrypted_md5_password)) {

View File

@ -1901,13 +1901,6 @@ static void set_result_for_plpgsql_language_function_with_outparam(FuncExprState
* @bool has_cursor_return - need store out-args cursor info.
* @bool has_refcursor - need store in-args cursor info.
* @bool isSetReturnFunc - indicate function returns a set.
*The execution process of the ExecMakeFunctionResult function is as follows.
* (1) Check whether funcResultStore exists, if so, get the result and return it
(2) The calculated parameter values are stored in fcinfo.
(3) Pass the parameter into the expression function to calculate the expression,
first determine whether the parameter args exists null, and then determine the return mode of the function that returns the set,
SFRM_ValuePerCall mode is to return a value each time the call, The SFRM_Materialize schema is the result set instantiated in Tuplestore.
(4) Calculate and return results according to different modes.
*/
template <bool has_refcursor, bool has_cursor_return, bool isSetReturnFunc>
static Datum ExecMakeFunctionResult(FuncExprState* fcache, ExprContext* econtext, bool* isNull, ExprDoneCond* isDone)
@ -3089,10 +3082,6 @@ no_function_result:
/* ----------------------------------------------------------------
* ExecEvalFunc
* ----------------------------------------------------------------
*The execution process of the ExecEvalFunc function is as follows.
(1) Initialize the FuncExprState node by init_fcache function, including initialization parameters, memory management, etc.
(2) Judge whether the returned result is of set type according to the data in the FuncExprState function,
and call the corresponding function to calculate the result.
*/
static Datum ExecEvalFunc(FuncExprState* fcache, ExprContext* econtext, bool* isNull, ExprDoneCond* isDone)
{
@ -3537,10 +3526,6 @@ static Datum ExecEvalNot(BoolExprState* notclause, ExprContext* econtext, bool*
/* ----------------------------------------------------------------
* ExecEvalOr
* ----------------------------------------------------------------
*The main execution process of ExecEvalOr function is as follows.
(1) Traverse child expression clauses.
(2) Use the function ExecEvalExpr to call the expression calculation function in clause and calculate the result.
(3) To judge the results, if there is a result in the or expression that meets the conditions, it will jump out of the loop and return directly.
*/
static Datum ExecEvalOr(BoolExprState* orExpr, ExprContext* econtext, bool* isNull, ExprDoneCond* isDone)
{
@ -5179,11 +5164,6 @@ Datum ExecEvalExprSwitchContext(ExprState* expression, ExprContext* econtext, bo
* 'parent' may be NULL if we are preparing an expression that is not
* associated with a plan tree. (If so, it can't have aggs or subplans.)
* This case should usually come through ExecPrepareExpr, not directly here.
*The execution process of the ExecInitExpr function is as follows.
(1) Determine whether the input node is empty. If it is empty,return NULL directly, indicating that there is no restriction for expression.
(2) According to the type of node input,Initialize variable evalfunc which is the execution function corresponding to node,
If the node has parameters or expressions, the function ExecInitExpr will be recursively called and ExprState tree will be generated.
(3) Return ExprState tree, and execute the expression recursively according to ExprState tree.
*/
ExprState* ExecInitExpr(Expr* node, PlanState* parent)
{
@ -6143,10 +6123,6 @@ Datum fetch_lob_value_from_tuple(varatt_lob_pointer* lob_pointer, Oid update_oid
* of *isDone = ExprMultipleResult signifies a set element, and a return
* of *isDone = ExprEndResult signifies end of the set of tuple.
* We assume that *isDone has been initialized to ExprSingleResult by caller.
* The execution process of the ExecTargetList function is as follows.
(1) Iterate over the expressions in targetlist.
(2) Calculation of expression results.
(3) Judge the itemIsDone[resind] parameter in the results and generate the final tuple.
*/
static bool ExecTargetList(List* targetlist, ExprContext* econtext, Datum* values, bool* isnull,
ExprDoneCond* itemIsDone, ExprDoneCond* isDone)

View File

@ -17,7 +17,7 @@
# src/test/ipv6/create_server.py
#
# ---------------------------------------------------------------------------------------
# 增加注释
import getopt, sys, os
import shutil
import time

View File

@ -1 +0,0 @@
sdfadfadsf