~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/console/console.cc

  • Committer: Monty Taylor
  • Date: 2010-03-11 18:27:20 UTC
  • mfrom: (1333 staging)
  • mto: This revision was merged to the branch mainline in revision 1348.
  • Revision ID: mordred@inaugust.com-20100311182720-hd1h87y6cb1b1mp0
Merged trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
#include <drizzled/gettext.h>
18
18
#include <drizzled/plugin/listen_tcp.h>
19
19
#include <drizzled/plugin/client.h>
 
20
#include <drizzled/session.h>
20
21
 
21
22
#include <iostream>
22
23
 
25
26
 
26
27
static bool enabled= false;
27
28
static bool debug_enabled= false;
 
29
static char* user = (char*)"";
 
30
static char* password = (char*)"";
 
31
static char* db = NULL;
 
32
 
28
33
 
29
34
class ClientConsole: public plugin::Client
30
35
{
84
89
  virtual bool authenticate(void)
85
90
  {
86
91
    printDebug("authenticate");
87
 
    return true;
 
92
    session->getSecurityContext().setUser(user);
 
93
    return session->checkUser(password, strlen(password), db);
88
94
  }
89
95
 
90
96
  virtual bool readCommand(char **packet, uint32_t *packet_length)
323
329
 
324
330
static DRIZZLE_SYSVAR_BOOL(debug, debug_enabled, PLUGIN_VAR_NOCMDARG,
325
331
                           N_("Turn on extra debugging."), NULL, NULL, false);
 
332
static DRIZZLE_SYSVAR_STR(user, user, PLUGIN_VAR_READONLY,
 
333
                          N_("User to use for auth."), NULL, NULL, NULL);
 
334
static DRIZZLE_SYSVAR_STR(password, password, PLUGIN_VAR_READONLY,
 
335
                          N_("Password to use for auth."), NULL, NULL, NULL);
 
336
static DRIZZLE_SYSVAR_STR(db, db, PLUGIN_VAR_READONLY,
 
337
                          N_("Default database to use."), NULL, NULL, NULL);
326
338
 
327
339
static drizzle_sys_var* vars[]= {
328
340
  DRIZZLE_SYSVAR(enable),
329
341
  DRIZZLE_SYSVAR(debug),
 
342
  DRIZZLE_SYSVAR(user),
 
343
  DRIZZLE_SYSVAR(password),
 
344
  DRIZZLE_SYSVAR(db),
330
345
  NULL
331
346
};
332
347
 
340
355
  PLUGIN_LICENSE_BSD,
341
356
  init,   /* Plugin Init */
342
357
  deinit, /* Plugin Deinit */
343
 
  NULL,   /* status variables */
344
358
  vars,   /* system variables */
345
359
  NULL    /* config options */
346
360
}