Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
4ba3812b
Commit
4ba3812b
authored
Aug 14, 2018
by
Max Kellermann
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'fchmod_fix' of
git://github.com/1848/MPD
parents
f6b3a887
4797357f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
3 deletions
+13
-3
ServerSocket.cxx
src/event/ServerSocket.cxx
+7
-0
SocketUtil.cxx
src/net/SocketUtil.cxx
+2
-3
SocketUtil.hxx
src/net/SocketUtil.hxx
+4
-0
No files found.
src/event/ServerSocket.cxx
View file @
4ba3812b
...
@@ -184,6 +184,13 @@ OneServerSocket::Open()
...
@@ -184,6 +184,13 @@ OneServerSocket::Open()
SOCK_STREAM
,
0
,
SOCK_STREAM
,
0
,
address
,
5
);
address
,
5
);
#ifdef HAVE_UN
/* allow everybody to connect */
if
(
!
path
.
IsNull
())
chmod
(
path
.
c_str
(),
0666
);
#endif
/* register in the EventLoop */
/* register in the EventLoop */
SetFD
(
_fd
.
Release
());
SetFD
(
_fd
.
Release
());
...
...
src/net/SocketUtil.cxx
View file @
4ba3812b
...
@@ -34,11 +34,10 @@ socket_bind_listen(int domain, int type, int protocol,
...
@@ -34,11 +34,10 @@ socket_bind_listen(int domain, int type, int protocol,
if
(
!
fd
.
CreateNonBlock
(
domain
,
type
,
protocol
))
if
(
!
fd
.
CreateNonBlock
(
domain
,
type
,
protocol
))
throw
MakeSocketError
(
"Failed to create socket"
);
throw
MakeSocketError
(
"Failed to create socket"
);
#ifdef HAVE_UN
#ifdef HAVE_UN
if
(
domain
==
AF_UNIX
)
{
if
(
domain
==
AF_UNIX
)
{
/*
allow everybody to connec
t */
/*
Prevent access until right permissions are se
t */
fchmod
(
fd
.
Get
(),
0
666
);
fchmod
(
fd
.
Get
(),
0
);
}
}
#endif
#endif
...
...
src/net/SocketUtil.hxx
View file @
4ba3812b
...
@@ -32,6 +32,10 @@ class SocketAddress;
...
@@ -32,6 +32,10 @@ class SocketAddress;
/**
/**
* Creates a socket listening on the specified address. This is a
* Creates a socket listening on the specified address. This is a
* shortcut for socket(), bind() and listen().
* shortcut for socket(), bind() and listen().
* When a unix socket is created (domain == AF_UNIX), its
* permissions will be stripped down to prevent unauthorized
* access. The caller is responsible to apply proper permissions
* at a later point.
*
*
* Throws #std::system_error on error.
* Throws #std::system_error on error.
*
*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment