public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/gentoo:master commit in: app-misc/beep/, app-misc/beep/files/
@ 2016-04-18 21:23 Patrice Clement
  0 siblings, 0 replies; 2+ messages in thread
From: Patrice Clement @ 2016-04-18 21:23 UTC (permalink / raw
  To: gentoo-commits

commit:     249a138290c290504b38a983eeb64fefccae69ab
Author:     Patrice Clement <monsieurp <AT> gentoo <DOT> org>
AuthorDate: Mon Apr 18 21:02:26 2016 +0000
Commit:     Patrice Clement <monsieurp <AT> gentoo <DOT> org>
CommitDate: Mon Apr 18 21:08:31 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=249a1382

app-misc/beep: Clean up old.

Package-Manager: portage-2.2.26

 app-misc/beep/Manifest                      |  1 -
 app-misc/beep/beep-1.2.2-r1.ebuild          | 27 -----------------------
 app-misc/beep/files/beep-1.2.2-nosuid.patch | 33 -----------------------------
 3 files changed, 61 deletions(-)

diff --git a/app-misc/beep/Manifest b/app-misc/beep/Manifest
index 2df976f..85c425a 100644
--- a/app-misc/beep/Manifest
+++ b/app-misc/beep/Manifest
@@ -1,2 +1 @@
-DIST beep-1.2.2.tar.gz 18460 SHA256 5c0445dac43950b7c7c3f235c6fb21f620ab3fd2f3aafaf09896e5730fcf49a1 SHA512 85e2288fc01322ad2b9ad59063ee61cc94edc6b712ef1af2f86bd7e52e08cfaa81a4d8aafd729791eb3e776dbaf8fff7298ccafb758a716a3bdc9a3c385a38e1 WHIRLPOOL 845899b7f2122128833bb0b23a4eb2df576e6239e1c6df80f1abc1d1b5fddb8e80e5a500ba7bfc9638e69e5d2366aea5afdcd15c86d71304c6afe8ba1cf12868
 DIST beep-1.3.tar.gz 19344 SHA256 59acef7a987de5557cefd1a904666cc2691f132929af39e65450b182a581ec2d SHA512 3f71146202208fa0c0cda360d125dd972ea003cf8cd62da21d67eb544c92f7b82640e7ce7c3835cbc65c75909a882edfa54dbd8d8b748d6f243711ea331477fd WHIRLPOOL 23ddc6e456803b82bf84b1022e5eed39488db6f4cd4410e77e55545b3e4c6256979dfc5587367c8206ea069ac4fedc4d5fa81406ea66c6c0c79fb9b428c339c7

diff --git a/app-misc/beep/beep-1.2.2-r1.ebuild b/app-misc/beep/beep-1.2.2-r1.ebuild
deleted file mode 100644
index 3a1cf30..0000000
--- a/app-misc/beep/beep-1.2.2-r1.ebuild
+++ /dev/null
@@ -1,27 +0,0 @@
-# Copyright 1999-2009 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Id$
-
-inherit eutils base toolchain-funcs
-
-DESCRIPTION="The advanced PC speaker beeper"
-HOMEPAGE="http://www.johnath.com/beep/"
-SRC_URI="mirror://gentoo/${P}.tar.gz http://www.johnath.com/beep/${P}.tar.gz"
-
-LICENSE="GPL-2"
-SLOT="0"
-KEYWORDS="alpha amd64 arm ppc ppc64 sparc x86"
-IUSE=""
-
-PATCHES=( ${FILESDIR}/${P}-{Makefile,nosuid}.patch )
-
-pkg_setup() {
-	tc-export CC
-}
-
-src_install() {
-	dobin beep
-	fperms 0711 /usr/bin/beep
-	doman beep.1.gz
-	dodoc CHANGELOG CREDITS README
-}

diff --git a/app-misc/beep/files/beep-1.2.2-nosuid.patch b/app-misc/beep/files/beep-1.2.2-nosuid.patch
deleted file mode 100644
index 33e6aff..0000000
--- a/app-misc/beep/files/beep-1.2.2-nosuid.patch
+++ /dev/null
@@ -1,33 +0,0 @@
---- beep.c.orig	2005-07-23 13:37:01.000000000 -0400
-+++ beep.c	2005-07-23 14:00:55.000000000 -0400
-@@ -218,22 +218,20 @@
-   int i; /* loop counter */
- 
-   /* try to snag the console */
--  if((console_fd = open("/dev/console", O_WRONLY)) == -1) {
--    fprintf(stderr, "Could not open /dev/console for writing.\n");
--    printf("\a");  /* Output the only beep we can, in an effort to fall back on usefulness */
--    perror("open");
--    exit(1);
--  }
-+  console_fd = open("/dev/console", O_WRONLY);
-   
-   /* Beep */
-   for (i = 0; i < parms.reps; i++) {                    /* start beep */
--    if(ioctl(console_fd, KIOCSOUND, (int)(CLOCK_TICK_RATE/parms.freq)) < 0) {
--      printf("\a");  /* Output the only beep we can, in an effort to fall back on usefulness */
--      perror("ioctl");
-+    if (console_fd >= 0) {
-+      ioctl(console_fd, KIOCSOUND, (int)(CLOCK_TICK_RATE/parms.freq));
-+    } else {
-+      printf("\a");  /* Output the fall back for usefulness we don't have to be suid to work at all */
-+      fflush(stdout);
-     }
-     /* Look ma, I'm not ansi C compatible! */
-     usleep(1000*parms.length);                          /* wait...    */
--    ioctl(console_fd, KIOCSOUND, 0);                    /* stop beep  */
-+    if (console_fd >= 0) 
-+       ioctl(console_fd, KIOCSOUND, 0);                 /* stop beep  */
-     if(parms.end_delay || (i+1 < parms.reps))
-        usleep(1000*parms.delay);                        /* wait...    */
-   }                                                     /* repeat.    */


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: app-misc/beep/, app-misc/beep/files/
@ 2018-04-04 20:35 Patrice Clement
  0 siblings, 0 replies; 2+ messages in thread
From: Patrice Clement @ 2018-04-04 20:35 UTC (permalink / raw
  To: gentoo-commits

commit:     5945809cd0c40e44313891742b0b61f90eecbfb8
Author:     Patrice Clement <monsieurp <AT> gentoo <DOT> org>
AuthorDate: Wed Apr  4 20:34:21 2018 +0000
Commit:     Patrice Clement <monsieurp <AT> gentoo <DOT> org>
CommitDate: Wed Apr  4 20:35:17 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5945809c

app-misc/beep: patch against CVE-2018-0292.

Bug: https://bugs.gentoo.org/652330
See-Also: https://github.com/johnath/beep/issues/11
Package-Manager: Portage-2.3.19, Repoman-2.3.6

 app-misc/beep/beep-1.3-r3.ebuild                 |  37 ++++++++
 app-misc/beep/files/beep-1.3-CVE-2018-0492.patch | 106 +++++++++++++++++++++++
 2 files changed, 143 insertions(+)

diff --git a/app-misc/beep/beep-1.3-r3.ebuild b/app-misc/beep/beep-1.3-r3.ebuild
new file mode 100644
index 00000000000..1b0a27d17f4
--- /dev/null
+++ b/app-misc/beep/beep-1.3-r3.ebuild
@@ -0,0 +1,37 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+inherit toolchain-funcs
+
+DESCRIPTION="The advanced PC speaker beeper"
+HOMEPAGE="http://www.johnath.com/beep"
+SRC_URI="http://www.johnath.com/beep/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~ppc ~ppc64 ~sparc ~x86"
+IUSE="suid"
+
+PATCHES=(
+	"${FILESDIR}/${P}-Makefile.patch"
+	"${FILESDIR}/${P}-CVE-2018-0492.patch"
+)
+
+pkg_setup() {
+	tc-export CC
+}
+
+src_install() {
+	dobin beep
+	if use suid; then
+		fowners :audio /usr/bin/beep
+		fperms 4710 /usr/bin/beep
+	else
+		fperms 0711 /usr/bin/beep
+	fi
+	unpack "./${PN}.1.gz"
+	doman "${PN}.1"
+	einstalldocs
+}

diff --git a/app-misc/beep/files/beep-1.3-CVE-2018-0492.patch b/app-misc/beep/files/beep-1.3-CVE-2018-0492.patch
new file mode 100644
index 00000000000..f4894b51fc8
--- /dev/null
+++ b/app-misc/beep/files/beep-1.3-CVE-2018-0492.patch
@@ -0,0 +1,106 @@
+diff --git a/beep.c b/beep.c
+index 7da2e70..4323d31 100644
+--- beep.c
++++ beep.c
+@@ -109,6 +109,7 @@ void do_beep(int freq) {
+      /* BEEP_TYPE_EVDEV */
+      struct input_event e;
+ 
++     memset(&e, 0, sizeof(e));
+      e.type = EV_SND;
+      e.code = SND_TONE;
+      e.value = freq;
+@@ -124,10 +125,6 @@ void do_beep(int freq) {
+ /* If we get interrupted, it would be nice to not leave the speaker beeping in
+    perpetuity. */
+ void handle_signal(int signum) {
+-
+-  if(console_device)
+-    free(console_device);
+-
+   switch(signum) {
+   case SIGINT:
+   case SIGTERM:
+@@ -257,7 +254,7 @@ void parse_command_line(int argc, char **argv, beep_parms_t *result) {
+       result->verbose = 1;
+       break;
+     case 'e' : /* also --device */
+-      console_device = strdup(optarg);
++      console_device = optarg;
+       break;
+     case 'h' : /* notice that this is also --help */
+     default :
+@@ -276,26 +273,6 @@ void play_beep(beep_parms_t parms) {
+ 	"%d delay after) @ %.2f Hz\n",
+ 	parms.reps, parms.length, parms.delay, parms.end_delay, parms.freq);
+ 
+-  /* try to snag the console */
+-  if(console_device)
+-    console_fd = open(console_device, O_WRONLY);
+-  else
+-    if((console_fd = open("/dev/tty0", O_WRONLY)) == -1)
+-      console_fd = open("/dev/vc/0", O_WRONLY);
+-
+-  if(console_fd == -1) {
+-    fprintf(stderr, "Could not open %s for writing\n",
+-      console_device != NULL ? console_device : "/dev/tty0 or /dev/vc/0");
+-    printf("\a");  /* Output the only beep we can, in an effort to fall back on usefulness */
+-    perror("open");
+-    exit(1);
+-  }
+-
+-  if (ioctl(console_fd, EVIOCGSND(0)) != -1)
+-    console_type = BEEP_TYPE_EVDEV;
+-  else
+-    console_type = BEEP_TYPE_CONSOLE;
+-  
+   /* Beep */
+   for (i = 0; i < parms.reps; i++) {                    /* start beep */
+     do_beep(parms.freq);
+@@ -305,8 +282,6 @@ void play_beep(beep_parms_t parms) {
+     if(parms.end_delay || (i+1 < parms.reps))
+        usleep(1000*parms.delay);                        /* wait...    */
+   }                                                     /* repeat.    */
+-
+-  close(console_fd);
+ }
+ 
+ 
+@@ -328,6 +303,26 @@ int main(int argc, char **argv) {
+   signal(SIGTERM, handle_signal);
+   parse_command_line(argc, argv, parms);
+ 
++  /* try to snag the console */
++  if(console_device)
++    console_fd = open(console_device, O_WRONLY);
++  else
++    if((console_fd = open("/dev/tty0", O_WRONLY)) == -1)
++      console_fd = open("/dev/vc/0", O_WRONLY);
++
++  if(console_fd == -1) {
++    fprintf(stderr, "Could not open %s for writing\n",
++      console_device != NULL ? console_device : "/dev/tty0 or /dev/vc/0");
++    printf("\a");  /* Output the only beep we can, in an effort to fall back on usefulness */
++    perror("open");
++    exit(1);
++  }
++
++  if (ioctl(console_fd, EVIOCGSND(0)) != -1)
++    console_type = BEEP_TYPE_EVDEV;
++  else
++    console_type = BEEP_TYPE_CONSOLE;
++
+   /* this outermost while loop handles the possibility that -n/--new has been
+      used, i.e. that we have multiple beeps specified. Each iteration will
+      play, then free() one parms instance. */
+@@ -365,8 +360,8 @@ int main(int argc, char **argv) {
+     parms = next;
+   }
+ 
+-  if(console_device)
+-    free(console_device);
++  close(console_fd);
++  console_fd = -1;
+ 
+   return EXIT_SUCCESS;
+ }


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-04-04 20:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-18 21:23 [gentoo-commits] repo/gentoo:master commit in: app-misc/beep/, app-misc/beep/files/ Patrice Clement
  -- strict thread matches above, loose matches on Subject: below --
2018-04-04 20:35 Patrice Clement

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox