-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
scgi: bake in secure default socket permission
- Loading branch information
Showing
2 changed files
with
5 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
// SPDX-License-Identifier: GPL-2.0-or-later | ||
// Copyright (C) 2005-2011, Jari Sundell <[email protected]> | ||
|
||
#include <sys/stat.h> | ||
#include <sys/un.h> | ||
|
||
#include <torrent/connection_manager.h> | ||
#include <torrent/exceptions.h> | ||
#include <torrent/poll.h> | ||
|
@@ -66,6 +68,9 @@ SCgi::open_named(const std::string& filename) { | |
if (!get_fd().open_local()) | ||
throw torrent::resource_error("Could not open socket for listening."); | ||
|
||
// 700 permission by default | ||
fchmod(get_fd().get_fd(), S_IRWXU); | ||
|
||
open(sa, offsetof(struct sockaddr_un, sun_path) + filename.size() + 1); | ||
m_path = filename; | ||
} | ||
|