~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/session.cc

  • Committer: Brian Aker
  • Date: 2010-12-18 10:14:05 UTC
  • mfrom: (2008.1.3 clean)
  • Revision ID: brian@tangent.org-20101218101405-qjbse29shi9coklg
Merge of user identifier work

Show diffs side-by-side

added added

removed removed

Lines of Context:
49
49
#include "drizzled/transaction_services.h"
50
50
#include "drizzled/drizzled.h"
51
51
 
 
52
#include "drizzled/identifier.h"
 
53
 
52
54
#include "drizzled/table/instance.h"
53
55
 
54
56
#include "plugin/myisam/myisam.h"
171
173
  scheduler(NULL),
172
174
  scheduler_arg(NULL),
173
175
  lock_id(&main_lock_id),
 
176
  thread_stack(NULL),
 
177
  security_ctx(identifier::User::make_shared()),
174
178
  user_time(0),
175
179
  ha_data(plugin::num_trx_monitored_objects),
176
180
  concurrent_execute_allowed(true),
203
207
    will be re-initialized in init_for_queries().
204
208
  */
205
209
  memory::init_sql_alloc(&main_mem_root, memory::ROOT_MIN_BLOCK_SIZE, 0);
206
 
  thread_stack= NULL;
207
210
  count_cuted_fields= CHECK_FIELD_ERROR_FOR_NULL;
208
211
  col_access= 0;
209
212
  tmp_table= 0;
378
381
 
379
382
  if (client->isConnected())
380
383
  {
 
384
    assert(security_ctx);
381
385
    if (global_system_variables.log_warnings)
382
 
        errmsg_printf(ERRMSG_LVL_WARN, ER(ER_FORCING_CLOSE),internal::my_progname,
383
 
                      thread_id,
384
 
                      (getSecurityContext().getUser().c_str() ?
385
 
                       getSecurityContext().getUser().c_str() : ""));
 
386
    {
 
387
      errmsg_printf(ERRMSG_LVL_WARN, ER(ER_FORCING_CLOSE),
 
388
                    internal::my_progname,
 
389
                    thread_id,
 
390
                    security_ctx->username().c_str());
 
391
    }
 
392
 
386
393
    disconnect(0, false);
387
394
  }
388
395
 
605
612
*/
606
613
bool Session::isViewable() const
607
614
{
608
 
  return plugin::Authorization::isAuthorized(current_session->getSecurityContext(),
 
615
  return plugin::Authorization::isAuthorized(current_session->user(),
609
616
                                             this,
610
617
                                             false);
611
618
}
651
658
                        const std::string &in_db)
652
659
{
653
660
  bool is_authenticated=
654
 
    plugin::Authentication::isAuthenticated(getSecurityContext(),
655
 
                                            passwd_str);
 
661
    plugin::Authentication::isAuthenticated(user(), passwd_str);
656
662
 
657
663
  if (is_authenticated != true)
658
664
  {
1660
1666
  {
1661
1667
    if (not getKilled() && variables.log_warnings > 1)
1662
1668
    {
1663
 
      SecurityContext *sctx= &security_ctx;
1664
 
 
1665
1669
      errmsg_printf(ERRMSG_LVL_WARN, ER(ER_NEW_ABORTING_CONNECTION)
1666
1670
                  , thread_id
1667
1671
                  , (_schema->empty() ? "unconnected" : _schema->c_str())
1668
 
                  , sctx->getUser().empty() == false ? sctx->getUser().c_str() : "unauthenticated"
1669
 
                  , sctx->getIp().c_str()
 
1672
                  , security_ctx->username().empty() == false ? security_ctx->username().c_str() : "unauthenticated"
 
1673
                  , security_ctx->address().c_str()
1670
1674
                  , (main_da.is_error() ? main_da.message() : ER(ER_UNKNOWN_ERROR)));
1671
1675
    }
1672
1676
  }