From d78110e7fae1588afcb6bc5ea08be0d84ee18857 Mon Sep 17 00:00:00 2001 From: Alexey Yurchenko Date: Sat, 6 Jun 2015 01:08:41 +0300 Subject: Refs codership/mysql-wsrep#141: this commit 1. Passes wsrep_sst_auth_value to SST scripts via WSREP_SST_OPT_AUTH envronmental variable, so it never appears on the command line 2. In mysqldump and xtrabackup* SST scripts which rely on MySQL authentication, instead of passing password on the command line, SST script sets MYSQL_PWD environment variable, so that password also never appears on the mysqldump/innobackupex command line. --- sql/wsrep_utils.h | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'sql/wsrep_utils.h') diff --git a/sql/wsrep_utils.h b/sql/wsrep_utils.h index dfb68bcd1b7..c43febf249a 100644 --- a/sql/wsrep_utils.h +++ b/sql/wsrep_utils.h @@ -44,6 +44,25 @@ private: extern wsp::node_status local_status; namespace wsp { +/* a class to manage env vars array */ +class env +{ +private: + size_t len_; + char** env_; + int errno_; + bool ctor_common(char** e); + void dtor(); + env& operator =(env); +public: + explicit env(char** env); + explicit env(const env&); + ~env(); + int append(const char* var); /* add a new env. var */ + int error() const { return errno_; } + char** operator()() { return env_; } +}; + /* A small class to run external programs. */ class process { @@ -56,8 +75,9 @@ private: public: /*! @arg type is a pointer to a null-terminated string which must contain either the letter 'r' for reading or the letter 'w' for writing. + @arg env optional null-terminated vector of environment variables */ - process (const char* cmd, const char* type); + process (const char* cmd, const char* type, char** env); ~process (); FILE* pipe () { return io_; } @@ -90,6 +110,8 @@ class string { public: string() : string_(0) {} + explicit string(size_t s) : string_(static_cast(malloc(s))) {} + char* operator()() { return string_; } void set(char* str) { if (string_) free (string_); string_ = str; } ~string() { set (0); } private: -- cgit v1.2.1 From d809fcc3011c8fa8cfd62aa6232f45469a829611 Mon Sep 17 00:00:00 2001 From: Alexey Yurchenko Date: Mon, 8 Jun 2015 21:06:22 +0300 Subject: This commit fixes - errno handling in wsp::env::append() method, where error could be returned by mistake - return code of sst_prepare_other() when pthread_create() fails - it was returning positive error code which by convention is treated as success. --- sql/wsrep_utils.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sql/wsrep_utils.h') diff --git a/sql/wsrep_utils.h b/sql/wsrep_utils.h index c43febf249a..7d864603c7f 100644 --- a/sql/wsrep_utils.h +++ b/sql/wsrep_utils.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2013 Codership Oy +/* Copyright (C) 2013-2015 Codership Oy This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by -- cgit v1.2.1