From 3c0a2290060a79eda3a0cdca5e170b391c227187 Mon Sep 17 00:00:00 2001 From: Eao3piq4e Date: Fri, 12 Aug 2022 11:56:28 +0800 Subject: [PATCH 1/3] Update libcomm_client_ssl.cpp --- .../communication/libcomm_utils/libcomm_client_ssl.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/gausskernel/cbb/communication/libcomm_utils/libcomm_client_ssl.cpp b/src/gausskernel/cbb/communication/libcomm_utils/libcomm_client_ssl.cpp index 085f3ef12..5f30e9333 100644 --- a/src/gausskernel/cbb/communication/libcomm_utils/libcomm_client_ssl.cpp +++ b/src/gausskernel/cbb/communication/libcomm_utils/libcomm_client_ssl.cpp @@ -236,8 +236,6 @@ char* LibCommErrMessage(void) { return errBuf; } - - int LibCommClientSSLPasswd(SSL* pstContext, const char * path, const char * userName, LibCommConn * conn) { char* CertFilesDir = NULL; char CertFilesPath[MAXPATH] = {0}; @@ -259,10 +257,10 @@ int LibCommClientSSLPasswd(SSL* pstContext, const char * path, const char * user CertFilesDir = CertFilesPath; get_parent_directory(CertFilesDir); - /*check whether the cipher and rand files begins with userName exist. + /*check whether the cipher and rand files beginning with userName exist. if exist, decrypt it. - if not,decrypt the default cipher and rand files begins with client%. - Because,for every client user mayown certification and private key*/ + if not,decrypt the default cipher and rand files begins with client. + Because,for every client user may own certification and private key*/ if (NULL == userName) { retval = LibCommClientCheckPermissionCipherFile(CertFilesDir, conn, NULL); if (retval != 1) From 3446cb0abad46d32bf7de624cada3136f589a35e Mon Sep 17 00:00:00 2001 From: Eao3piq4e Date: Fri, 12 Aug 2022 22:50:12 +0800 Subject: [PATCH 2/3] Update libcomm_client_ssl.cpp --- .../libcomm_utils/libcomm_client_ssl.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/gausskernel/cbb/communication/libcomm_utils/libcomm_client_ssl.cpp b/src/gausskernel/cbb/communication/libcomm_utils/libcomm_client_ssl.cpp index 5f30e9333..97a785959 100644 --- a/src/gausskernel/cbb/communication/libcomm_utils/libcomm_client_ssl.cpp +++ b/src/gausskernel/cbb/communication/libcomm_utils/libcomm_client_ssl.cpp @@ -236,6 +236,21 @@ char* LibCommErrMessage(void) { return errBuf; } + +/* +function name: LibCommClientSSLPasswd +description: As a client, this function is used to detect whether there is a file with a valid key in the specified + directory and whether there is permission to operate it. If so, the password will be decrypted by + using the file. +arguments: The first parameter is a pointer of type (SSL *). + The second parameter is used to obtain the absolute path of the certificate file. + The third parameter represents the user name. + The fourth parameter is a pointer of type (libcommconn *), whose member variable contains the ciphertext to be decrypted. +return value: If the path is empty or does not have operation permission to the directory where the certificate file is located, a non-1 value is returned; otherwise, 0 is returned. +note: none +date: 2022/8/12 +contact tel: 18720816902 +*/ int LibCommClientSSLPasswd(SSL* pstContext, const char * path, const char * userName, LibCommConn * conn) { char* CertFilesDir = NULL; char CertFilesPath[MAXPATH] = {0}; @@ -257,7 +272,7 @@ int LibCommClientSSLPasswd(SSL* pstContext, const char * path, const char * user CertFilesDir = CertFilesPath; get_parent_directory(CertFilesDir); - /*check whether the cipher and rand files beginning with userName exist. + /*check whether the cipher and rand files begins with userName exist. if exist, decrypt it. if not,decrypt the default cipher and rand files begins with client. Because,for every client user may own certification and private key*/ From 19adb218662f7d6b8156aa59467ed49cc4c0d6c7 Mon Sep 17 00:00:00 2001 From: Eao3piq4e Date: Sat, 13 Aug 2022 11:25:18 +0800 Subject: [PATCH 3/3] Update libcomm_lqueue.cpp --- .../libcomm_utils/libcomm_lqueue.cpp | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/src/gausskernel/cbb/communication/libcomm_utils/libcomm_lqueue.cpp b/src/gausskernel/cbb/communication/libcomm_utils/libcomm_lqueue.cpp index 56661b33d..eff8ca97d 100644 --- a/src/gausskernel/cbb/communication/libcomm_utils/libcomm_lqueue.cpp +++ b/src/gausskernel/cbb/communication/libcomm_utils/libcomm_lqueue.cpp @@ -33,6 +33,16 @@ inline int mc_lqueue_item_size(struct mc_lqueue_item* q_item) return q_item->element.data->iov_len; } +/* +function name: mc_lqueue_add +description: Add an element to a specific queue. +arguments: The first parameter is a pointer of type (mc_lqueue *), whose member variable list points to the target queue. + The second parameter points to the element to be added to the queue. +return value: Returns 1 if the element is successfully added to the queue, otherwise returns - 1. +note: none +date: 2022/8/13 +contact tel: 18720816902 +*/ int mc_lqueue_add(struct mc_lqueue* q, struct mc_lqueue_item* q_item) { if (q == NULL || q_item == NULL) { @@ -60,6 +70,17 @@ int mc_lqueue_add(struct mc_lqueue* q, struct mc_lqueue_item* q_item) return 1; } +/* +function name: mc_lqueue_remove +description: Remove the head element in a specific queue. +arguments: The first parameter is a pointer of type (mc_lqueue *), whose member variable list points to the target queue. + The second parameter points to the queue head element used to store the removal from the queue. +return value: Return NULL if an error occurs during the removal of the queue head element, otherwise a pointer to + the successfully removed queue head element is returned. +note: none +date: 2022/8/13 +contact tel: 18720816902 +*/ struct mc_lqueue_item* mc_lqueue_remove(struct mc_lqueue* q, struct mc_lqueue_item* q_item) { if (q == NULL) { @@ -89,6 +110,18 @@ struct mc_lqueue_item* mc_lqueue_remove(struct mc_lqueue* q, struct mc_lqueue_it return q_item; } +/* +function name: mc_lqueue_init +description: This function is used to open an area in the memory area. One part of the area is used to store a queue with + a certain specification, and the other part is used to store the information of the queue, such as the specification + and the number of elements. Finally, a pointer to the area is returned. +arguments: This parameter specifies that the maximum number of elements that the queue can hold is size, but this does + not mean that the size of the queue is so large at the beginning. +return value: If the function runs successfully, it returns a pointer to the opened memory area; otherwise, it returns NULL. +note: none +date: 2022/8/13 +contact tel: 18720816902 +*/ struct mc_lqueue* mc_lqueue_init(unsigned long size) { if (size == 0) {