[Commits] Rev 3449: MDEV-26. Intermediary commit. in http://bazaar.launchpad.net/~maria-captains/maria/10.0

knielsen at knielsen-hq.org knielsen at knielsen-hq.org
Wed Feb 13 14:36:46 EET 2013


At http://bazaar.launchpad.net/~maria-captains/maria/10.0

------------------------------------------------------------
revno: 3449
revision-id: knielsen at knielsen-hq.org-20130213123646-6kzi7kilctvmvc42
parent: knielsen at knielsen-hq.org-20130211154438-84vxb1oeso0vvwkr
committer: knielsen at knielsen-hq.org
branch nick: work-10.0-mdev26
timestamp: Wed 2013-02-13 13:36:46 +0100
message:
  MDEV-26. Intermediary commit.
  
  Fix binlog_gtid_pos() to handle empty file name, and to not allow user
  to open arbitrary file on the system.
=== modified file 'sql/sql_repl.cc'
--- a/sql/sql_repl.cc	2013-02-11 15:44:38 +0000
+++ b/sql/sql_repl.cc	2013-02-13 12:36:46 +0000
@@ -957,13 +957,28 @@ gtid_state_from_pos(const char *name, ui
 
 
 int
-gtid_state_from_binlog_pos(const char *name, uint32 pos, String *out_str)
+gtid_state_from_binlog_pos(const char *in_name, uint32 pos, String *out_str)
 {
   slave_connection_state gtid_state;
+  const char *lookup_name;
+  char name_buf[FN_REFLEN];
+  LOG_INFO linfo;
+
+  if (in_name && in_name[0])
+  {
+    mysql_bin_log.make_log_name(name_buf, in_name);
+    lookup_name= name_buf;
+  }
+  else
+    lookup_name= NULL;
+  linfo.index_file_offset= 0;
+  if (mysql_bin_log.find_log_pos(&linfo, lookup_name, 1))
+    return 1;
 
   if (pos < 4)
     pos= 4;
-  if (gtid_state_from_pos(name, pos, &gtid_state) ||
+
+  if (gtid_state_from_pos(linfo.log_file_name, pos, &gtid_state) ||
       gtid_state.to_string(out_str))
     return 1;
   return 0;



More information about the commits mailing list