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
4e83b79d
Commit
4e83b79d
authored
Jun 06, 2010
by
Tim Phipps
Committed by
Max Kellermann
Jun 06, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
output/httpd: add libwrap support
libwrap support is in MPD but only for the control port. This patch adds support for the http port. The code is copied from src/client_new.c
parent
37e69a89
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
0 deletions
+28
-0
httpd_output_plugin.c
src/output/httpd_output_plugin.c
+28
-0
No files found.
src/output/httpd_output_plugin.c
View file @
4e83b79d
...
...
@@ -41,6 +41,10 @@
#include <unistd.h>
#include <errno.h>
#ifdef HAVE_LIBWRAP
#include <tcpd.h>
#endif
#undef G_LOG_DOMAIN
#define G_LOG_DOMAIN "httpd_output"
...
...
@@ -208,6 +212,30 @@ httpd_listen_in_event(G_GNUC_UNUSED GIOChannel *source,
fd
=
accept_cloexec_nonblock
(
httpd
->
fd
,
(
struct
sockaddr
*
)
&
sa
,
&
sa_length
);
#ifdef HAVE_LIBWRAP
struct
sockaddr
*
sa_p
=
(
struct
sockaddr
*
)
&
sa
;
if
(
sa_p
->
sa_family
!=
AF_UNIX
)
{
char
*
hostaddr
=
sockaddr_to_string
(
sa_p
,
sa_length
,
NULL
);
const
char
*
progname
=
g_get_prgname
();
struct
request_info
req
;
request_init
(
&
req
,
RQ_FILE
,
fd
,
RQ_DAEMON
,
progname
,
0
);
fromhost
(
&
req
);
if
(
!
hosts_access
(
&
req
))
{
/* tcp wrappers says no */
g_warning
(
"libwrap refused connection (libwrap=%s) from %s"
,
progname
,
hostaddr
);
g_free
(
hostaddr
);
close
(
fd
);
g_mutex_unlock
(
httpd
->
mutex
);
return
true
;
}
g_free
(
hostaddr
);
}
#endif
/* HAVE_WRAP */
if
(
fd
>=
0
)
{
/* can we allow additional client */
if
(
httpd
->
open
&&
...
...
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