~ubuntu-branches/ubuntu/precise/drizzle/precise

« back to all changes in this revision

Viewing changes to drizzled/plugin/authentication.cc

  • Committer: Bazaar Package Importer
  • Author(s): Monty Taylor
  • Date: 2011-03-02 10:38:38 UTC
  • mfrom: (1.2.9 upstream)
  • Revision ID: james.westby@ubuntu.com-20110302103838-4ezi8b065c4bv329
Tags: 2011.03.11-0ubuntu1
* New upstream release.
* Sleep no longer an so.
* Re-add get-orig-source, but this time with working.
* New symbol added to libdrizzle.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19
19
 */
20
20
 
21
 
#include "config.h"
22
 
#include "drizzled/plugin/authentication.h"
23
 
#include "drizzled/error.h"
24
 
#include "drizzled/gettext.h"
25
 
#include "drizzled/identifier.h"
 
21
#include <config.h>
 
22
#include <drizzled/plugin/authentication.h>
 
23
#include <drizzled/error.h>
 
24
#include <drizzled/gettext.h>
 
25
#include <drizzled/identifier.h>
26
26
 
27
27
#include <vector>
28
28
 
64
64
  }
65
65
};
66
66
 
67
 
bool plugin::Authentication::isAuthenticated(drizzled::identifier::User::const_shared_ptr sctx,
 
67
bool plugin::Authentication::isAuthenticated(drizzled::identifier::User::const_reference sctx,
68
68
                                             const std::string &password)
69
69
{
70
70
  /* If we never loaded any auth plugins, just return true */
74
74
  /* Use find_if instead of foreach so that we can collect return codes */
75
75
  std::vector<plugin::Authentication *>::iterator iter=
76
76
    std::find_if(all_authentication.begin(), all_authentication.end(),
77
 
                 AuthenticateBy(*sctx, password));
 
77
                 AuthenticateBy(sctx, password));
78
78
 
79
79
  /* We only require one plugin to return success in order to authenticate.
80
80
   * If iter is == end() here, that means that all of the plugins returned
82
82
   */
83
83
  if (iter == all_authentication.end())
84
84
  {
85
 
    my_error(ER_ACCESS_DENIED_ERROR, MYF(0),
86
 
             sctx->username().c_str(),
87
 
             sctx->address().c_str(),
88
 
             password.empty() ? ER(ER_NO) : ER(ER_YES));
 
85
    error::access(sctx);
89
86
 
90
87
    return false;
91
88
  }