~jaypipes/drizzle/split-xa-resource-manager

« back to all changes in this revision

Viewing changes to drizzled/session.cc

  • Committer: Jay Pipes
  • Date: 2010-02-14 20:26:43 UTC
  • mfrom: (1273.1.27 staging)
  • Revision ID: jpipes@serialcoder-20100214202643-ahuqvc8rhn8u7y33
Merge trunk and resolve conflicts

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
#include <drizzled/session.h>
26
26
#include "drizzled/session_list.h"
27
27
#include <sys/stat.h>
28
 
#include "drizzled/my_error.h"
29
28
#include <drizzled/error.h>
30
29
#include <drizzled/gettext.h>
31
30
#include <drizzled/query_id.h>
392
391
    if (global_system_variables.log_warnings)
393
392
        errmsg_printf(ERRMSG_LVL_WARN, ER(ER_FORCING_CLOSE),internal::my_progname,
394
393
                      thread_id,
395
 
                      (security_ctx.user.c_str() ?
396
 
                       security_ctx.user.c_str() : ""));
 
394
                      (getSecurityContext().getUser().c_str() ?
 
395
                       getSecurityContext().getUser().c_str() : ""));
397
396
    disconnect(0, false);
398
397
  }
399
398
 
678
677
 
679
678
  if (passwd_len != 0 && passwd_len != SCRAMBLE_LENGTH)
680
679
  {
681
 
    my_error(ER_HANDSHAKE_ERROR, MYF(0), security_ctx.ip.c_str());
 
680
    my_error(ER_HANDSHAKE_ERROR, MYF(0), getSecurityContext().getIp().c_str());
682
681
    return false;
683
682
  }
684
683
 
687
686
  if (is_authenticated != true)
688
687
  {
689
688
    my_error(ER_ACCESS_DENIED_ERROR, MYF(0),
690
 
             security_ctx.user.c_str(),
691
 
             security_ctx.ip.c_str(),
 
689
             getSecurityContext().getUser().c_str(),
 
690
             getSecurityContext().getIp().c_str(),
692
691
             passwd_len ? ER(ER_YES) : ER(ER_NO));
693
692
 
694
693
    return false;
695
694
  }
696
695
 
697
 
  security_ctx.skip_grants();
698
 
 
699
696
  /* Change database if necessary */
700
697
  if (in_db && in_db[0])
701
698
  {
907
904
  @return  NULL on failure, or pointer to the LEX_STRING object
908
905
*/
909
906
LEX_STRING *Session::make_lex_string(LEX_STRING *lex_str,
910
 
                                 const char* str, uint32_t length,
911
 
                                 bool allocate_lex_string)
 
907
                                     const std::string &str,
 
908
                                     bool allocate_lex_string)
 
909
{
 
910
  return make_lex_string(lex_str, str.c_str(), str.length(), allocate_lex_string);
 
911
}
 
912
 
 
913
LEX_STRING *Session::make_lex_string(LEX_STRING *lex_str,
 
914
                                     const char* str, uint32_t length,
 
915
                                     bool allocate_lex_string)
912
916
{
913
917
  if (allocate_lex_string)
914
918
    if (!(lex_str= (LEX_STRING *)alloc(sizeof(LEX_STRING))))
1585
1589
  quick_group= 1;
1586
1590
  table_charset= 0;
1587
1591
  precomputed_group_by= 0;
1588
 
  bit_fields_as_long= 0;
1589
1592
}
1590
1593
 
1591
1594
void Tmp_Table_Param::cleanup(void)
1610
1613
  memset(&status_var, 0, sizeof(status_var));
1611
1614
}
1612
1615
 
1613
 
void Security_context::skip_grants()
1614
 
{
1615
 
  /* privileges for the user are unknown everything is allowed */
1616
 
}
1617
 
 
1618
1616
 
1619
1617
/****************************************************************************
1620
1618
  Handling of open and locked tables states.
1728
1726
  {
1729
1727
    if (! killed && variables.log_warnings > 1)
1730
1728
    {
1731
 
      Security_context *sctx= &security_ctx;
 
1729
      SecurityContext *sctx= &security_ctx;
1732
1730
 
1733
1731
      errmsg_printf(ERRMSG_LVL_WARN, ER(ER_NEW_ABORTING_CONNECTION)
1734
1732
                  , thread_id
1735
1733
                  , (db.empty() ? "unconnected" : db.c_str())
1736
 
                  , sctx->user.empty() == false ? sctx->user.c_str() : "unauthenticated"
1737
 
                  , sctx->ip.c_str()
 
1734
                  , sctx->getUser().empty() == false ? sctx->getUser().c_str() : "unauthenticated"
 
1735
                  , sctx->getIp().c_str()
1738
1736
                  , (main_da.is_error() ? main_da.message() : ER(ER_UNKNOWN_ERROR)));
1739
1737
    }
1740
1738
  }