~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/plugin/authentication.cc

edit

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_reference sctx,
 
67
bool plugin::Authentication::isAuthenticated(drizzled::identifier::User::const_shared_ptr 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
 
    error::access(sctx);
 
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));
86
89
 
87
90
    return false;
88
91
  }