From: Oliver Kurth Date: Tue, 30 Apr 2019 20:24:24 +0000 (-0700) Subject: Toolsd uses log.text RPC only when the useLogTextRpc is set to TRUE. X-Git-Tag: stable-11.0.0~108 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3cf1df758ba64cb6aebe81bf3a430ad536221c19;p=thirdparty%2Fopen-vm-tools.git Toolsd uses log.text RPC only when the useLogTextRpc is set to TRUE. 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. --- diff --git a/open-vm-tools/libvmtools/vmtoolsLog.c b/open-vm-tools/libvmtools/vmtoolsLog.c index d5d3fab2c..6043491d9 100644 --- a/open-vm-tools/libvmtools/vmtoolsLog.c +++ b/open-vm-tools/libvmtools/vmtoolsLog.c @@ -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"); } }