The branch, stable has been updated
via 4f5bfb5f777f859cdad0757adfb0d662a361a673 (commit)
via fb08b88f65d57baa742f33e8e6ec36a772fe801a (commit)
via 00f6e12340ad050e96f9126dfe328f7f3c9fb128 (commit)
via 2a7fb2bfef928c26a137e4649793feac79ec00b1 (commit)
from aa398d55bd6e6348c60192fa8f585793b24c867c (commit)
- Shortlog ------------------------------------------------------------
4f5bfb5 Release 1.14.16.3
fb08b88 s-s-d: Fix timeout computations for --retry option
00f6e12 s-s-d: Fix segfault when using --group w/o --chuid
2a7fb2b s-s-d: Properly set the supplementary groups on --chuid
Summary of changes:
ChangeLog | 27 ++++++++++
configure.ac | 2 +-
debian/changelog | 15 +++++-
utils/start-stop-daemon.c | 123 +++++++++++++++++----------------------------
4 files changed, 88 insertions(+), 79 deletions(-)
-----------------------------------------------------------------------
Details of changes:
commit 4f5bfb5f777f859cdad0757adfb0d662a361a673
Author: Guillem Jover <[EMAIL PROTECTED]>
Date: Tue Jan 22 23:40:55 2008 +0200
Release 1.14.16.3
diff --git a/ChangeLog b/ChangeLog
index 0e75f1a..8fa8b72 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
2008-01-22 Guillem Jover <[EMAIL PROTECTED]>
+ * configure.ac: Release 1.14.16.3.
+
+2008-01-22 Guillem Jover <[EMAIL PROTECTED]>
+
* utils/start-stop-daemon.c (tvselector): Remove typedef.
(tvselector_sec): Remove function.
(tvselector_usec): Likewise.
diff --git a/configure.ac b/configure.ac
index 4692f5b..00b1d62 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,7 +1,7 @@
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.59)
-AC_INIT([dpkg], [1.14.16.2], [EMAIL PROTECTED])
+AC_INIT([dpkg], [1.14.16.3], [EMAIL PROTECTED])
AC_CONFIG_SRCDIR([lib/dpkg.h])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_AUX_DIR([config])
diff --git a/debian/changelog b/debian/changelog
index c165a3b..e9e95b0 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,4 +1,4 @@
-dpkg (1.14.16.3) UNRELEASED; urgency=low
+dpkg (1.14.16.3) unstable; urgency=low
[ Raphael Hertzog ]
* Remove the ":utf8" layer that utf8-encodes already valid utf8.
@@ -15,7 +15,7 @@ dpkg (1.14.16.3) UNRELEASED; urgency=low
not worked properly for a long time (maybe never), but came to light
due to #460903's fix. Closes: #462104
- -- Raphael Hertzog <[EMAIL PROTECTED]> Tue, 22 Jan 2008 18:15:42 +0100
+ -- Guillem Jover <[EMAIL PROTECTED]> Tue, 22 Jan 2008 23:39:59 +0200
dpkg (1.14.16.2) unstable; urgency=low
commit fb08b88f65d57baa742f33e8e6ec36a772fe801a
Author: Guillem Jover <[EMAIL PROTECTED]>
Date: Tue Jan 22 23:36:06 2008 +0200
s-s-d: Fix timeout computations for --retry option
This has not worked properly for a long time (maybe never), but came to
light due to #460903's fix. Closes: #462104
diff --git a/ChangeLog b/ChangeLog
index c9ca1a8..0e75f1a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,17 @@
2008-01-22 Guillem Jover <[EMAIL PROTECTED]>
+ * utils/start-stop-daemon.c (tvselector): Remove typedef.
+ (tvselector_sec): Remove function.
+ (tvselector_usec): Likewise.
+ (TVCALC_ELEM): Remove macro.
+ (TVCALC): Likewise.
+ (tsub): New function.
+ (tmul): Likewise.
+ (run_stop_schedule): Use tsub and tmul instead of TVCALC. Make sure
+ the time is not negative.
+
+2008-01-22 Guillem Jover <[EMAIL PROTECTED]>
+
* utils/start-stop-daemon.c (main): Only call initgroups if changeuser
is not NULL.
diff --git a/debian/changelog b/debian/changelog
index 6e689a4..c165a3b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -11,6 +11,9 @@ dpkg (1.14.16.3) UNRELEASED; urgency=low
* Fix segfault in start-stop-daemon when using --group w/o --chuid (as
a side effect, using --group alone works for the first time in years).
Closes: #462072
+ * Fix timeout computations for start-stop-daemon --retry option. This has
+ not worked properly for a long time (maybe never), but came to light
+ due to #460903's fix. Closes: #462104
-- Raphael Hertzog <[EMAIL PROTECTED]> Tue, 22 Jan 2008 18:15:42 +0100
diff --git a/utils/start-stop-daemon.c b/utils/start-stop-daemon.c
index ef9b417..79d07c3 100644
--- a/utils/start-stop-daemon.c
+++ b/utils/start-stop-daemon.c
@@ -185,48 +185,6 @@ static void fatal(const char *format, ...)
static void badusage(const char *msg)
NONRETURNING;
-/* This next part serves only to construct the TVCALC macro, which
- * is used for doing arithmetic on struct timeval's. It works like this:
- * TVCALC(result, expression);
- * where result is a struct timeval (and must be an lvalue) and
- * expression is the single expression for both components. In this
- * expression you can use the special values TVELEM, which when fed a
- * const struct timeval* gives you the relevant component, and
- * TVADJUST. TVADJUST is necessary when subtracting timevals, to make
- * it easier to renormalise. Whenver you subtract timeval elements,
- * you must make sure that TVADJUST is added to the result of the
- * subtraction (before any resulting multiplication or what have you).
- * TVELEM must be linear in TVADJUST.
- */
-typedef long tvselector(const struct timeval*);
-
-static long
-tvselector_sec(const struct timeval *tv)
-{
- return tv->tv_sec;
-}
-
-static long
-tvselector_usec(const struct timeval *tv)
-{
- return tv->tv_usec;
-}
-
-#define TVCALC_ELEM(result, expr, sec, adj) \
-{ \
- const long TVADJUST = adj; \
- long (*const TVELEM)(const struct timeval *) = tvselector_##sec; \
- (result).tv_##sec = (expr); \
-}
-#define TVCALC(result, expr) \
-do { \
- TVCALC_ELEM(result, expr, sec, (-1)); \
- TVCALC_ELEM(result, expr, usec, (+1000000)); \
- (result).tv_sec += (result).tv_usec / 1000000; \
- (result).tv_usec %= 1000000; \
-} while (0)
-
-
static void
fatal(const char *format, ...)
{
@@ -257,6 +215,29 @@ xgettimeofday(struct timeval *tv)
if (gettimeofday(tv, NULL) != 0)
fatal("gettimeofday failed: %s", strerror(errno));
}
+
+static void
+tsub(struct timeval *r, struct timeval *a, struct timeval *b)
+{
+ r->tv_sec = (time_t)(a->tv_sec - b->tv_sec);
+ r->tv_usec = (suseconds_t)(a->tv_usec - b->tv_usec);
+ if (r->tv_usec < 0) {
+ --r->tv_sec;
+ r->tv_usec += 1000000;
+ }
+}
+
+static void
+tmul(struct timeval *a, int b)
+{
+ a->tv_sec *= b;
+ a->tv_usec *= b;
+ if (a->tv_usec >= 1000000) {
+ ++a->tv_sec;
+ a->tv_usec -= 1000000;
+ }
+}
+
static long
get_open_fd_max(void)
{
@@ -1219,10 +1200,12 @@ run_stop_schedule(void)
if (ratio < 10)
ratio++;
- TVCALC(interval, TVELEM(&after) * ratio -
- TVELEM(&before) + TVADJUST);
- TVCALC(maxinterval, TVELEM(&stopat) -
- TVELEM(&after) + TVADJUST);
+ tsub(&maxinterval, &stopat, &after);
+ tsub(&interval, &after, &before);
+ tmul(&interval, ratio);
+
+ if (interval.tv_sec < 0 || interval.tv_usec < 0)
+ interval.tv_sec = interval.tv_usec = 0;
if (timercmp(&interval, &maxinterval, >))
interval = maxinterval;
commit 00f6e12340ad050e96f9126dfe328f7f3c9fb128
Author: Guillem Jover <[EMAIL PROTECTED]>
Date: Tue Jan 22 21:43:35 2008 +0200
s-s-d: Fix segfault when using --group w/o --chuid
As a side effect, using --group alone works for the first time in years.
Closes: #462072
diff --git a/ChangeLog b/ChangeLog
index 245df37..c9ca1a8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2008-01-22 Guillem Jover <[EMAIL PROTECTED]>
+ * utils/start-stop-daemon.c (main): Only call initgroups if changeuser
+ is not NULL.
+
+2008-01-22 Guillem Jover <[EMAIL PROTECTED]>
+
* utils/start-stop-daemon.c (gid_in_current_groups): Remove function.
(main): Call initgroups if the real user or group are different than
the ones we should switch to. Call setgid before initgroups.
diff --git a/debian/changelog b/debian/changelog
index dbea147..6e689a4 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -8,6 +8,9 @@ dpkg (1.14.16.3) UNRELEASED; urgency=low
[ Guillem Jover ]
* Make start-stop-daemon set the supplementary groups if the real user or
group are different than the ones we should switch to. Closes: #462075
+ * Fix segfault in start-stop-daemon when using --group w/o --chuid (as
+ a side effect, using --group alone works for the first time in years).
+ Closes: #462072
-- Raphael Hertzog <[EMAIL PROTECTED]> Tue, 22 Jan 2008 18:15:42 +0100
diff --git a/utils/start-stop-daemon.c b/utils/start-stop-daemon.c
index a59e240..ef9b417 100644
--- a/utils/start-stop-daemon.c
+++ b/utils/start-stop-daemon.c
@@ -1400,7 +1400,8 @@ main(int argc, char **argv)
if (rgid != (gid_t)runas_gid)
if (setgid(runas_gid))
fatal("Unable to set gid to %d", runas_gid);
-
+ }
+ if (changeuser != NULL) {
/* We assume that if our real user and group are the same as
* the ones we should switch to, the supplementary groups
* will be already in place. */
@@ -1408,8 +1409,7 @@ main(int argc, char **argv)
if (initgroups(changeuser, runas_gid))
fatal("Unable to set initgroups() with gid %d",
runas_gid);
- }
- if (changeuser != NULL) {
+
if (ruid != (uid_t)runas_uid)
if (setuid(runas_uid))
fatal("Unable to set uid to %s", changeuser);
commit 2a7fb2bfef928c26a137e4649793feac79ec00b1
Author: Guillem Jover <[EMAIL PROTECTED]>
Date: Tue Jan 22 21:20:49 2008 +0200
s-s-d: Properly set the supplementary groups on --chuid
Set the supplementary groups if the real user or group are different than
the ones we should switch to.
Closes: #462075
diff --git a/ChangeLog b/ChangeLog
index c7f8e28..245df37 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2008-01-22 Guillem Jover <[EMAIL PROTECTED]>
+
+ * utils/start-stop-daemon.c (gid_in_current_groups): Remove function.
+ (main): Call initgroups if the real user or group are different than
+ the ones we should switch to. Call setgid before initgroups.
+
2008-01-22 Raphael Hertzog <[EMAIL PROTECTED]>
* scripts/dpkg-genchanges.pl, scripts/dpkg-gencontrol.pl,
diff --git a/debian/changelog b/debian/changelog
index d9e897c..dbea147 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,9 +1,14 @@
dpkg (1.14.16.3) UNRELEASED; urgency=low
+ [ Raphael Hertzog ]
* Remove the ":utf8" layer that utf8-encodes already valid utf8.
Closes: #462098
* Disable variable substitution in dpkg-genchanges. Closes: #462079, #462089
+ [ Guillem Jover ]
+ * Make start-stop-daemon set the supplementary groups if the real user or
+ group are different than the ones we should switch to. Closes: #462075
+
-- Raphael Hertzog <[EMAIL PROTECTED]> Tue, 22 Jan 2008 18:15:42 +0100
dpkg (1.14.16.2) unstable; urgency=low
diff --git a/utils/start-stop-daemon.c b/utils/start-stop-daemon.c
index 2a31f73..a59e240 100644
--- a/utils/start-stop-daemon.c
+++ b/utils/start-stop-daemon.c
@@ -322,27 +322,6 @@ clear(struct pid_list **list)
*list = NULL;
}
-static int
-gid_in_current_groups(gid_t gid)
-{
- gid_t *gids;
- int i, ngroups;
-
- ngroups = getgroups(0, NULL);
- gids = xmalloc(ngroups * sizeof(gid_t));
- getgroups(ngroups, gids);
-
- for (i = 0; i < ngroups; i++) {
- if (gid == gids[i]) {
- free(gids);
- return 1;
- }
- }
-
- free(gids);
- return 0;
-}
-
static void
do_help(void)
{
@@ -1285,6 +1264,8 @@ int
main(int argc, char **argv)
{
int devnull_fd = -1;
+ gid_t rgid;
+ uid_t ruid;
#ifdef HAVE_TIOCNOTTY
int tty_fd = -1;
#endif
@@ -1413,18 +1394,25 @@ main(int argc, char **argv)
if (chdir(changedir) < 0)
fatal("Unable to chdir() to %s", changedir);
- if (changegroup != NULL && *changegroup != '\0' &&
- getgid() != (gid_t)runas_gid) {
- if (!gid_in_current_groups(runas_gid))
+ rgid = getgid();
+ ruid = getuid();
+ if (changegroup != NULL) {
+ if (rgid != (gid_t)runas_gid)
+ if (setgid(runas_gid))
+ fatal("Unable to set gid to %d", runas_gid);
+
+ /* We assume that if our real user and group are the same as
+ * the ones we should switch to, the supplementary groups
+ * will be already in place. */
+ if (rgid != (gid_t)runas_gid || ruid != (uid_t)runas_uid)
if (initgroups(changeuser, runas_gid))
fatal("Unable to set initgroups() with gid %d",
runas_gid);
- if (setgid(runas_gid))
- fatal("Unable to set gid to %d", runas_gid);
}
- if (changeuser != NULL && getuid() != (uid_t)runas_uid) {
- if (setuid(runas_uid))
- fatal("Unable to set uid to %s", changeuser);
+ if (changeuser != NULL) {
+ if (ruid != (uid_t)runas_uid)
+ if (setuid(runas_uid))
+ fatal("Unable to set uid to %s", changeuser);
}
if (background) {
--
dpkg's main repository
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]