aboutsummaryrefslogtreecommitdiffstats
path: root/src/listen.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* listen: check if AI_ADDRCONFIG is definedMax Kellermann2008-12-021-1/+4
| | | | | AI_ADDRCONFIG is not available on all operating systems. Check if it is defined in the current build environment.
* listen: enable AI_PASSIVEMax Kellermann2008-12-021-1/+1
| | | | | The getaddrinfo() flag AI_PASSIVE should be used when resolving addresses for the bind() system call.
* listen: fix namespace collision on OpenSolarisTom Servo2008-11-071-6/+6
| | | | | | | | | The listen.c module breaks the build because the variable name used ("sun") for the Unix domain socket part collides with something else on an OpenSolaris system, likely Sun specific. Renaming it to _sun (or something else of choice) fixes the build. [mk: renamed to "s_un"]
* listen: set file mode 666 on the unix socketMax Kellermann2008-10-301-0/+4
| | | | | | Depending on MPD's umask, the file permissions of the unix socket were too restrictive, and many clients were not able to connect. Do a chmod(0666) on the socket, to allow everybody to connect.
* listen: fix "struct ucred" checkAndrzej Rybczak2008-10-181-3/+3
| | | | The macro name is HAVE_STRUCT_UCRED, not HAVE_UCRED.
* listen: fixed unused variable warning without HAVE_UCREDMax Kellermann2008-10-171-0/+2
| | | | The local variable "passcred" was only used by ucred code.
* configure.ac: check if "struct ucred" is availableMax Kellermann2008-10-161-2/+2
| | | | | | | | | | | By default, glibc 2.8 hides struct ucred behind the _GNU_SOURCE macro. I don't want to enable that globally, because it may encourage the use of non-portable functions. Test if "struct ucred" is available, and enable _GNU_SOURCE if required. For details about that issue, see glib's bug database: http://sources.redhat.com/bugzilla/show_bug.cgi?id=6545
* listen, client: enable SO_PASSCRED, get client's uidMax Kellermann2008-10-151-1/+22
| | | | | Enable authentication over unix sockets. Store the client's uid in the client struct.
* listen: pass protocol family to establishListen()Max Kellermann2008-10-151-27/+8
| | | | | | The caller already knows the protocol family, and we can eliminate the complicated switch statement in establishListen() if we just pass this information. This seems more robust.
* listen: use getaddrinfo() instead of gethostbyname()Max Kellermann2008-10-151-31/+22
| | | | | getaddrinfo() is more robust and has proper IPv6 support. The new code tries to bind to all IP addresses returned by getaddrinfo().
* client: renamed all public functionsMax Kellermann2008-08-281-1/+1
| | | | | | Functions which operate on the whole client list are prefixed with "client_manager_", and functions which handle just one client just get "client_".
* renamed interface.c to client.cMax Kellermann2008-08-281-1/+1
| | | | | | | I don't believe "interface" is a good name for something like "connection by a client to MPD", let's call it "client". This is the first patch in the series which changes the name, beginning with the file name.
* unlink the socket before bind()Max Kellermann2008-04-121-0/+2
| | | | | | If a unix domain socket already exists, bind() fails. Unlink the socket file. git-svn-id: https://svn.musicpd.org/mpd/trunk@7335 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* clean up CPP includesMax Kellermann2008-04-121-0/+2
| | | | | | | | | Try to only include headers which are really needed. We should particularly check all "headers including other headers". The long-term goal is to have a manageable, small API for plugins (decoders, output) without so many mpd internals cluttering the namespace. git-svn-id: https://svn.musicpd.org/mpd/trunk@7319 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* proper bind error message for unix socketMax Kellermann2008-04-121-1/+2
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@7238 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* provide switches for TCP and unix socketsMax Kellermann2008-04-121-0/+16
| | | | | | | autoconf flags for enabling and disabling TCP and unix domain socket support. Embedded machines without a TCP stack may be better off without TCP support. git-svn-id: https://svn.musicpd.org/mpd/trunk@7236 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* support listening on unix domain socketsMax Kellermann2008-04-121-0/+16
| | | | | | | This trivial patch addresses bug 1639. When a bind_to_address argument starts with a slash, assume that it is the address of a Unix domain socket. git-svn-id: https://svn.musicpd.org/mpd/trunk@7235 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* use constant pointers when possibleMax Kellermann2008-04-121-7/+7
| | | | | | It is a good practice to constify pointers when their dereferenced data is not modified within the functions or its descendants. git-svn-id: https://svn.musicpd.org/mpd/trunk@7234 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* eliminate unused parametersMax Kellermann2008-04-121-6/+5
| | | | | | | The parameter "port" is not actually used by establishListen(), and can be removed. This also allows establishListen() to be used for socket addresses which have no port. git-svn-id: https://svn.musicpd.org/mpd/trunk@7233 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* notify: cleanupsEric Wong2008-03-261-1/+1
| | | | | | | | * move set_nonblock{,ing}() into utils.c since we use it elsewhere, too * add proper error checking to set_nonblocking() * use os_compat.h instead of individually #includ-ing system headers git-svn-id: https://svn.musicpd.org/mpd/trunk@7217 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* listen.c: fix shadow warning hereEric Wong2008-02-051-8/+8
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@7182 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Cleanup #includes of standard system headers and put them in one placeEric Wong2008-01-031-12/+1
| | | | | | | | | | | | | This will make refactoring features easier, especially now that pthreads support and larger refactorings are on the horizon. Hopefully, this will make porting to other platforms (even non-UNIX-like ones for masochists) easier, too. os_compat.h will house all the #includes for system headers considered to be the "core" of MPD. Headers for optional features will be left to individual source files. git-svn-id: https://svn.musicpd.org/mpd/trunk@7130 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Redirect stdin *before* we establish a listen socketEric Wong2007-09-051-0/+29
| | | | | | This way we'll avoid listening on fd=0 and have a better chance of having fd=0 as /dev/null git-svn-id: https://svn.musicpd.org/mpd/trunk@6852 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* export FATAL() with noreturn attributeEric Wong2007-08-271-3/+3
| | | | | | | | | | | | | | | | | | | | | This attribute was set in log.c, but not exported to other modules in log.h This allows us to remove some unneccessary variable initializations that were added in r6277. I did audioOutput_shout.c a bit differently, to avoid some jumps. before: $ size src/mpd text data bss dec hex filename 225546 4040 14600 244186 3b9da src/mpd after: $ size src/mpd text data bss dec hex filename 224698 4040 14600 243338 3b68a src/mpd git-svn-id: https://svn.musicpd.org/mpd/trunk@6821 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Removing the getBoundPort() function and just making boundPort an extern.J. Alexander Treuman2007-06-011-6/+1
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@6445 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* After changing ERROR();exit() to FATAL(), gcc incorrectly detects someJ. Alexander Treuman2007-05-261-3/+3
| | | | | | uninitialized variables and non-returning functions that return. Let's tell it to stfu. git-svn-id: https://svn.musicpd.org/mpd/trunk@6277 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Changing all calls to ERROR() followed by exit(EXIT_FAILURE) with a singleJ. Alexander Treuman2007-05-261-31/+16
| | | | | call to FATAL(). git-svn-id: https://svn.musicpd.org/mpd/trunk@6276 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* The massive copyright updateAvuton Olrich2007-04-051-1/+1
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@5834 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Removing a useless block.J. Alexander Treuman2007-02-281-13/+10
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@5460 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Don't initialize globals to zero (or NULL)Eric Wong2007-01-141-3/+3
| | | | | | | | Some compilers and linkers aren't smart enough to optimize this, as global variables are implictly initialized to zero. As a result, binaries are a bit smaller as more goes in the .bss and less in the text section. git-svn-id: https://svn.musicpd.org/mpd/trunk@5254 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* avahi: more sparse fixes (-Wshadow, non-ANSI declarations)Eric Wong2007-01-141-1/+1
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@5248 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Added zeroconf service publishing using avahiJim Ramsay2007-01-111-0/+8
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@5238 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Replace strdup and {c,re,m}alloc with x* variants to check for OOM errorsEric Wong2006-08-261-1/+1
| | | | | | | | | | | | | | | | | | | I'm checking for zero-size allocations and assert()-ing them, so we can more easily get backtraces and debug problems, but we'll also allow -DNDEBUG people to live on the edge if they wish. We do not rely on errno when checking for OOM errors because some implementations of malloc do not set it, and malloc is commonly overridden by userspace wrappers. I've spent some time looking through the source and didn't find any obvious places where we would explicitly allocate 0 bytes, so we shouldn't trip any of those assertions. We also avoid allocating zero bytes because C libraries don't handle this consistently (some return NULL, some not); and it's dangerous either way. git-svn-id: https://svn.musicpd.org/mpd/trunk@4690 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* src/listen.c: replace bcopy with memcpyEric Wong2006-08-011-4/+4
| | | | | bcopy is old-school, yo git-svn-id: https://svn.musicpd.org/mpd/trunk@4509 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Fix the ipv6 bind issue in a nicer wayJ. Alexander Treuman2006-07-221-11/+17
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@4428 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Fix bug when binding to both ipv6 and ipv4 on LinuxJ. Alexander Treuman2006-07-221-11/+24
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@4427 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Add mpd-indent.shAvuton Olrich2006-07-201-67/+68
| | | | | | Indent the entire tree, hopefully we can keep it indented. git-svn-id: https://svn.musicpd.org/mpd/trunk@4410 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* bind to ipv4 and ipv6 addresses for "any"Warren Dukes2006-07-191-64/+69
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@4407 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* sparse: ANSI-fy function declarationsEric Wong2006-07-171-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These are just warnings from sparse, but it makes the output easier to read. I ran this through a quick perl script, but of course verified the output by looking at the diff and making sure the thing still compiles. here's the quick perl script I wrote to generate this patch: ----------- 8< ----------- use Tie::File; defined(my $pid = open my $fh, '-|') or die $!; if (!$pid) { open STDERR, '>&STDOUT' or die $!; exec 'sparse', @ARGV or die $!; } my $na = 'warning: non-ANSI function declaration of function'; while (<$fh>) { print STDERR $_; if (/^(.+?\.[ch]):(\d+):(\d+): $na '(\w+)'/o) { my ($f, $l, $pos, $func) = ($1, $2, $3, $4); $l--; tie my @x, 'Tie::File', $f or die "$!: $f"; print '-', $x[$l], "\n"; $x[$l] =~ s/\b($func\s*)\(\s*\)/$1(void)/; print '+', $x[$l], "\n"; untie @x; } } git-svn-id: https://svn.musicpd.org/mpd/trunk@4378 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Change shank's email addressJ. Alexander Treuman2006-07-141-1/+1
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@4333 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* [CLEANUP] remove unused functionAvuton Olrich2006-07-141-8/+0
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@4331 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Huge header update, update the copyright and addAvuton Olrich2006-07-131-1/+1
| | | | | the GPL header where necessary git-svn-id: https://svn.musicpd.org/mpd/trunk@4317 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* DJWLindenaar balanced tree and master process patchQball Cow2005-11-161-0/+3
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@3669 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* forgot to print a strerrorWarren Dukes2005-09-031-1/+1
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@3466 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* fix a spelling error in a debug msgWarren Dukes2005-03-191-1/+1
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@3103 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* change some header includes so that we can compile on OS XWarren Dukes2005-03-131-3/+0
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@3067 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* config file change! now 'port' is optional and 'db_file' is required!Warren Dukes2005-03-061-3/+22
| | | | | | also, should have better error reporting when failing to open playlist or music directory's, or writing the db, etc git-svn-id: https://svn.musicpd.org/mpd/trunk@3027 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* add "genre" and "description" to shout config parametersWarren Dukes2004-11-091-2/+3
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@2557 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* todo updateWarren Dukes2004-11-031-1/+2
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@2502 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* now one can specify multiple bind_to_addressesWarren Dukes2004-11-031-29/+78
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@2501 09075e82-0dd4-0310-85a5-a0d7c8717e4f