myserver-commit
[Top][All Lists]
Advanced

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

[myserver-commit] [SCM] GNU MyServer branch, master, updated. 250823e4ae


From: Giuseppe Scrivano
Subject: [myserver-commit] [SCM] GNU MyServer branch, master, updated. 250823e4ae035f0266a00fb45d44a6585714a574
Date: Sun, 25 Oct 2009 11:29:20 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU MyServer".

The branch, master has been updated
       via  250823e4ae035f0266a00fb45d44a6585714a574 (commit)
      from  36de6b92c755ea07a2153d7be9f0356c05d98f74 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------


commit 250823e4ae035f0266a00fb45d44a6585714a574
Author: Giuseppe Scrivano <address@hidden>
Date:   Sun Oct 25 12:29:22 2009 +0100

    Check that configuration file exist before access them.

diff --git a/myserver/src/conf/vhost/xml_vhost_handler.cpp 
b/myserver/src/conf/vhost/xml_vhost_handler.cpp
index 01af49c..7a6225a 100644
--- a/myserver/src/conf/vhost/xml_vhost_handler.cpp
+++ b/myserver/src/conf/vhost/xml_vhost_handler.cpp
@@ -519,7 +519,8 @@ int XmlVhostHandler::load (const char *filename)
                       delete handler;
                       handler = NULL;
                       Server::getInstance ()->log (MYSERVER_LOG_MSG_ERROR,
-                                               _("Error loading %s"), 
filename);
+                                       _("Error loading mime types file: %s"),
+                                                   filename);
 
                     }
                   vh->setMimeHandler (handler);
diff --git a/myserver/src/myserver.cpp b/myserver/src/myserver.cpp
index c6a24b3..cc372c5 100644
--- a/myserver/src/myserver.cpp
+++ b/myserver/src/myserver.cpp
@@ -492,8 +492,13 @@ int main  (int argn, char **argv)
    */
   try
     {
-      loadConfFilesLocation (mainConf, mimeConf, vhostConf, externPath,
-                             input.confFilesLocation);
+      if (loadConfFilesLocation (mainConf, mimeConf, vhostConf, externPath,
+                                 input.confFilesLocation))
+        {
+          cout << _("Cannot find the configuration files, be sure they exist")
+               << endl;
+          return 1;
+        }
 
       switch (runas)
         {
diff --git a/myserver/src/plugin/plugins_manager.cpp 
b/myserver/src/plugin/plugins_manager.cpp
index 3444177..db2555b 100644
--- a/myserver/src/plugin/plugins_manager.cpp
+++ b/myserver/src/plugin/plugins_manager.cpp
@@ -134,23 +134,19 @@ PluginsManager::preLoad (Server* server, string& resource)
   string completeFileName;
   int ret;
   HashMap<string, bool> alreadyCkeched;
-  loadOptions (server);
 
+  loadOptions (server);
   filename.assign (resource);
 
-
-
   ret = fdir.findfirst (filename.c_str ());
-
   if (ret == -1)
     {
       server->log (MYSERVER_LOG_MSG_ERROR,
-                          _("Invalid plugins source"));
+                   _("Invalid plugins source"));
       return ret;
     }
 
   ret = 0;
-
   do
     {
       string dirname (filename);
@@ -211,14 +207,14 @@ PluginsManager::preLoad (Server* server, string& resource)
             {
               Plugin* plugin = preLoadPlugin (libname, server,
                                               pinfo->isGlobal ());
-              if (!plugin)
+              if (plugin)
+                pinfo->setPlugin (plugin);
+              else
                 {
                   ret |= 1;
                   server->log (MYSERVER_LOG_MSG_ERROR,
-                               _("Error loading plugin `%s'"), libname.c_str 
());
+                              _("Error loading plugin `%s'"), libname.c_str 
());
                 }
-              else
-                pinfo->setPlugin (plugin);
             }
           addPluginInfo (pname, pinfo);
         }
diff --git a/myserver/src/server/server.cpp b/myserver/src/server/server.cpp
index 69bd25f..37c72c2 100644
--- a/myserver/src/server/server.cpp
+++ b/myserver/src/server/server.cpp
@@ -181,17 +181,26 @@ void Server::start (string &mainConf, string &mimeConf, 
string &vhostConf,
 
   try
   {
-    if (loadLibraries ())
-      return;
-
     log (MYSERVER_LOG_MSG_INFO, _("Initializing server configuration..."));
 
+    if (loadLibraries ())
+      {
+        log (MYSERVER_LOG_MSG_INFO, _("The server could not be started"));
+        return;
+      }
+
     if (!resetConfigurationPaths (mainConf, mimeConf, vhostConf, externPath))
-      return;
+      {
+        log (MYSERVER_LOG_MSG_INFO, _("The server could not be started"));
+        return;
+      }
 
     err = initialize ();
     if (err)
-      return;
+      {
+        log (MYSERVER_LOG_MSG_INFO, _("The server could not be started"));
+        return;
+      }
 
     /* Initialize the SSL library.  */
     initializeSSL ();
@@ -199,7 +208,10 @@ void Server::start (string &mainConf, string &mimeConf, 
string &vhostConf,
     log (MYSERVER_LOG_MSG_INFO, _("Loading server configuration..."));
 
     if (postLoad ())
-      return;
+      {
+        log (MYSERVER_LOG_MSG_INFO, _("The server could not be started"));
+        return;
+      }
 
     setProcessPermissions ();
 
@@ -228,12 +240,15 @@ void Server::start (string &mainConf, string &mimeConf, 
string &vhostConf,
     {
       log (MYSERVER_LOG_MSG_ERROR, _("Error: %s"), e.what ());
     };
+
   this->terminate ();
   finalCleanup ();
 
 #ifdef WIN32
   WSACleanup ();
 #endif
+
+  log (MYSERVER_LOG_MSG_INFO, _("Server terminated"));
 }
 
 /*!
@@ -292,7 +307,13 @@ int Server::postLoad ()
   loadPlugins ();
 
   /* Load the virtual hosts configuration from the xml file.  */
-  vhostHandler->load (vhostConfigurationFile.c_str ());
+  if (vhostHandler->load (vhostConfigurationFile.c_str ()))
+    {
+      log (MYSERVER_LOG_MSG_ERROR,
+           _("Error loading the vhost configuration file %s"),
+           vhostConfigurationFile.c_str ());
+      return -1;
+    }
 
   if (path == 0)
     path = new string ();
@@ -313,7 +334,6 @@ int Server::postLoad ()
       log (MYSERVER_LOG_MSG_INFO, _("Thread %i created"),  (int)(i + 1));
     }
 
-
   configurationFileManager->close ();
   delete configurationFileManager;
   configurationFileManager = NULL;
@@ -764,14 +784,25 @@ int Server::initialize ()
 
   if (genMainConf)
     {
-        configurationFileManager = genMainConf (this,
-                                   mainConfigurationFile.c_str ());
+      configurationFileManager = genMainConf (this,
+                                              mainConfigurationFile.c_str ());
+      if (!configurationFileManager)
+        {
+          log (MYSERVER_LOG_MSG_ERROR,
+               _("Error while loading the %s configuration file"),
+               mainConfigurationFile.c_str ());
+          return -1;
+        }
+
     }
   else
     {
       XmlMainConfiguration *xmlMainConf = new XmlMainConfiguration ();
       if (xmlMainConf->open (mainConfigurationFile.c_str ()))
         {
+          log (MYSERVER_LOG_MSG_ERROR,
+               _("Error while loading the %s configuration file"),
+               mainConfigurationFile.c_str ());
           delete xmlMainConf;
           return -1;
         }
@@ -1418,7 +1449,10 @@ int Server::reboot ()
   ret = initialize () || postLoad ();
 
   if (ret)
-    return ret;
+    {
+      log (MYSERVER_LOG_MSG_INFO, _("The server could not be restarted"));
+      return ret;
+    }
 
   serverReady = true;
 
@@ -1641,12 +1675,10 @@ int Server::log (LoggingLevel level, const char *fmt, 
...)
   va_list argptr;
 
   va_start (argptr, fmt);
-
   if (!fmt)
     return 0;
 
   bool ts = (logLocation.find ("console://") == string::npos);
-
   failure = logManager->log (this, "MAINLOG", level, ts, true, fmt, argptr);
 
   va_end (argptr);

-----------------------------------------------------------------------

Summary of changes:
 myserver/src/conf/vhost/xml_vhost_handler.cpp |    3 +-
 myserver/src/myserver.cpp                     |    9 +++-
 myserver/src/plugin/plugins_manager.cpp       |   16 +++----
 myserver/src/server/server.cpp                |   58 +++++++++++++++++++------
 4 files changed, 60 insertions(+), 26 deletions(-)


hooks/post-receive
-- 
GNU MyServer




reply via email to

[Prev in Thread] Current Thread [Next in Thread]