~ubuntu-branches/ubuntu/lucid/mysql-dfsg-5.1/lucid-security

« back to all changes in this revision

Viewing changes to sql/log_event.h

  • Committer: Package Import Robot
  • Author(s): Marc Deslauriers
  • Date: 2012-02-22 22:33:55 UTC
  • mfrom: (1.1.5)
  • Revision ID: package-import@ubuntu.com-20120222223355-or06x1euyk8n0ldi
Tags: 5.1.61-0ubuntu0.10.04.1
* SECURITY UPDATE: Update to 5.1.61 to fix multiple security issues
  (LP: #937869)
  - http://www.oracle.com/technetwork/topics/security/cpujan2012-366304.html
  - CVE-2011-2262
  - CVE-2012-0075
  - CVE-2012-0112
  - CVE-2012-0113
  - CVE-2012-0114
  - CVE-2012-0115
  - CVE-2012-0116
  - CVE-2012-0117
  - CVE-2012-0118
  - CVE-2012-0119
  - CVE-2012-0120
  - CVE-2012-0484
  - CVE-2012-0485
  - CVE-2012-0486
  - CVE-2012-0487
  - CVE-2012-0488
  - CVE-2012-0489
  - CVE-2012-0490
  - CVE-2012-0491
  - CVE-2012-0492
  - CVE-2012-0493
  - CVE-2012-0494
  - CVE-2012-0495
  - CVE-2012-0496
* Dropped patches unnecessary with 5.1.61:
  - debian/patches/90_mysql_safer_strmov.dpatch
  - debian/patches/51_ssl_test_certs.dpatch
  - debian/patches/52_CVE-2009-4030.dpatch
  - debian/patches/53_CVE-2009-4484.dpatch
  - debian/patches/54_CVE-2008-7247.dpatch
  - debian/patches/55_CVE-2010-1621.dpatch
  - debian/patches/56_CVE-2010-1850.dpatch
  - debian/patches/57_CVE-2010-1849.dpatch
  - debian/patches/58_CVE-2010-1848.dpatch
  - debian/patches/59_CVE-2010-1626.dpatch
  - debian/patches/60_CVE-2010-2008.dpatch
  - debian/patches/60_CVE-2010-3677.dpatch
  - debian/patches/60_CVE-2010-3678.dpatch
  - debian/patches/60_CVE-2010-3679.dpatch
  - debian/patches/60_CVE-2010-3680.dpatch
  - debian/patches/60_CVE-2010-3681.dpatch
  - debian/patches/60_CVE-2010-3682.dpatch
  - debian/patches/60_CVE-2010-3683.dpatch
  - debian/patches/60_CVE-2010-3833.dpatch
  - debian/patches/60_CVE-2010-3834.dpatch
  - debian/patches/60_CVE-2010-3835.dpatch
  - debian/patches/60_CVE-2010-3836.dpatch
  - debian/patches/60_CVE-2010-3837.dpatch
  - debian/patches/60_CVE-2010-3838.dpatch
  - debian/patches/60_CVE-2010-3839.dpatch
  - debian/patches/60_CVE-2010-3840.dpatch
  - debian/patches/61_disable_longfilename_test.dpatch
  - debian/patches/62_alter_table_fix.dpatch
  - debian/patches/63_cherrypick-upstream-49479.dpatch
  - debian/patches/10_readline_build_fix.dpatch
* debian/mysql-client-5.1.docs: removed EXCEPTIONS-CLIENT file
* debian/mysql-server-5.1.docs,debian/libmysqlclient16.docs,
  debian/libmysqlclient-dev.docs: removed, no longer necessary.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Copyright (C) 2000-2006 MySQL AB
 
1
/*
 
2
   Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
2
3
 
3
4
   This program is free software; you can redistribute it and/or modify
4
5
   it under the terms of the GNU General Public License as published by
11
12
 
12
13
   You should have received a copy of the GNU General Public License
13
14
   along with this program; if not, write to the Free Software
14
 
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
 
15
   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA
 
16
*/
15
17
 
16
18
/**
17
19
  @addtogroup Replication
263
265
                                   1 + 1 + 255    /* type, length, time_zone */ + \
264
266
                                   1 + 2          /* type, lc_time_names_number */ + \
265
267
                                   1 + 2          /* type, charset_database_number */ + \
266
 
                                   1 + 8          /* type, table_map_for_update */)
 
268
                                   1 + 8          /* type, table_map_for_update */ + \
 
269
                                   1 + 4          /* type, master_data_written */ + \
 
270
                                   1 + 16 + 1 + 60/* type, user_len, user, host_len, host */)
267
271
#define MAX_LOG_EVENT_HEADER   ( /* in order of Query_log_event::write */ \
268
272
  LOG_EVENT_HEADER_LEN + /* write_header */ \
269
273
  QUERY_HEADER_LEN     + /* write_data */   \
330
334
 
331
335
#define Q_TABLE_MAP_FOR_UPDATE_CODE 9
332
336
 
 
337
#define Q_MASTER_DATA_WRITTEN_CODE 10
 
338
 
 
339
#define Q_INVOKER 11
 
340
 
 
341
/* Intvar event post-header */
 
342
 
333
343
/* Intvar event data */
334
344
#define I_TYPE_OFFSET        0
335
345
#define I_VAL_OFFSET         1
458
468
#define LOG_EVENT_SUPPRESS_USE_F    0x8
459
469
 
460
470
/*
461
 
  The table map version internal to the log should be increased after
462
 
  the event has been written to the binary log.
 
471
  Note: this is a place holder for the flag
 
472
  LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F (0x10), which is not used any
 
473
  more, please do not reused this value for other flags.
463
474
 */
464
 
#define LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F 0x10
465
475
 
466
476
/**
467
477
   @def LOG_EVENT_ARTIFICIAL_F
971
981
    return (void*) my_malloc((uint)size, MYF(MY_WME|MY_FAE));
972
982
  }
973
983
 
974
 
  static void operator delete(void *ptr, size_t size)
 
984
  static void operator delete(void *ptr, size_t)
975
985
  {
976
 
    my_free((uchar*) ptr, MYF(MY_WME|MY_ALLOW_ZERO_PTR));
 
986
    my_free(ptr, MYF(MY_WME|MY_ALLOW_ZERO_PTR));
977
987
  }
978
988
 
979
989
  /* Placement version of the above operators */
1541
1551
*/
1542
1552
class Query_log_event: public Log_event
1543
1553
{
 
1554
  LEX_STRING user;
 
1555
  LEX_STRING host;
1544
1556
protected:
1545
1557
  Log_event::Byte* data_buf;
1546
1558
public:
1620
1632
    statement, for other query statements, this will be zero.
1621
1633
  */
1622
1634
  ulonglong table_map_for_update;
 
1635
  /*
 
1636
    Holds the original length of a Query_log_event that comes from a
 
1637
    master of version < 5.0 (i.e., binlog_version < 4). When the IO
 
1638
    thread writes the relay log, it augments the Query_log_event with a
 
1639
    Q_MASTER_DATA_WRITTEN_CODE status_var that holds the original event
 
1640
    length. This field is initialized to non-zero in the SQL thread when
 
1641
    it reads this augmented event. SQL thread does not write 
 
1642
    Q_MASTER_DATA_WRITTEN_CODE to the slave's server binlog.
 
1643
  */
 
1644
  uint32 master_data_written;
1623
1645
 
1624
1646
#ifndef MYSQL_CLIENT
1625
1647
 
1667
1689
                       const char *query_arg,
1668
1690
                       uint32 q_len_arg);
1669
1691
#endif /* HAVE_REPLICATION */
 
1692
  /*
 
1693
    If true, the event always be applied by slave SQL thread or be printed by
 
1694
    mysqlbinlog
 
1695
   */
 
1696
  bool is_trans_keyword()
 
1697
  {
 
1698
    /*
 
1699
      Before the patch for bug#50407, The 'SAVEPOINT and ROLLBACK TO'
 
1700
      queries input by user was written into log events directly.
 
1701
      So the keywords can be written in both upper case and lower case
 
1702
      together, strncasecmp is used to check both cases. they also could be
 
1703
      binlogged with comments in the front of these keywords. for examples:
 
1704
        / * bla bla * / SAVEPOINT a;
 
1705
        / * bla bla * / ROLLBACK TO a;
 
1706
      but we don't handle these cases and after the patch, both quiries are
 
1707
      binlogged in upper case with no comments.
 
1708
     */
 
1709
    return !strncmp(query, "BEGIN", q_len) ||
 
1710
      !strncmp(query, "COMMIT", q_len) ||
 
1711
      !strncasecmp(query, "SAVEPOINT", 9) ||
 
1712
      !strncasecmp(query, "ROLLBACK", 8);
 
1713
  }
1670
1714
};
1671
1715
 
1672
1716
 
1740
1784
  void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
1741
1785
#endif
1742
1786
 
1743
 
  Slave_log_event(const char* buf, uint event_len);
 
1787
  Slave_log_event(const char* buf,
 
1788
                  uint event_len,
 
1789
                  const Format_description_log_event *description_event);
1744
1790
  ~Slave_log_event();
1745
1791
  int get_data_size();
1746
1792
  bool is_valid() const { return master_host != 0; }
1766
1812
 
1767
1813
  @verbatim
1768
1814
   (1)    USE db;
1769
 
   (2)    LOAD DATA [LOCAL] INFILE 'file_name'
 
1815
   (2)    LOAD DATA [CONCURRENT] [LOCAL] INFILE 'file_name'
1770
1816
   (3)    [REPLACE | IGNORE]
1771
1817
   (4)    INTO TABLE 'table_name'
1772
1818
   (5)    [FIELDS
3283
3329
  /* Special constants representing sets of flags */
3284
3330
  enum 
3285
3331
  {
3286
 
    TM_NO_FLAGS = 0U
 
3332
    TM_NO_FLAGS = 0U,
 
3333
    TM_BIT_LEN_EXACT_F = (1U << 0)
3287
3334
  };
3288
3335
 
3289
 
  void set_flags(flag_set flag) { m_flags |= flag; }
3290
 
  void clear_flags(flag_set flag) { m_flags &= ~flag; }
3291
3336
  flag_set get_flags(flag_set flag) const { return m_flags & flag; }
3292
3337
 
3293
3338
#ifndef MYSQL_CLIENT
3294
 
  Table_map_log_event(THD *thd, TABLE *tbl, ulong tid, 
3295
 
                      bool is_transactional, uint16 flags);
 
3339
  Table_map_log_event(THD *thd, TABLE *tbl, ulong tid, bool is_transactional);
3296
3340
#endif
3297
3341
#ifdef HAVE_REPLICATION
3298
3342
  Table_map_log_event(const char *buf, uint event_len, 
3305
3349
  table_def *create_table_def()
3306
3350
  {
3307
3351
    return new table_def(m_coltype, m_colcnt, m_field_metadata,
3308
 
                         m_field_metadata_size, m_null_bits);
 
3352
                         m_field_metadata_size, m_null_bits, m_flags);
3309
3353
  }
3310
3354
  ulong get_table_id() const        { return m_table_id; }
3311
3355
  const char *get_table_name() const { return m_tblnam; }
3542
3586
 
3543
3587
  // Unpack the current row into m_table->record[0]
3544
3588
  int unpack_current_row(const Relay_log_info *const rli)
3545
 
  { 
 
3589
  {
3546
3590
    DBUG_ASSERT(m_table);
 
3591
 
3547
3592
    ASSERT_OR_RETURN_ERROR(m_curr_row < m_rows_end, HA_ERR_CORRUPT_EVENT);
3548
3593
    int const result= ::unpack_row(rli, m_table, m_width, m_curr_row, &m_cols,
3549
3594
                                   &m_curr_row_end, &m_master_reclength);