mirror of
https://github.com/eclipse/mosquitto.git
synced 2025-05-08 16:52:13 +08:00
parent
4e63975189
commit
fecf4797d9
@ -4,6 +4,7 @@
|
||||
Broker:
|
||||
- Fix QoS 1 / QoS 2 publish incorrectly returning "no subscribers".
|
||||
Closes #3128.
|
||||
- Open files with appropriate access on Windows. Closes #3119.
|
||||
|
||||
Client library:
|
||||
- Fix cmake build on OS X. Closes #3125.
|
||||
|
@ -67,24 +67,31 @@ FILE *mosquitto__fopen(const char *path, const char *mode, bool restrict_read)
|
||||
DWORD ulen = UNLEN;
|
||||
SECURITY_DESCRIPTOR sd;
|
||||
DWORD dwCreationDisposition;
|
||||
DWORD dwShareMode;
|
||||
int fd;
|
||||
FILE *fptr;
|
||||
|
||||
switch(mode[0]){
|
||||
case 'a':
|
||||
dwCreationDisposition = OPEN_ALWAYS;
|
||||
dwShareMode = GENERIC_WRITE;
|
||||
flags = _O_APPEND;
|
||||
break;
|
||||
case 'r':
|
||||
dwCreationDisposition = OPEN_EXISTING;
|
||||
dwShareMode = GENERIC_READ;
|
||||
flags = _O_RDONLY;
|
||||
break;
|
||||
case 'w':
|
||||
dwCreationDisposition = CREATE_ALWAYS;
|
||||
dwShareMode = GENERIC_WRITE;
|
||||
break;
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
if(mode[1] == '+'){
|
||||
dwShareMode = GENERIC_READ | GENERIC_WRITE;
|
||||
}
|
||||
|
||||
GetUserNameA(username, &ulen);
|
||||
if (!InitializeSecurityDescriptor(&sd, SECURITY_DESCRIPTOR_REVISION)) {
|
||||
@ -104,7 +111,7 @@ FILE *mosquitto__fopen(const char *path, const char *mode, bool restrict_read)
|
||||
sec.bInheritHandle = FALSE;
|
||||
sec.lpSecurityDescriptor = &sd;
|
||||
|
||||
hfile = CreateFileA(buf, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ,
|
||||
hfile = CreateFileA(buf, dwShareMode, FILE_SHARE_READ,
|
||||
&sec,
|
||||
dwCreationDisposition,
|
||||
FILE_ATTRIBUTE_NORMAL,
|
||||
|
Loading…
x
Reference in New Issue
Block a user