From: Oliver Kurth Date: Fri, 7 Sep 2018 22:53:27 +0000 (-0700) Subject: Make Tools logfiles readable only by owner and root X-Git-Tag: stable-10.3.5~19 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8ffda7dbae4b916b28e3f903554bc37db1d5f974;p=thirdparty%2Fopen-vm-tools.git Make Tools logfiles readable only by owner and root --- diff --git a/open-vm-tools/lib/glibUtils/fileLogger.c b/open-vm-tools/lib/glibUtils/fileLogger.c index af1cb8a9b..98d5bb5eb 100644 --- a/open-vm-tools/lib/glibUtils/fileLogger.c +++ b/open-vm-tools/lib/glibUtils/fileLogger.c @@ -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; }