]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Make Tools logfiles readable only by owner and root
authorOliver Kurth <okurth@vmware.com>
Fri, 7 Sep 2018 22:53:27 +0000 (15:53 -0700)
committerOliver Kurth <okurth@vmware.com>
Fri, 7 Sep 2018 22:53:27 +0000 (15:53 -0700)
open-vm-tools/lib/glibUtils/fileLogger.c

index af1cb8a9b03e159bdc56f1a15fa03aeee977acce..98d5bb5eb22963de7cda618f64e264e5a7c37f8f 100644 (file)
@@ -1,5 +1,5 @@
 /*********************************************************
- * Copyright (C) 2010-2016 VMware, Inc. All rights reserved.
+ * Copyright (C) 2010-2018 VMware, Inc. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the GNU Lesser General Public License as published
@@ -299,11 +299,26 @@ FileLoggerOpen(FileLogger *data)
    }
 
    logfile = g_io_channel_new_file(path, data->append ? "a" : "w", NULL);
-   g_free(path);
 
    if (logfile != NULL) {
       g_io_channel_set_encoding(logfile, NULL, NULL);
+#ifdef VMX86_TOOLS
+      /*
+       * Make the logfile readable only by user and root/administrator.
+       */
+#ifdef _WIN32
+      /*
+       * XXX TODO: Set the ACLs properly for Windows.
+       */
+#else
+      /*
+       * Can't do anything if it fails, so ignore return.
+       */
+      (void) chmod(path, 0600);
+#endif
+#endif // VMX86_TOOLS
    }
+   g_free(path);
 
    return logfile;
 }