~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/rpl_mi.cc

  • Committer: Brian Aker
  • Date: 2008-10-06 19:59:47 UTC
  • Revision ID: brian@tangent.org-20081006195947-zc1046tvfugicesg
Random dead cleanup (mainly around SSL in the replication master.info)

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
 
27
27
Master_info::Master_info()
28
28
  :Slave_reporting_capability("I/O"),
29
 
   ssl(0), ssl_verify_server_cert(0), fd(-1),  io_thd(0), port(DRIZZLE_PORT),
 
29
   fd(-1),  io_thd(0), port(DRIZZLE_PORT),
30
30
   connect_retry(DEFAULT_CONNECT_RETRY), heartbeat_period(0),
31
31
   received_heartbeats(0), inited(0),
32
32
   abort_slave(0), slave_running(0), slave_run_id(0)
33
33
{
34
34
  host[0] = 0; user[0] = 0; password[0] = 0;
35
 
  ssl_ca[0]= 0; ssl_capath[0]= 0; ssl_cert[0]= 0;
36
 
  ssl_cipher[0]= 0; ssl_key[0]= 0;
37
35
 
38
36
  memset(&file, 0, sizeof(file));
39
37
  pthread_mutex_init(&run_lock, MY_MUTEX_INIT_FAST);
178
176
 
179
177
    mi->fd = fd;
180
178
    int port, connect_retry, master_log_pos, lines;
181
 
    int ssl= 0, ssl_verify_server_cert= 0;
182
179
    float master_heartbeat_period= 0.0;
183
180
    char *first_non_digit;
184
181
 
241
238
    */
242
239
    if (lines >= LINES_IN_MASTER_INFO_WITH_SSL)
243
240
    {
244
 
      if (init_intvar_from_file(&ssl, &mi->file, 0) ||
245
 
          init_strvar_from_file(mi->ssl_ca, sizeof(mi->ssl_ca),
246
 
                                &mi->file, 0) ||
247
 
          init_strvar_from_file(mi->ssl_capath, sizeof(mi->ssl_capath),
248
 
                                &mi->file, 0) ||
249
 
          init_strvar_from_file(mi->ssl_cert, sizeof(mi->ssl_cert),
250
 
                                &mi->file, 0) ||
251
 
          init_strvar_from_file(mi->ssl_cipher, sizeof(mi->ssl_cipher),
252
 
                                &mi->file, 0) ||
253
 
          init_strvar_from_file(mi->ssl_key, sizeof(mi->ssl_key),
254
 
                               &mi->file, 0))
255
 
      goto errwithmsg;
256
 
 
257
 
      /*
258
 
        Starting from 5.1.16 ssl_verify_server_cert might be
259
 
        in the file
260
 
      */
261
 
      if (lines >= LINE_FOR_MASTER_SSL_VERIFY_SERVER_CERT &&
262
 
          init_intvar_from_file(&ssl_verify_server_cert, &mi->file, 0))
263
 
        goto errwithmsg;
264
241
      /*
265
242
        Starting from 6.0 master_heartbeat_period might be
266
243
        in the file
270
247
        goto errwithmsg;
271
248
    }
272
249
 
273
 
    if (ssl)
274
 
      sql_print_warning(_("SSL information in the master info file "
275
 
                          "('%s') are ignored because this MySQL slave was "
276
 
                          "compiled without SSL support."), fname);
277
 
 
278
250
    /*
279
251
      This has to be handled here as init_intvar_from_file can't handle
280
252
      my_off_t types
282
254
    mi->master_log_pos= (my_off_t) master_log_pos;
283
255
    mi->port= (uint) port;
284
256
    mi->connect_retry= (uint) connect_retry;
285
 
    mi->ssl= (bool) ssl;
286
 
    mi->ssl_verify_server_cert= ssl_verify_server_cert;
287
257
    mi->heartbeat_period= master_heartbeat_period;
288
258
  }
289
259
 
361
331
  sprintf(heartbeat_buf, "%.3f", mi->heartbeat_period);
362
332
  my_b_seek(file, 0L);
363
333
  my_b_printf(file,
364
 
              "%u\n%s\n%s\n%s\n%s\n%s\n%d\n%d\n%d\n%s\n%s\n%s\n%s\n%s\n%d\n%s\n",
 
334
              "%u\n%s\n%s\n%s\n%s\n%s\n%d\n%d\n%d\n%s\n",
365
335
              LINES_IN_MASTER_INFO,
366
336
              mi->master_log_name, llstr(mi->master_log_pos, lbuf),
367
337
              mi->host, mi->user,
368
338
              mi->password, mi->port, mi->connect_retry,
369
 
              (int)(mi->ssl), mi->ssl_ca, mi->ssl_capath, mi->ssl_cert,
370
 
              mi->ssl_cipher, mi->ssl_key, mi->ssl_verify_server_cert,
371
339
              heartbeat_buf);
372
340
  return(-flush_io_cache(file));
373
341
}