diff --git a/src/client/src/tscSql.c b/src/client/src/tscSql.c index a8f9300cdc7261f5c21156af1f143690146eddd5..f0478d57d89b23a308b5583775cb4177bb00a074 100644 --- a/src/client/src/tscSql.c +++ b/src/client/src/tscSql.c @@ -74,7 +74,7 @@ TAOS *taos_connect_imp(char *ip, char *user, char *pass, char *db, int port, voi pObj->signature = pObj; strncpy(pObj->user, user, TSDB_USER_LEN); - strncpy(pObj->pass, pass, TSDB_KEY_LEN); + taosEncryptPass(pass, strlen(pass), pObj->pass); pObj->mgmtPort = port ? port : tsMgmtShellPort; if (db) { diff --git a/src/inc/tutil.h b/src/inc/tutil.h index e4fa116d812565f82bbb3de37e26a45a1db2eb3c..adeb9606f506307aa6208ec2745c229091589153 100644 --- a/src/inc/tutil.h +++ b/src/inc/tutil.h @@ -16,6 +16,8 @@ #ifndef TDENGINE_TUTIL_H #define TDENGINE_TUTIL_H +#include "tmd5.h" + #ifdef __cplusplus extern "C" { #endif @@ -199,6 +201,14 @@ bool taosUcs4ToMbs(void *ucs4, int32_t ucs4_max_len, char *mbs); bool taosValidateEncodec(char *encodec); +static FORCE_INLINE void taosEncryptPass(uint8_t *inBuf, unsigned int inLen, char *target) { + MD5_CTX context; + MD5Init(&context); + MD5Update(&context, inBuf, inLen); + MD5Final(&context); + memcpy(target, context.digest, TSDB_KEY_LEN); +} + #define __sync_val_compare_and_swap_64 __sync_val_compare_and_swap #define __sync_val_compare_and_swap_32 __sync_val_compare_and_swap #define __sync_add_and_fetch_64 __sync_add_and_fetch diff --git a/src/system/src/mgmtShell.c b/src/system/src/mgmtShell.c index ef09e88249f6c0dc1b5b6749d206755cd1bb3111..9c4e4cac19812a09ef2402835cbeec1a5074fff9 100644 --- a/src/system/src/mgmtShell.c +++ b/src/system/src/mgmtShell.c @@ -440,7 +440,7 @@ int mgmtProcessAlterUserMsg(char *pMsg, int msgLen, SConnObj *pConn) { (strcmp(pConn->pUser->user, "root") == 0)) { if ((pAlter->flag & TSDB_ALTER_USER_PASSWD) != 0) { memset(pUser->pass, 0, sizeof(pUser->pass)); - strcpy(pUser->pass, pAlter->pass); + taosEncryptPass((uint8_t *)(pAlter->pass), strlen(pAlter->pass), pUser->pass); } if ((pAlter->flag & TSDB_ALTER_USER_PRIVILEGES) != 0) { if (pAlter->privilege == 1) { // super diff --git a/src/system/src/mgmtUser.c b/src/system/src/mgmtUser.c index 437177291b6529c75e97cb43bf5a4bc6e1428799..da690fffee6b226ac5f8a296a0bed4d4b9ff0797 100644 --- a/src/system/src/mgmtUser.c +++ b/src/system/src/mgmtUser.c @@ -109,7 +109,7 @@ int mgmtCreateUser(SAcctObj *pAcct, char *name, char *pass) { pUser = malloc(sizeof(SUserObj)); memset(pUser, 0, sizeof(SUserObj)); strcpy(pUser->user, name); - strcpy(pUser->pass, pass); + taosEncryptPass((uint8_t *)pass, strlen(pass), pUser->pass); strcpy(pUser->acct, pAcct->user); pUser->createdTime = taosGetTimestampMs(); pUser->superAuth = 0; diff --git a/src/util/src/version.c b/src/util/src/version.c index aad6dc0322b2a23a14baca40da812b4b82eced14..b7afb1a6bb11345719662f82befd1b4952c45f22 100755 --- a/src/util/src/version.c +++ b/src/util/src/version.c @@ -1,4 +1,4 @@ -char version[64] = "1.6.0.0"; -char compatible_version[64] = "1.6.0.0"; -char gitinfo[128] = "82cbce3261d06ab37c3bd4786c7b2e3d2316c42a"; -char buildinfo[512] = "Built by ubuntu at 2019-07-05 18:42"; +char version[64] = "1.6.1.0"; +char compatible_version[64] = "1.6.1.0"; +char gitinfo[128] = "01eb2fd1402c952689a6874a5b1ec09fca5f4f13"; +char buildinfo[512] = "Built by ubuntu at 2019-07-16 10:18";