~clint-fewbar/ubuntu/natty/drizzle/beta1-fixes

« back to all changes in this revision

Viewing changes to libdrizzle/pack.c

  • Committer: Bazaar Package Importer
  • Author(s): Monty Taylor
  • Date: 2011-03-15 10:41:18 UTC
  • mfrom: (1.2.10 upstream)
  • Revision ID: james.westby@ubuntu.com-20110315104118-eaf0hvlytjdl4zrf
Tags: 2011.03.13-0ubuntu1
* New upstream release.
* Added slave plugin.
* Removed archive, blackhole and blitzdb plugins.
* Moved location of libdrizzle headers.
* Removed drizzleadmin manpage patch.
* Add drizzle_safe_write_string to symbols.

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
  uint32_t x= 0;
 
304
  for (; x < SHA1_DIGEST_LENGTH; x++)
299
305
    buffer[x]= buffer[x] ^ hash_tmp1[x];
300
306
 
301
307
  return DRIZZLE_RETURN_OK;