fix: pass some test
This commit is contained in:
parent
4931bfa7a0
commit
94236b8cee
|
@ -163,6 +163,7 @@ SArray *mmGetMsgHandles() {
|
||||||
|
|
||||||
|
|
||||||
if (dmSetMgmtHandle(pArray, TDMT_MND_RETRIEVE_IP_WHITE, mmPutMsgToReadQueue, 0) == NULL) goto _OVER;
|
if (dmSetMgmtHandle(pArray, TDMT_MND_RETRIEVE_IP_WHITE, mmPutMsgToReadQueue, 0) == NULL) goto _OVER;
|
||||||
|
if (dmSetMgmtHandle(pArray, TDMT_MND_GET_USER_WHITELIST, mmPutMsgToReadQueue, 0) == NULL) goto _OVER;
|
||||||
if (dmSetMgmtHandle(pArray, TDMT_MND_GET_INDEX, mmPutMsgToReadQueue, 0) == NULL) goto _OVER;
|
if (dmSetMgmtHandle(pArray, TDMT_MND_GET_INDEX, mmPutMsgToReadQueue, 0) == NULL) goto _OVER;
|
||||||
if (dmSetMgmtHandle(pArray, TDMT_MND_GET_TABLE_INDEX, mmPutMsgToReadQueue, 0) == NULL) goto _OVER;
|
if (dmSetMgmtHandle(pArray, TDMT_MND_GET_TABLE_INDEX, mmPutMsgToReadQueue, 0) == NULL) goto _OVER;
|
||||||
if (dmSetMgmtHandle(pArray, TDMT_MND_TMQ_CREATE_TOPIC, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
|
if (dmSetMgmtHandle(pArray, TDMT_MND_TMQ_CREATE_TOPIC, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
|
||||||
|
|
|
@ -1244,7 +1244,7 @@ int32_t mndSetUserWhiteListRsp(SMnode *pMnode, SUserObj *pUser, SGetUserWhiteLis
|
||||||
if (pWhiteListRsp->pWhiteLists == NULL) {
|
if (pWhiteListRsp->pWhiteLists == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
memcpy(pUser->pIpWhiteList->pIpRange, pUser->pIpWhiteList->pIpRange,
|
memcpy(pWhiteListRsp->pWhiteLists, pUser->pIpWhiteList->pIpRange,
|
||||||
pWhiteListRsp->numWhiteLists * sizeof(SIpV4Range));
|
pWhiteListRsp->numWhiteLists * sizeof(SIpV4Range));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -34,19 +34,8 @@
|
||||||
#define USER_LEN 24
|
#define USER_LEN 24
|
||||||
#define BUF_LEN 1024
|
#define BUF_LEN 1024
|
||||||
|
|
||||||
typedef uint16_t VarDataLenT;
|
void createUsers(TAOS *taos, const char *host);
|
||||||
|
void dropUsers(TAOS* taos);
|
||||||
#define TSDB_NCHAR_SIZE sizeof(int32_t)
|
|
||||||
#define VARSTR_HEADER_SIZE sizeof(VarDataLenT)
|
|
||||||
|
|
||||||
#define GET_FLOAT_VAL(x) (*(float *)(x))
|
|
||||||
#define GET_DOUBLE_VAL(x) (*(double *)(x))
|
|
||||||
|
|
||||||
#define varDataLen(v) ((VarDataLenT *)(v))[0]
|
|
||||||
|
|
||||||
void createUsers(TAOS *taos, const char *host, char *qstr);
|
|
||||||
void passVerTestMulti(const char *host, char *qstr);
|
|
||||||
void sysInfoTest(TAOS *taos, const char *host, char *qstr);
|
|
||||||
|
|
||||||
int nPassVerNotified = 0;
|
int nPassVerNotified = 0;
|
||||||
int nWhiteListVerNotified = 0;
|
int nWhiteListVerNotified = 0;
|
||||||
|
@ -71,6 +60,17 @@ void __taos_notify_cb(void *param, void *ext, int type) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void __taos_async_whitelist_cb(void *param, int code, TAOS *taos, int numOfWhiteLists, uint64_t* pWhiteList) {
|
||||||
|
if (code == 0) {
|
||||||
|
printf("fetch whitelist cb. user: %s numofWhitelist: %d\n", param ? (char*)param : NULL, numOfWhiteLists);
|
||||||
|
for (int i = 0; i < numOfWhiteLists; ++i) {
|
||||||
|
printf(" %d: %16x\n", i, pWhiteList[i]);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
printf("fetch whitelist cb error %d\n", code);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void queryDB(TAOS *taos, char *command) {
|
static void queryDB(TAOS *taos, char *command) {
|
||||||
int i;
|
int i;
|
||||||
TAOS_RES *pSql = NULL;
|
TAOS_RES *pSql = NULL;
|
||||||
|
@ -116,13 +116,27 @@ int main(int argc, char *argv[]) {
|
||||||
printf("failed to connect to server, reason:%s\n", "null taos" /*taos_errstr(taos)*/);
|
printf("failed to connect to server, reason:%s\n", "null taos" /*taos_errstr(taos)*/);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
createUsers(taos, argv[1], qstr);
|
createUsers(taos, argv[1]);
|
||||||
|
|
||||||
|
sleep(10);
|
||||||
|
|
||||||
|
dropUsers(taos);
|
||||||
taos_close(taos);
|
taos_close(taos);
|
||||||
taos_cleanup();
|
taos_cleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
void createUsers(TAOS *taos, const char *host, char *qstr) {
|
void dropUsers(TAOS *taos) {
|
||||||
|
char qstr[1024];
|
||||||
|
for (int i = 0; i < nUser; ++i) {
|
||||||
|
sprintf(users[i], "user%d", i);
|
||||||
|
sprintf(qstr, "DROP USER %s", users[i]);
|
||||||
|
queryDB(taos, qstr);
|
||||||
|
taos_close(taosu[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void createUsers(TAOS *taos, const char *host) {
|
||||||
|
char qstr[1024];
|
||||||
// users
|
// users
|
||||||
for (int i = 0; i < nUser; ++i) {
|
for (int i = 0; i < nUser; ++i) {
|
||||||
sprintf(users[i], "user%d", i);
|
sprintf(users[i], "user%d", i);
|
||||||
|
@ -143,8 +157,10 @@ void createUsers(TAOS *taos, const char *host, char *qstr) {
|
||||||
fprintf(stderr, "success to run: taos_set_notify_cb for user:%s\n", users[i]);
|
fprintf(stderr, "success to run: taos_set_notify_cb for user:%s\n", users[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// alter pass for users
|
// alter whitelist for users
|
||||||
sprintf(qstr, "alter user %s add host '%d.%d.%d.%d/24'", users[i], i, i, i, i);
|
sprintf(qstr, "alter user %s add host '%d.%d.%d.%d/24'", users[i], i, i, i, i);
|
||||||
queryDB(taos, qstr);
|
queryDB(taos, qstr);
|
||||||
|
|
||||||
|
taos_fetch_whitelist_a(taosu[i], __taos_async_whitelist_cb, users[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue