Skip to content

Commit b391b3f

Browse files
committed
scgi: bake in secure default socket permission
1 parent 1c4f017 commit b391b3f

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

doc/rtorrent.rc

-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,6 @@ network.http.dns_cache_timeout.set = 25
116116

117117
# XML-RPC interface
118118
network.scgi.open_local = (cat,(cfg.basedir),rtorrent.sock)
119-
execute.nothrow = chmod,770,(cat,(cfg.basedir),rtorrent.sock)
120119

121120
# Logging:
122121
# Levels = critical error warn notice info debug

src/rpc/scgi.cc

+5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
// SPDX-License-Identifier: GPL-2.0-or-later
22
// Copyright (C) 2005-2011, Jari Sundell <jaris@ifi.uio.no>
33

4+
#include <sys/stat.h>
45
#include <sys/un.h>
6+
57
#include <torrent/connection_manager.h>
68
#include <torrent/exceptions.h>
79
#include <torrent/poll.h>
@@ -66,6 +68,9 @@ SCgi::open_named(const std::string& filename) {
6668
if (!get_fd().open_local())
6769
throw torrent::resource_error("Could not open socket for listening.");
6870

71+
// 700 permission by default
72+
fchmod(get_fd().get_fd(), S_IRWXU);
73+
6974
open(sa, offsetof(struct sockaddr_un, sun_path) + filename.size() + 1);
7075
m_path = filename;
7176
}

0 commit comments

Comments
 (0)