Merge pull request #1191 from taosdata/feature/liaohj
fix create user bug.
This commit is contained in:
commit
1c12d1f8b7
|
@ -828,9 +828,6 @@ void setCreateAcctSQL(SSqlInfo *pInfo, int32_t type, SSQLToken *pName, SSQLToken
|
||||||
|
|
||||||
if (pPwd != NULL) {
|
if (pPwd != NULL) {
|
||||||
pInfo->pDCLInfo->user.passwd = *pPwd;
|
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) {
|
if (pPwd != NULL) {
|
||||||
pUser->passwd = *pPwd;
|
pUser->passwd = *pPwd;
|
||||||
// pUser->hasPasswd = true;
|
|
||||||
} else {
|
} else {
|
||||||
pUser->passwd.type = TSDB_DATA_TYPE_NULL;
|
pUser->passwd.type = TSDB_DATA_TYPE_NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pPrivilege != NULL) {
|
if (pPrivilege != NULL) {
|
||||||
pUser->privilege = *pPrivilege;
|
pUser->privilege = *pPrivilege;
|
||||||
// pUser->hasPrivilege = true;
|
|
||||||
} else {
|
} else {
|
||||||
pUser->privilege.type = TSDB_DATA_TYPE_NULL;
|
pUser->privilege.type = TSDB_DATA_TYPE_NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1999,7 +1999,7 @@ int32_t tscBuildAcctMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t tscBuildUserMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
|
int32_t tscBuildUserMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
|
||||||
SAlterUserMsg *pAlterMsg;
|
SCreateUserMsg *pAlterMsg;
|
||||||
char * pMsg, *pStart;
|
char * pMsg, *pStart;
|
||||||
|
|
||||||
SSqlCmd *pCmd = &pSql->cmd;
|
SSqlCmd *pCmd = &pSql->cmd;
|
||||||
|
@ -2009,16 +2009,18 @@ int32_t tscBuildUserMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
|
||||||
|
|
||||||
SUserInfo *pUser = &pInfo->pDCLInfo->user;
|
SUserInfo *pUser = &pInfo->pDCLInfo->user;
|
||||||
strncpy(pAlterMsg->user, pUser->user.z, pUser->user.n);
|
strncpy(pAlterMsg->user, pUser->user.z, pUser->user.n);
|
||||||
|
|
||||||
pAlterMsg->flag = pUser->type;
|
pAlterMsg->flag = pUser->type;
|
||||||
|
|
||||||
if (pUser->type == TSDB_ALTER_USER_PRIVILEGES) {
|
if (pUser->type == TSDB_ALTER_USER_PRIVILEGES) {
|
||||||
pAlterMsg->privilege = (char)pCmd->count;
|
pAlterMsg->privilege = (char)pCmd->count;
|
||||||
} else if (pUser->type == TSDB_ALTER_USER_PASSWD) {
|
} else if (pUser->type == TSDB_ALTER_USER_PASSWD) {
|
||||||
strncpy(pAlterMsg->pass, pUser->passwd.z, pUser->passwd.n);
|
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;
|
pCmd->payloadLen = pMsg - pStart;
|
||||||
|
|
||||||
if (pUser->type == TSDB_ALTER_USER_PASSWD || pUser->type == TSDB_ALTER_USER_PRIVILEGES) {
|
if (pUser->type == TSDB_ALTER_USER_PASSWD || pUser->type == TSDB_ALTER_USER_PRIVILEGES) {
|
||||||
|
|
Loading…
Reference in New Issue