1
0
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:
Ruben S. Montero 2011-05-19 10:48:29 +02:00
parent b94879521c
commit 09148cfcea
3 changed files with 17 additions and 7 deletions

View File

@ -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();

View File

@ -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);

View File

@ -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"
;;
*)