]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Tools-11.0.5 - Trim trailing whitespace from log params in /etc/tools.conf.
authorOliver Kurth <okurth@vmware.com>
Wed, 11 Dec 2019 18:19:08 +0000 (10:19 -0800)
committerOliver Kurth <okurth@vmware.com>
Wed, 11 Dec 2019 18:19:08 +0000 (10:19 -0800)
Remove trailing whitespace from pathnames and parameters in
tools.conf.

open-vm-tools/libvmtools/vmtoolsLog.c

index dd213e98381c61f5cdcc9b2a9dfc57b0f75c3b81..24b8066d7d6041f8c2216f54c525cb54d35f4990 100644 (file)
@@ -864,6 +864,8 @@ VMToolsGetLogFilePath(const gchar *key,
       return VMToolsDefaultLogFilePath(domain);
    }
 
+   g_strchomp(path);
+
    len = strlen(path);
    origPath = path;
 
@@ -988,6 +990,9 @@ VMToolsGetLogHandler(const gchar *handler,
       /* Always get the facility from the default domain, since syslog is shared. */
       g_snprintf(key, sizeof key, "%s.facility", gLogDomain);
       facility = g_key_file_get_string(cfg, LOGGING_GROUP, key, NULL);
+      if (facility != NULL) {
+         g_strchomp(facility);
+      }
       glogger = GlibUtils_CreateSysLogger(domain, facility);
       /*
        * Older versions of Linux make synchronous call to syslog.
@@ -1090,14 +1095,22 @@ VMToolsConfigLogDomain(const gchar *domain,
    level = g_key_file_get_string(cfg, LOGGING_GROUP, key, NULL);
    if (level == NULL) {
       level = g_strdup(VMTOOLS_LOGGING_LEVEL_DEFAULT);
+   } else {
+      g_strchomp(level);
    }
 
    /* Parse the handler information. */
    g_snprintf(key, sizeof key, "%s.handler", domain);
    handler = g_key_file_get_string(cfg, LOGGING_GROUP, key, NULL);
+   if (handler != NULL) {
+      g_strchomp(handler);
+   }
 
    g_snprintf(key, sizeof key, "%s.data", domain);
    confData = g_key_file_get_string(cfg, LOGGING_GROUP, key, NULL);
+   if (confData != NULL) {
+      g_strchomp(confData);
+   }
 
    /*
     * Disable the old vmx handler if we are setting up the vmx guest logger
@@ -1817,6 +1830,8 @@ LoadFallbackSetting(GKeyFile *cfg)
       return;
    }
 
+   g_strchomp(handler);
+
    if (strcmp(handler, "vmx") != 0) {
       g_debug("%s.handler is not a vmx handler in config file.\n", gLogDomain);
       g_free(handler);
@@ -1830,6 +1845,8 @@ LoadFallbackSetting(GKeyFile *cfg)
    level = g_key_file_get_string(cfg, LOGGING_GROUP, key, NULL);
    if (NULL == level) {
       level = g_strdup(VMTOOLS_LOGGING_LEVEL_DEFAULT);
+   } else {
+      g_strchomp(level);
    }
 
    /* If guest admin allows debug log messages sent to host, honor it. */