Skip to content

Commit

Permalink
use chmod before listen instead of fchmod, related to boazsegev…
Browse files Browse the repository at this point in the history
  • Loading branch information
boazsegev committed Jan 8, 2023
1 parent c90a33e commit a89d156
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ Please notice that this change log contains changes for upcoming releases as wel

## Changes:

#### Change log v.0.7.53 (expected: 2023-01-10)

**Fix**: Fixes Unix socket permission limitations, so unix sockets are not limited to the owner of the process. Credit to Patrik Rak (@raxoft) for opening issue #136.

#### Change log v.0.7.52 (2022-12-10)

Expand Down
5 changes: 3 additions & 2 deletions ext/iodine/fio.c
Original file line number Diff line number Diff line change
Expand Up @@ -3203,13 +3203,14 @@ static intptr_t fio_unix_socket(const char *address, uint8_t server) {
close(fd);
return -1;
}
/* chmod for foreign connections... if possible */
if(chmod(addr.sun_path, 0x1FF))
FIO_LOG_WARNING("chmod failed for %s (%d: %s)", address, errno, strerror(errno));
if (listen(fd, SOMAXCONN) < 0) {
// perror("couldn't start listening to unix socket");
close(fd);
return -1;
}
/* chmod for foreign connections */
fchmod(fd, 0777);
} else {
if (connect(fd, (struct sockaddr *)&addr, sizeof(addr)) == -1 &&
errno != EINPROGRESS) {
Expand Down
2 changes: 1 addition & 1 deletion lib/iodine/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Iodine
VERSION = '0.7.52'.freeze
VERSION = '0.7.53'.freeze
end

0 comments on commit a89d156

Please sign in to comment.