]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Toolsd uses log.text RPC only when the useLogTextRpc is set to TRUE.
authorOliver Kurth <okurth@vmware.com>
Tue, 30 Apr 2019 20:24:24 +0000 (13:24 -0700)
committerOliver Kurth <okurth@vmware.com>
Tue, 30 Apr 2019 20:24:24 +0000 (13:24 -0700)
This allows the tools installer to start use the log.text RPC without
worrying about that toolsd has not completed the work of scrubbing its logs
for security and privacy issues.

open-vm-tools/libvmtools/vmtoolsLog.c

index d5d3fab2cf5dd14d08232e75a7779653de56c1b7..6043491d9b799488311cd5e03ea8b4684bc5df50 100644 (file)
@@ -1866,7 +1866,11 @@ SetupLogLevelAndRpcMode(GKeyFile *cfg,
                         const gchar *level)
 {
    gboolean isDebugLogAllowed;
+   gboolean useLogTextRpc = g_key_file_get_boolean(cfg, LOGGING_GROUP,
+                                                   "useLogTextRpc", NULL);
 
+   g_info("Configuration %s.useLogTextRpc is %s\n", LOGGING_GROUP,
+          useLogTextRpc ? "TRUE" : "FALSE");
    /*
     * Perhaps it is better to have tools.conf switch that allow log debug
     * message to the host. However, this might confuse the user by allowing
@@ -1880,12 +1884,16 @@ SetupLogLevelAndRpcMode(GKeyFile *cfg,
 
    gRpcMode = RPC_OFF;
 
-   if (NULL == gChannel) {
-      /*
-       * Channel could be broken due to a VMX channel reinitialize
-       * This needs to be tolerated, but we cannot log right now...
-       * A later reset handler would refresh the channel.
-       */
+   if (!useLogTextRpc) {
+      LoadFallbackSetting(cfg);
+      if (gRpcMode != RPC_OFF) {
+         CreateRpcChannel();
+      }
+      goto done;
+   }
+
+   /* Following are when useLogTextRpc is TRUE */
+   if (!CreateRpcChannel()) {
       g_info("The LOG RPC channel is not up, skip query log state.\n");
       goto done;
    }
@@ -1921,7 +1929,11 @@ SetupLogLevelAndRpcMode(GKeyFile *cfg,
 
 done:
 
-   if (RPC_OFF == gRpcMode || NULL == gChannel) {
+   if (NULL == gChannel) {
+      gRpcMode = RPC_OFF;
+   }
+
+   if (RPC_OFF == gRpcMode) {
       /*
        * No need to keep around the RPC channel,
        * VMX can give it to other apps.
@@ -2486,21 +2498,11 @@ SetupVmxGuestLogInt(gboolean refreshRpcChannel,   // IN
                     GKeyFile *cfg,                // IN
                     const gchar *level)           // IN
 {
-   gboolean disabled = g_key_file_get_boolean(cfg, LOGGING_GROUP,
-                                             "vmxGuestLogDisabled", NULL);
-
-   if (disabled) {
-      g_info("Vmx guest logger is disabled in tools configuration");
-      gRpcMode = RPC_OFF;
-      DestroyRpcChannel();
-      return;
-   }
-
    if (refreshRpcChannel) {
       DestroyRpcChannel();
    }
 
-   if (CreateRpcChannel() && SetupLogLevelAndRpcMode(cfg, level)) {
+   if (SetupLogLevelAndRpcMode(cfg, level)) {
       g_info("Initialized the vmx guest logger.\n");
    }
 }