[glom] MySQL support: Add a check for an empty initial password.



commit 4c8230f30788c1b25698904c7b0e3bf7b843d797
Author: Murray Cumming <murrayc murrayc com>
Date:   Fri Feb 15 10:53:00 2013 +0100

    MySQL support: Add a check for an empty initial password.
    
            * glom/libglom/connectionpool_backends/mysql_self.cc:
        This doesn't happen, but it would be nice to avoid it if it ever
        does somehow.

 ChangeLog                                          |    8 ++++++++
 glom/libglom/connectionpool_backends/mysql_self.cc |    8 +++++++-
 2 files changed, 15 insertions(+), 1 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 89b7973..cb9c4df 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2013-02-15  Murray Cumming  <murrayc murrayc com>
+
+        MySQL support: Add a check for an empty initial password.
+
+        * glom/libglom/connectionpool_backends/mysql_self.cc:
+       This doesn't happen, but it would be nice to avoid it if it ever
+       does somehow.
+
 1.23.4:
 
 2013-03-11  Murray Cumming  <murrayc murrayc com>
diff --git a/glom/libglom/connectionpool_backends/mysql_self.cc 
b/glom/libglom/connectionpool_backends/mysql_self.cc
index 53d24fd..064cc47 100644
--- a/glom/libglom/connectionpool_backends/mysql_self.cc
+++ b/glom/libglom/connectionpool_backends/mysql_self.cc
@@ -371,7 +371,7 @@ Backend::StartupErrors MySQLSelfHosted::startup(const SlotProgress& slot_progres
   {
     m_port = 0;
 
-    std::cerr << "Error while attempting to self-host a MySQL database." << std::endl;
+    std::cerr << G_STRFUNC << "Error while attempting to self-host a MySQL database." << std::endl;
     return STARTUPERROR_FAILED_UNKNOWN_REASON;
   }
 
@@ -380,6 +380,12 @@ Backend::StartupErrors MySQLSelfHosted::startup(const SlotProgress& slot_progres
   //If necessary, set the initial root password and rename the root user:
   if(m_temporary_password_active)
   {
+    if(m_initial_password_to_set.empty()) {
+      //If this is empty then mysqladmin will ask for it on stdout, blocking us.
+      std::cerr << G_STRFUNC << "Error while attempting to self-host a MySQL database: 
m_initial_password_to_set is empty." << std::endl;
+      return STARTUPERROR_FAILED_UNKNOWN_REASON;
+    }
+
     //Set the root password:
     const std::string command_initdb_set_initial_password = get_mysqladmin_command("root", 
m_temporary_password)
       + " password " + Glib::shell_quote(m_initial_password_to_set);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]