~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_connect.cc

  • Committer: Monty Taylor
  • Date: 2009-02-08 09:53:59 UTC
  • mfrom: (832.2.10 drizzle-nomaxcon)
  • mto: This revision was merged to the branch mainline in revision 852.
  • Revision ID: mordred@inaugust.com-20090208095359-39xjloxzpjr1mkg4
MergedĀ fromĀ Mark.

Show diffs side-by-side

added added

removed removed

Lines of Context:
46
46
  @param  passwd      scrambled password received from client
47
47
  @param  passwd_len  length of scrambled password
48
48
  @param  db          database name to connect to, may be NULL
49
 
  @param  check_count true if establishing a new connection. In this case
50
 
                      check that we have not exceeded the global
51
 
                      max_connections limist
52
49
 
53
50
  @note Host, user and passwd may point to communication buffer.
54
51
  Current implementation does not depend on that, but future changes
62
59
 
63
60
int
64
61
check_user(Session *session, const char *passwd,
65
 
           uint32_t passwd_len, const char *db,
66
 
           bool check_count)
 
62
           uint32_t passwd_len, const char *db)
67
63
{
68
64
  LEX_STRING db_str= { (char *) db, db ? strlen(db) : 0 };
69
65
  bool is_authenticated;
97
93
 
98
94
  session->security_ctx.skip_grants();
99
95
 
100
 
  if (check_count)
101
 
  {
102
 
    pthread_mutex_lock(&LOCK_connection_count);
103
 
    bool count_ok= connection_count <= max_connections;
104
 
    pthread_mutex_unlock(&LOCK_connection_count);
105
 
 
106
 
    if (!count_ok)
107
 
    {                                         // too many connections
108
 
      my_error(ER_CON_COUNT_ERROR, MYF(0));
109
 
      return(1);
110
 
    }
111
 
  }
112
 
 
113
96
  /* Change database if necessary */
114
97
  if (db && db[0])
115
98
  {
333
316
 
334
317
  session->security_ctx.user.assign(user);
335
318
 
336
 
  return check_user(session, passwd, passwd_len, db, true);
 
319
  return check_user(session, passwd, passwd_len, db);
337
320
}
338
321
 
339
322