Skip to content

Commit

Permalink
Merge pull request #22668 from taosdata/feat/audit-table-namee
Browse files Browse the repository at this point in the history
Feat/audit table name
  • Loading branch information
gccgdb1234 committed Aug 31, 2023
2 parents 8d48fd1 + 03de7ad commit fcd3c6f
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 7 deletions.
4 changes: 2 additions & 2 deletions source/dnode/mnode/impl/src/mndStb.c
Original file line number Diff line number Diff line change
Expand Up @@ -2612,9 +2612,9 @@ static int32_t mndProcessDropStbReq(SRpcMsg *pReq) {
dropReq.igNotExists, dropReq.source);

SName name = {0};
tNameFromString(&name, pDb->name, T_NAME_ACCT | T_NAME_DB);
tNameFromString(&name, dropReq.name, T_NAME_ACCT | T_NAME_DB | T_NAME_TABLE);

auditRecord(pReq, pMnode->clusterId, "dropStb", name.dbname, dropReq.name, detail);
auditRecord(pReq, pMnode->clusterId, "dropStb", name.dbname, name.tname, detail);

_OVER:
if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS) {
Expand Down
12 changes: 10 additions & 2 deletions source/dnode/mnode/impl/src/mndStream.c
Original file line number Diff line number Diff line change
Expand Up @@ -888,7 +888,11 @@ static int32_t mndProcessCreateStreamReq(SRpcMsg *pReq) {
createStreamReq.lastTs, createStreamReq.maxDelay, createStreamReq.numOfTags, createStreamReq.sourceDB,
createStreamReq.targetStbFullName, createStreamReq.triggerType, createStreamReq.watermark);

auditRecord(pReq, pMnode->clusterId, "createStream", createStreamReq.name, "", detail);
SName name = {0};
tNameFromString(&name, createStreamReq.name, T_NAME_ACCT | T_NAME_DB);
//reuse this function for stream

auditRecord(pReq, pMnode->clusterId, "createStream", name.dbname, "", detail);

_OVER:
if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS) {
Expand Down Expand Up @@ -1322,7 +1326,11 @@ static int32_t mndProcessDropStreamReq(SRpcMsg *pReq) {
char detail[100] = {0};
sprintf(detail, "igNotExists:%d", dropReq.igNotExists);

auditRecord(pReq, pMnode->clusterId, "dropStream", dropReq.name, "", detail);
SName name = {0};
tNameFromString(&name, dropReq.name, T_NAME_ACCT | T_NAME_DB);
//reuse this function for stream

auditRecord(pReq, pMnode->clusterId, "dropStream", name.dbname, "", detail);

sdbRelease(pMnode->pSdb, pStream);
mndTransDrop(pTrans);
Expand Down
6 changes: 5 additions & 1 deletion source/dnode/mnode/impl/src/mndTopic.c
Original file line number Diff line number Diff line change
Expand Up @@ -853,7 +853,11 @@ static int32_t mndProcessDropTopicReq(SRpcMsg *pReq) {
char detail[100] = {0};
sprintf(detail, "igNotExists:%d", dropReq.igNotExists);

auditRecord(pReq, pMnode->clusterId, "dropTopic", dropReq.name, "", detail);
SName name = {0};
tNameFromString(&name, dropReq.name, T_NAME_ACCT | T_NAME_DB);
//reuse this function for topic

auditRecord(pReq, pMnode->clusterId, "dropTopic", name.dbname, "", detail);

return TSDB_CODE_ACTION_IN_PROGRESS;
}
Expand Down
7 changes: 5 additions & 2 deletions source/dnode/mnode/impl/src/mndUser.c
Original file line number Diff line number Diff line change
Expand Up @@ -1039,11 +1039,14 @@ static int32_t mndProcessAlterUserReq(SRpcMsg *pReq) {
if (code == 0) code = TSDB_CODE_ACTION_IN_PROGRESS;

char detail[1000] = {0};
sprintf(detail, "alterType:%s, enable:%d, superUser:%d, sysInfo:%d, tabName:%s",
sprintf(detail, "alterType:%s, enable:%d, superUser:%d, sysInfo:%d, tabName:%s, password:",
mndUserAuditTypeStr(alterReq.alterType), alterReq.enable, alterReq.superUser, alterReq.sysInfo, alterReq.tabName);

if(alterReq.alterType == TSDB_ALTER_USER_PASSWD){
auditRecord(pReq, pMnode->clusterId, "changePassword", alterReq.user, "", detail);
sprintf(detail, "alterType:%s, enable:%d, superUser:%d, sysInfo:%d, tabName:%s, password:xxx",
mndUserAuditTypeStr(alterReq.alterType), alterReq.enable, alterReq.superUser, alterReq.sysInfo,
alterReq.tabName);
auditRecord(pReq, pMnode->clusterId, "alterUser", alterReq.user, "", detail);
}
else if(alterReq.alterType == TSDB_ALTER_USER_SUPERUSER ||
alterReq.alterType == TSDB_ALTER_USER_ENABLE ||
Expand Down

0 comments on commit fcd3c6f

Please sign in to comment.