From 9bbeb7f6088e51daa06f1faa4e7179493f06989c Mon Sep 17 00:00:00 2001 From: "Ruben S. Montero" Date: Thu, 1 Sep 2016 18:06:05 +0200 Subject: [PATCH] feature #4714: tabs... --- src/um/LoginToken.cc | 116 +++++++++++++++++++++---------------------- 1 file changed, 58 insertions(+), 58 deletions(-) diff --git a/src/um/LoginToken.cc b/src/um/LoginToken.cc index 3c8a037dd5..668da91e7b 100644 --- a/src/um/LoginToken.cc +++ b/src/um/LoginToken.cc @@ -41,110 +41,110 @@ LoginTokenPool::~LoginTokenPool() void LoginTokenPool::reset() { - std::map::iterator it; + std::map::iterator it; - for (it = tokens.begin() ; it != tokens.end() ; ++it) - { - delete it->second; - } + for (it = tokens.begin() ; it != tokens.end() ; ++it) + { + delete it->second; + } - tokens.clear(); + tokens.clear(); } /* -------------------------------------------------------------------------- */ int LoginTokenPool::set(std::string& utk, time_t valid, int egid) { - if (tokens.size() >= MAX_TOKENS || valid < -1 || valid == 0) - { - return -1; - } + if (tokens.size() >= MAX_TOKENS || valid < -1 || valid == 0) + { + return -1; + } - LoginToken * tk = new LoginToken; + LoginToken * tk = new LoginToken; - utk = tk->set(utk, valid, egid); + utk = tk->set(utk, valid, egid); - tokens.insert(std::pair(utk, tk)); + tokens.insert(std::pair(utk, tk)); - return 0; + return 0; } /* -------------------------------------------------------------------------- */ int LoginTokenPool::reset(const std::string& utk) { - std::map::iterator it; + std::map::iterator it; - it = tokens.find(utk); + it = tokens.find(utk); - if ( it == tokens.end() ) - { - return -1; - } + if ( it == tokens.end() ) + { + return -1; + } - delete it->second; + delete it->second; - tokens.erase(it); + tokens.erase(it); - return 0; + return 0; } /* -------------------------------------------------------------------------- */ bool LoginTokenPool::is_valid(const std::string& utk, int& egid) { - std::map::iterator it; + std::map::iterator it; - egid = -1; - it = tokens.find(utk); + egid = -1; + it = tokens.find(utk); - if ( it == tokens.end() ) - { - return false; - } + if ( it == tokens.end() ) + { + return false; + } - if ( it->second->is_valid(utk, egid) == true) - { - return true; - } + if ( it->second->is_valid(utk, egid) == true) + { + return true; + } - delete it->second; + delete it->second; - tokens.erase(it); + tokens.erase(it); - return false; + return false; } /* -------------------------------------------------------------------------- */ void LoginTokenPool::from_xml_node(const std::vector& content) { - std::vector::const_iterator it; + std::vector::const_iterator it; - for (it = content.begin(); it != content.end(); ++it) - { - LoginToken * tk = new LoginToken; - std::string utk = tk->from_xml_node(*it); + for (it = content.begin(); it != content.end(); ++it) + { + LoginToken * tk = new LoginToken; + std::string utk = tk->from_xml_node(*it); - tokens.insert(std::pair(utk, tk)); - } + tokens.insert(std::pair(utk, tk)); + } } /* -------------------------------------------------------------------------- */ std::string& LoginTokenPool::to_xml(std::string& xml) const { - std::map::const_iterator it; - std::ostringstream oss; + std::map::const_iterator it; + std::ostringstream oss; - for ( it = tokens.begin() ; it != tokens.end() ; ++it) - { - it->second->to_xml(oss); - } + for ( it = tokens.begin() ; it != tokens.end() ; ++it) + { + it->second->to_xml(oss); + } - xml = oss.str(); + xml = oss.str(); - return xml; + return xml; } /* -------------------------------------------------------------------------- */ @@ -196,11 +196,11 @@ const std::string& SessionToken::set(const std::string& user_token, time_t valid void LoginToken::to_xml(std::ostringstream& xml) const { - xml << "" - << "" << token << "" - << "" << expiration_time << "" - << "" << egid << "" - << ""; + xml << "" + << "" << token << "" + << "" << expiration_time << "" + << "" << egid << "" + << ""; } /* -------------------------------------------------------------------------- */ @@ -213,7 +213,7 @@ const std::string& LoginToken::from_xml_node(const xmlNodePtr node) oxml.xpath(expiration_time, "/LOGIN_TOKEN/EXPIRATION_TIME", 0); oxml.xpath(egid, "/LOGIN_TOKEN/EGID", -1); - return token; + return token; } /* -------------------------------------------------------------------------- */