Skip to content

Commit

Permalink
Allow other apps access to log file on Windows.
Browse files Browse the repository at this point in the history
This change means that users with the appropriate security permissions
can open the log file for reading at the same time that it is being
written.

Closes eclipse-mosquitto#515.
  • Loading branch information
ralight committed Jul 3, 2019
1 parent d17d7c9 commit 2b2afc9
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
3 changes: 3 additions & 0 deletions ChangeLog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
Broker:
- Fix persistent clients being incorrectly expired on Raspberry Pis.
Closes #1272.
- Windows: Allow other applications access to the log file when running.
Closes #515.


1.6.3 - 20190618
================
Expand Down
2 changes: 1 addition & 1 deletion lib/util_mosq.c
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ FILE *mosquitto__fopen(const char *path, const char *mode, bool restrict_read)
sec.bInheritHandle = FALSE;
sec.lpSecurityDescriptor = &sd;

hfile = CreateFile(buf, GENERIC_READ | GENERIC_WRITE, 0,
hfile = CreateFile(buf, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ,
&sec,
dwCreationDisposition,
FILE_ATTRIBUTE_NORMAL,
Expand Down
8 changes: 8 additions & 0 deletions readme-windows.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,11 @@ command line as follows:

C:\Program Files\mosquitto\mosquitto install
C:\Program Files\mosquitto\mosquitto uninstall

Logging
-------

If you use `log_dest file ...` in your configuration, the log file will be
created with security permissions for the current user only. If running as a
service, this means the SYSTEM user. You will only be able to view the log file
if you add permissions for yourself or whatever user you wish to view the logs.

0 comments on commit 2b2afc9

Please sign in to comment.