~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to libdrizzle-1.0/handshake.c

  • Committer: Brian Aker
  • Date: 2011-11-26 23:14:59 UTC
  • mto: This revision was merged to the branch mainline in revision 2465.
  • Revision ID: brian@tangent.org-20111126231459-pa9i3arizevf0vlr
Remove con from being passed object.

Show diffs side-by-side

added added

removed removed

Lines of Context:
142
142
  }
143
143
 
144
144
  /* Look for null-terminated server version string. */
145
 
  ptr= (uint8_t*)memchr(con->buffer_ptr, 0, con->buffer_size - 1);
 
145
  ptr= memchr(con->buffer_ptr, 0, con->buffer_size - 1);
146
146
  if (ptr == NULL)
147
147
  {
148
148
    drizzle_set_error(con->drizzle, "drizzle_state_handshake_server_read",
188
188
  con->charset= con->buffer_ptr[0];
189
189
  con->buffer_ptr+= 1;
190
190
 
191
 
  con->status= drizzle_con_status_t(drizzle_get_byte2(con->buffer_ptr));
 
191
  con->status= drizzle_get_byte2(con->buffer_ptr);
192
192
  /* Skip status and filler. */
193
193
  con->buffer_ptr+= 15;
194
194
 
325
325
drizzle_return_t drizzle_state_handshake_client_read(drizzle_con_st *con)
326
326
{
327
327
  size_t real_size;
 
328
  uint8_t *ptr;
328
329
  uint8_t scramble_size;
329
330
 
330
331
  drizzle_log_debug(con->drizzle, "drizzle_state_handshake_client_read");
367
368
  con->buffer_ptr+= 23;
368
369
 
369
370
  /* Look for null-terminated user string. */
370
 
  uint8_t *ptr= (uint8_t*)memchr(con->buffer_ptr, 0, con->buffer_size - 32);
 
371
  ptr= memchr(con->buffer_ptr, 0, con->buffer_size - 32);
371
372
  if (ptr == NULL)
372
373
  {
373
374
    drizzle_set_error(con->drizzle, "drizzle_state_handshake_client_read",
400
401
  con->buffer_ptr+= 1;
401
402
 
402
403
  if (scramble_size == 0)
403
 
  {
404
404
    con->scramble= NULL;
405
 
  }
406
405
  else
407
406
  {
408
407
    if (scramble_size != DRIZZLE_MAX_SCRAMBLE_SIZE)
421
420
 
422
421
  /* Look for null-terminated db string. */
423
422
  if ((34 + strlen(con->user) + scramble_size) == con->packet_size)
424
 
  {
425
423
    con->db[0]= 0;
426
 
  }
427
424
  else
428
425
  {
429
 
    ptr= (uint8_t*)memchr(con->buffer_ptr, 0, con->buffer_size -
 
426
    ptr= memchr(con->buffer_ptr, 0, con->buffer_size -
430
427
                                    (34 + strlen(con->user) + scramble_size));
431
428
    if (ptr == NULL)
432
429
    {
473
470
drizzle_return_t drizzle_state_handshake_client_write(drizzle_con_st *con)
474
471
{
475
472
  uint8_t *ptr;
476
 
  int capabilities;
 
473
  drizzle_capabilities_t capabilities;
477
474
  drizzle_return_t ret;
478
475
 
479
476
  drizzle_log_debug(con->drizzle, "drizzle_state_handshake_client_write");
506
503
  if (con->options & DRIZZLE_CON_MYSQL)
507
504
    con->capabilities|= DRIZZLE_CAPABILITIES_PROTOCOL_41;
508
505
 
509
 
  capabilities= con->capabilities & int(DRIZZLE_CAPABILITIES_CLIENT);
 
506
  capabilities= con->capabilities & DRIZZLE_CAPABILITIES_CLIENT;
510
507
  if (!(con->options & DRIZZLE_CON_FOUND_ROWS))
511
 
    capabilities&= ~int(DRIZZLE_CAPABILITIES_FOUND_ROWS);
 
508
    capabilities&= ~DRIZZLE_CAPABILITIES_FOUND_ROWS;
512
509
 
513
510
  if (con->options & DRIZZLE_CON_INTERACTIVE)
514
511
  {
515
 
    capabilities|= int(DRIZZLE_CAPABILITIES_INTERACTIVE);
 
512
    capabilities|= DRIZZLE_CAPABILITIES_INTERACTIVE;
516
513
  }
517
514
 
518
515
  if (con->options & DRIZZLE_CON_MULTI_STATEMENTS)
519
516
  {
520
 
    capabilities|= int(DRIZZLE_CAPABILITIES_MULTI_STATEMENTS);
 
517
    capabilities|= DRIZZLE_CAPABILITIES_MULTI_STATEMENTS;
521
518
  }
522
519
 
523
520
  if (con->options & DRIZZLE_CON_AUTH_PLUGIN)
524
521
  {
525
 
    capabilities|= int(DRIZZLE_CAPABILITIES_PLUGIN_AUTH);
 
522
    capabilities|= DRIZZLE_CAPABILITIES_PLUGIN_AUTH;
526
523
  }
527
524
 
528
 
  capabilities&= ~(int(DRIZZLE_CAPABILITIES_COMPRESS) | int(DRIZZLE_CAPABILITIES_SSL));
 
525
  capabilities&= ~(DRIZZLE_CAPABILITIES_COMPRESS | DRIZZLE_CAPABILITIES_SSL);
529
526
  if (con->db[0] == 0)
530
 
    capabilities&= ~int(DRIZZLE_CAPABILITIES_CONNECT_WITH_DB);
 
527
    capabilities&= ~DRIZZLE_CAPABILITIES_CONNECT_WITH_DB;
531
528
 
532
529
  drizzle_set_byte4(ptr, capabilities);
533
530
  ptr+= 4;