Commit 413b6c248b7be566ae65e9ab4fdf35f640d58f3b
1 parent
051bf8c4
KTS-808: Session IP tracking defaults to off, configurable using
session/ipTracking configuration variable. git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@5245 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
2 changed files
with
7 additions
and
6 deletions
config/config.ini
| ... | ... | @@ -141,6 +141,8 @@ uiUrl = ${rootUrl}/presentation/lookAndFeel/knowledgeTree |
| 141 | 141 | ; session timeout (in seconds) |
| 142 | 142 | sessionTimeout = 1200 |
| 143 | 143 | allowAnonymousLogin = true |
| 144 | +; Set to true to force sessions to come from the same IP address | |
| 145 | +; ipTracking = false | |
| 144 | 146 | |
| 145 | 147 | [import] |
| 146 | 148 | ; unzip command - will use execSearchPath to find if the path to the | ... | ... |
lib/session/Session.inc
| ... | ... | @@ -159,18 +159,17 @@ class Session { |
| 159 | 159 | $iUserID = $aRow["user_id"]; |
| 160 | 160 | |
| 161 | 161 | $oKTConfig = KTConfig::getSingleton(); |
| 162 | - $allowAnon = $oKTConfig->get('allowAnonymousLogin', false); | |
| 162 | + $allowAnon = $oKTConfig->get('session/allowAnonymousLogin', false); | |
| 163 | 163 | $ANON = -2; |
| 164 | - if ((!allowAnon) && ($iUserId == $ANON)) { return false; } | |
| 165 | - | |
| 164 | + if ((!$allowAnon) && ($iUserId == $ANON)) { return false; } | |
| 165 | + | |
| 166 | + $ipTracking = $oKTConfig->get('session/ipTracking', false); | |
| 166 | 167 | // check that ip matches |
| 167 | 168 | $ip = $this->getClientIP(); |
| 168 | - if ($ip != trim($aRow["ip"])) { | |
| 169 | + if ($ipTracking && ($ip != trim($aRow["ip"]))) { | |
| 169 | 170 | return PEAR::raiseError("You are coming from a different IP address than the session requires"); |
| 170 | - return false; | |
| 171 | 171 | } |
| 172 | 172 | |
| 173 | - | |
| 174 | 173 | // now check if the timeout has been exceeded |
| 175 | 174 | $lastused = $aRow["lastused"]; |
| 176 | 175 | $diff = time() - strtotime($lastused); | ... | ... |