From 6a1b2f0387b4b8a8dc5e63c5d433a880a7738503 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sun, 29 Dec 2013 10:40:59 +0100 Subject: [PATCH 1/6] configure.ac: prepare for 0.18.7 --- NEWS | 2 ++ configure.ac | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 1ddad9412..50eb77686 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,5 @@ +ver 0.18.7 (not yet released) + ver 0.18.6 (2013/12/24) * input - cdio_paranoia: support libcdio-paranoia 0.90 diff --git a/configure.ac b/configure.ac index a487e4a2b..9909cb461 100644 --- a/configure.ac +++ b/configure.ac @@ -1,6 +1,6 @@ AC_PREREQ(2.60) -AC_INIT(mpd, 0.18.6, musicpd-dev-team@lists.sourceforge.net) +AC_INIT(mpd, 0.18.7, musicpd-dev-team@lists.sourceforge.net) VERSION_MAJOR=0 VERSION_MINOR=18 From 0b1ad27ba8ecb8799e2a34ecad9206619cb8d14e Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sun, 29 Dec 2013 13:47:23 +0100 Subject: [PATCH 2/6] Daemon: fix typo in cast --- src/Daemon.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Daemon.cxx b/src/Daemon.cxx index 4f214517e..088e7926d 100644 --- a/src/Daemon.cxx +++ b/src/Daemon.cxx @@ -52,7 +52,7 @@ static char *user_name; static uid_t user_uid = (uid_t)-1; /** the Unix group id which MPD runs as */ -static gid_t user_gid = (pid_t)-1; +static gid_t user_gid = (gid_t)-1; /** the absolute path of the pidfile */ static AllocatedPath pidfile = AllocatedPath::Null(); From 20ffedc745f8360aeed59479d77601cf6cf7cc03 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sun, 29 Dec 2013 13:56:50 +0100 Subject: [PATCH 3/6] Daemon: simplify nested "if" --- src/Daemon.cxx | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/Daemon.cxx b/src/Daemon.cxx index 088e7926d..1623cca24 100644 --- a/src/Daemon.cxx +++ b/src/Daemon.cxx @@ -106,11 +106,10 @@ daemonize_set_user(void) return; /* set gid */ - if (user_gid != (gid_t)-1 && user_gid != getgid()) { - if (setgid(user_gid) == -1) { - FormatFatalSystemError("Failed to set group %d", - (int)user_gid); - } + if (user_gid != (gid_t)-1 && user_gid != getgid() && + setgid(user_gid) == -1) { + FormatFatalSystemError("Failed to set group %d", + (int)user_gid); } #ifdef _BSD_SOURCE From 09a0803116e642be4e983d1d09295afc788f37ca Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sun, 29 Dec 2013 13:59:01 +0100 Subject: [PATCH 4/6] Daemon: fix typo in comment --- src/Daemon.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Daemon.cxx b/src/Daemon.cxx index 1623cca24..d40c49d5d 100644 --- a/src/Daemon.cxx +++ b/src/Daemon.cxx @@ -113,7 +113,7 @@ daemonize_set_user(void) } #ifdef _BSD_SOURCE - /* init suplementary groups + /* init supplementary groups * (must be done before we change our uid) */ if (!had_group && initgroups(user_name, user_gid) == -1) { From e30b356eb018adcfb3efbce97c81bc0d99934826 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sun, 29 Dec 2013 13:58:39 +0100 Subject: [PATCH 5/6] daemon: no initgroups() when already running as the configured user We can assume that initgroups() would be a no-op in that case, however initgroups() is not allowed for unprivileged users anyway. --- NEWS | 2 ++ src/Daemon.cxx | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 50eb77686..2c145191e 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,6 @@ ver 0.18.7 (not yet released) +* daemon: don't initialize supplementary groups when already running + as the configured user ver 0.18.6 (2013/12/24) * input diff --git a/src/Daemon.cxx b/src/Daemon.cxx index d40c49d5d..557c47777 100644 --- a/src/Daemon.cxx +++ b/src/Daemon.cxx @@ -116,7 +116,11 @@ daemonize_set_user(void) /* init supplementary groups * (must be done before we change our uid) */ - if (!had_group && initgroups(user_name, user_gid) == -1) { + if (!had_group && + /* no need to set the new user's supplementary groups if + we are already this user */ + user_uid != getuid() && + initgroups(user_name, user_gid) == -1) { FormatFatalSystemError("Failed to set supplementary groups " "of user \"%s\"", user_name); From d7f80eab68b5cb0d2aa90e67fa2bb04b1bbef975 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sun, 29 Dec 2013 14:12:33 +0100 Subject: [PATCH 6/6] configure.ac: improved check for libyajl 1.0 If we have libyajl 2.0.1 (without a pkg-config file), our configure.ac would assume this is the libyajl 1.0 API, because the function yajl_alloc() exists in both. This commit changes the library check to the function yajl_parse_complete() which was removed in the 2.0 API. This fixes build failure with libyajl 2.0.1. --- NEWS | 2 ++ configure.ac | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 2c145191e..41a44e05e 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,6 @@ ver 0.18.7 (not yet released) +* playlist + - soundcloud: fix build failure with libyajl 2.0.1 * daemon: don't initialize supplementary groups when already running as the configured user diff --git a/configure.ac b/configure.ac index 9909cb461..b2e952808 100644 --- a/configure.ac +++ b/configure.ac @@ -732,7 +732,7 @@ dnl --------------------------------- Soundcloud ------------------------------ if test x$enable_soundcloud != xno; then PKG_CHECK_MODULES([YAJL], [yajl >= 2.0], [found_soundcloud=yes], - AC_CHECK_LIB([yajl], [yajl_alloc], + AC_CHECK_LIB([yajl], [yajl_parse_complete], [found_soundcloud=yes YAJL_CFLAGS=-DHAVE_YAJL1 YAJL_LIBS=-lyajl], [found_soundcloud=no])) fi