mirror of
https://github.com/OpenNebula/one.git
synced 2024-12-23 17:33:56 +03:00
Bug: Fixes AuthRequests time_outs in AuthManager. Tests for the timeout feature are now included and fix
This commit is contained in:
parent
b94879521c
commit
09148cfcea
@ -360,12 +360,14 @@ void AuthManager::timer_action()
|
||||
|
||||
lock();
|
||||
|
||||
for (it=auth_requests.begin();it!=auth_requests.end();it++)
|
||||
it = auth_requests.begin();
|
||||
|
||||
while ( it !=auth_requests.end())
|
||||
{
|
||||
if (the_time > it->second->time_out)
|
||||
{
|
||||
AuthRequest * ar = it->second;
|
||||
auth_requests.erase(it);
|
||||
auth_requests.erase(it++);
|
||||
|
||||
ar->result = false;
|
||||
ar->timeout = true;
|
||||
@ -373,6 +375,10 @@ void AuthManager::timer_action()
|
||||
|
||||
ar->notify();
|
||||
}
|
||||
else
|
||||
{
|
||||
++it;
|
||||
}
|
||||
}
|
||||
|
||||
unlock();
|
||||
|
@ -39,7 +39,7 @@ class AuthManagerTest : public OneUnitTest
|
||||
CPPUNIT_TEST_SUITE (AuthManagerTest);
|
||||
|
||||
CPPUNIT_TEST (load);
|
||||
//CPPUNIT_TEST (timeout);
|
||||
CPPUNIT_TEST (timeout);
|
||||
CPPUNIT_TEST (authenticate);
|
||||
CPPUNIT_TEST (authorize);
|
||||
CPPUNIT_TEST (self_authorize);
|
||||
@ -118,7 +118,7 @@ public:
|
||||
|
||||
am->load_mads(0);
|
||||
|
||||
ar.add_authenticate("the_user","the_pass","the_secret");
|
||||
ar.add_authenticate("timeout","the_pass","the_secret");
|
||||
|
||||
am->trigger(AuthManager::AUTHENTICATE,&ar);
|
||||
|
||||
|
@ -19,9 +19,9 @@
|
||||
echo "MAD started" >> mad.log
|
||||
|
||||
|
||||
while read COMMAND ARG1 ARG2 ARG3
|
||||
while read COMMAND ARG1 ARG2 ARG3 ARG4
|
||||
do
|
||||
echo "$COMMAND $ARG1 $ARG2 $ARG3" >> mad.log
|
||||
echo "$COMMAND $ARG1 $ARG2 $ARG3 $ARG4" >> mad.log
|
||||
case $COMMAND in
|
||||
"INIT")
|
||||
echo "INIT SUCCESS"
|
||||
@ -31,9 +31,13 @@ do
|
||||
exit 0
|
||||
;;
|
||||
"AUTHORIZE")
|
||||
echo "AUTHORIZE FAILURE $ARG1 $ARG3"
|
||||
echo "AUTHORIZE FAILURE $ARG1 $ARG3 $ARG4"
|
||||
;;
|
||||
"AUTHENTICATE")
|
||||
if [ "$ARG3" = "timeout" ] ; then
|
||||
sleep 4
|
||||
fi
|
||||
|
||||
echo "AUTHENTICATE SUCCESS $ARG1"
|
||||
;;
|
||||
*)
|
||||
|
Loading…
Reference in New Issue
Block a user