drizzle
C++ MySQL-protocol-compatible database server
Loading...
Searching...
No Matches
auth_schema.h
1/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3 *
4 * Copyright 2011 Daniel Nichter
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19
20#pragma once
21#include <drizzled/session.h>
22#include <drizzled/plugin/authentication.h>
23#include <drizzled/pcre.h>
24
25using namespace std;
26using namespace drizzled;
27
28namespace drizzle_plugin {
29namespace auth_schema {
30
31class AuthSchema : public drizzled::plugin::Authentication
32{
33public:
34 AuthSchema(bool enabled);
35 ~AuthSchema();
36
46 bool setTable(const string &table);
47
54 string sysvar_table;
55
56private:
60 bool authenticate(const identifier::User &sctx, const string &password);
61
83 bool verifyMySQLPassword(const string &real_password,
84 const string &scramble_bytes,
85 const string &client_password);
86
104 string escapeQuoteAuthTable(const string &table);
105
114 string escapeQuoteIdentifier(const string &input);
115
129 string escapeString(const string &input);
130
131 pcre2_code *_ident_re;
132 Session::shared_ptr _session;
133};
134
135} /* end namespace drizzle_plugin::auth_schema */
136} /* end namespace drizzle_plugin */
bool setTable(const string &table)
Set the authentication table.
Session::shared_ptr _session
Internal session for querying auth table.
string escapeQuoteAuthTable(const string &table)
Split, escape, and quote the auth table name.
string escapeString(const string &input)
Escape a string for use as a single-quoted string value.
bool authenticate(const identifier::User &sctx, const string &password)
string escapeQuoteIdentifier(const string &input)
Escape and quote an identifier.
bool verifyMySQLPassword(const string &real_password, const string &scramble_bytes, const string &client_password)
Verify that the client password matches the real password.
A set of Session members describing the current authenticated user.
TODO: Rename this file - func.h is stupid.
STL namespace.