improve sql wall

This commit is contained in:
wenshao
2013-08-28 10:25:16 +08:00
parent d36a6eadcc
commit 9b8d165790
20 changed files with 357 additions and 29 deletions
@@ -718,6 +718,24 @@ public abstract class WallProvider {
}
private WallCheckResult checkWhiteAndBlackList(String sql) {
// check black list
if (blackListEnable) {
WallSqlStat sqlStat = getBlackSql(sql);
if (sqlStat != null) {
blackListHitCount.incrementAndGet();
violationCount.incrementAndGet();
if (sqlStat.isSyntaxError()) {
syntaxErrrorCount.incrementAndGet();
}
sqlStat.incrementAndGetExecuteCount();
recordStats(sqlStat.getTableStats(), sqlStat.getFunctionStats());
return new WallCheckResult(sqlStat);
}
}
if (whiteListEnable) {
WallSqlStat sqlStat = getWhiteSql(sql);
if (sqlStat != null) {
@@ -736,23 +754,6 @@ public abstract class WallProvider {
return new WallCheckResult(sqlStat);
}
}
// check black list
if (blackListEnable) {
WallSqlStat sqlStat = getBlackSql(sql);
if (sqlStat != null) {
blackListHitCount.incrementAndGet();
violationCount.incrementAndGet();
if (sqlStat.isSyntaxError()) {
syntaxErrrorCount.incrementAndGet();
}
sqlStat.incrementAndGetExecuteCount();
recordStats(sqlStat.getTableStats(), sqlStat.getFunctionStats());
return new WallCheckResult(sqlStat);
}
}
return null;
}