~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to libdrizzle/pack.c

MySQL AUTH PLUGIN support for protocol.

Show diffs side-by-side

added added

removed removed

Lines of Context:
226
226
    ptr[0]= DRIZZLE_MAX_SCRAMBLE_SIZE;
227
227
    ptr++;
228
228
 
229
 
    if (con->options & DRIZZLE_CON_MYSQL)
 
229
    if (con->options & DRIZZLE_CON_MYSQL && con->options & DRIZZLE_CON_AUTH_PLUGIN)
 
230
    {
 
231
      snprintf((char *)ptr, DRIZZLE_MAX_SCRAMBLE_SIZE, "%s", con->password);
 
232
    }
 
233
    else if (con->options & DRIZZLE_CON_MYSQL)
230
234
    {
231
235
      *ret_ptr= _pack_scramble_hash(con, ptr);
232
236
      if (*ret_ptr != DRIZZLE_RETURN_OK)
233
237
        return ptr;
234
238
    }
235
 
    else
 
239
    else // We assume Drizzle
 
240
    {
236
241
      snprintf((char *)ptr, DRIZZLE_MAX_SCRAMBLE_SIZE, "%s", con->password);
 
242
    }
237
243
 
238
244
    ptr+= DRIZZLE_MAX_SCRAMBLE_SIZE;
239
245
  }
261
267
  SHA1_CTX ctx;
262
268
  uint8_t hash_tmp1[SHA1_DIGEST_LENGTH];
263
269
  uint8_t hash_tmp2[SHA1_DIGEST_LENGTH];
264
 
  uint32_t x;
265
270
 
266
271
  if (SHA1_DIGEST_LENGTH != DRIZZLE_MAX_SCRAMBLE_SIZE)
267
272
  {
295
300
  SHA1Final(buffer, &ctx);
296
301
 
297
302
  /* Fourth, xor the last hash against the first password hash. */
298
 
  for (x= 0; x < SHA1_DIGEST_LENGTH; x++)
 
303
  for (uint32_t x= 0; x < SHA1_DIGEST_LENGTH; x++)
299
304
    buffer[x]= buffer[x] ^ hash_tmp1[x];
300
305
 
301
306
  return DRIZZLE_RETURN_OK;