forked from alibaba/druid
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
58 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
src/test/java/com/alibaba/druid/bvt/filter/wall/SQLServerWallPermitFunctionTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package com.alibaba.druid.bvt.filter.wall; | ||
|
||
import org.junit.Assert; | ||
|
||
import com.alibaba.druid.wall.WallUtils; | ||
|
||
import junit.framework.TestCase; | ||
|
||
/** | ||
* SQLServerWallPermitFunctionTest | ||
* | ||
* @author RaymondXiu | ||
* @version 1.0, 2012-3-18 | ||
* @see | ||
*/ | ||
public class SQLServerWallPermitFunctionTest extends TestCase { | ||
|
||
/** | ||
* @param name | ||
*/ | ||
public SQLServerWallPermitFunctionTest(String name) { | ||
super(name); | ||
} | ||
|
||
/* (non-Javadoc) | ||
* @see junit.framework.TestCase#setUp() | ||
*/ | ||
protected void setUp() throws Exception { | ||
super.setUp(); | ||
} | ||
|
||
/* (non-Javadoc) | ||
* @see junit.framework.TestCase#tearDown() | ||
*/ | ||
protected void tearDown() throws Exception { | ||
super.tearDown(); | ||
} | ||
|
||
public void test_permitFunction01() throws Exception { | ||
Assert.assertFalse(WallUtils.isValidateSqlServer("SELECT user_name();")); | ||
Assert.assertFalse(WallUtils.isValidateSqlServer("SELECT DB_NAME()")); | ||
Assert.assertFalse(WallUtils.isValidateSqlServer("SELECT DB_NAME(0); ")); | ||
Assert.assertFalse(WallUtils.isValidateSqlServer("SELECT HOST_NAME()")); | ||
Assert.assertFalse(WallUtils.isValidateSqlServer("EXEC sp_addlogin ‘user’, ‘pass’; ")); | ||
Assert.assertFalse(WallUtils.isValidateSqlServer("EXEC sp_droplogin ‘user’;")); | ||
Assert.assertFalse(WallUtils.isValidateSqlServer("EXEC master.dbo.sp_addsrvrolemember ‘user’, ‘sysadmin")); | ||
Assert.assertFalse(WallUtils.isValidateSqlServer("EXEC sp_helpdb master")); | ||
Assert.assertFalse(WallUtils.isValidateSqlServer("EXEC sp_helpdb pubs")); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters