From d55dadd07ffefc0df54745cb2ca4efa27ddd9f64 Mon Sep 17 00:00:00 2001 From: hjxilinx Date: Wed, 5 Feb 2020 11:19:14 +0800 Subject: [PATCH] fix create user bug. --- src/client/src/tscSQLParserImpl.c | 5 ----- src/client/src/tscServer.c | 8 +++++--- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/client/src/tscSQLParserImpl.c b/src/client/src/tscSQLParserImpl.c index 9aa1942956..17e1c6f457 100644 --- a/src/client/src/tscSQLParserImpl.c +++ b/src/client/src/tscSQLParserImpl.c @@ -828,9 +828,6 @@ void setCreateAcctSQL(SSqlInfo *pInfo, int32_t type, SSQLToken *pName, SSQLToken if (pPwd != NULL) { pInfo->pDCLInfo->user.passwd = *pPwd; -// pInfo->pDCLInfo->user.hasPasswd = true; - } else { -// pInfo->pDCLInfo->user.hasPasswd = false; } } @@ -860,14 +857,12 @@ void setAlterUserSQL(SSqlInfo *pInfo, int16_t type, SSQLToken *pName, SSQLToken* if (pPwd != NULL) { pUser->passwd = *pPwd; -// pUser->hasPasswd = true; } else { pUser->passwd.type = TSDB_DATA_TYPE_NULL; } if (pPrivilege != NULL) { pUser->privilege = *pPrivilege; -// pUser->hasPrivilege = true; } else { pUser->privilege.type = TSDB_DATA_TYPE_NULL; } diff --git a/src/client/src/tscServer.c b/src/client/src/tscServer.c index 492cc5cda2..677f728472 100644 --- a/src/client/src/tscServer.c +++ b/src/client/src/tscServer.c @@ -1999,7 +1999,7 @@ int32_t tscBuildAcctMsg(SSqlObj *pSql, SSqlInfo *pInfo) { } int32_t tscBuildUserMsg(SSqlObj *pSql, SSqlInfo *pInfo) { - SAlterUserMsg *pAlterMsg; + SCreateUserMsg *pAlterMsg; char * pMsg, *pStart; SSqlCmd *pCmd = &pSql->cmd; @@ -2009,16 +2009,18 @@ int32_t tscBuildUserMsg(SSqlObj *pSql, SSqlInfo *pInfo) { SUserInfo *pUser = &pInfo->pDCLInfo->user; strncpy(pAlterMsg->user, pUser->user.z, pUser->user.n); + pAlterMsg->flag = pUser->type; if (pUser->type == TSDB_ALTER_USER_PRIVILEGES) { pAlterMsg->privilege = (char)pCmd->count; } else if (pUser->type == TSDB_ALTER_USER_PASSWD) { strncpy(pAlterMsg->pass, pUser->passwd.z, pUser->passwd.n); + } else { // create user password info + strncpy(pAlterMsg->pass, pUser->passwd.z, pUser->passwd.n); } - pMsg += sizeof(SAlterUserMsg); - + pMsg += sizeof(SCreateUserMsg); pCmd->payloadLen = pMsg - pStart; if (pUser->type == TSDB_ALTER_USER_PASSWD || pUser->type == TSDB_ALTER_USER_PRIVILEGES) { -- GitLab