diff options
author | nia <nia@pkgsrc.org> | 2021-03-30 12:01:04 +0000 |
---|---|---|
committer | nia <nia@pkgsrc.org> | 2021-03-30 12:01:04 +0000 |
commit | 25740f1dee2cec5f9f671c15cd6e382e9202af97 (patch) | |
tree | c45513211abf1b02e2748ab23e7e4cfa143c8669 | |
parent | 1503d4bea4e75d622dd1133b1d3a69c470d01ec8 (diff) | |
download | pkgsrc-25740f1dee2cec5f9f671c15cd6e382e9202af97.tar.gz |
Revive audio/rtunes.
We fixed the undefined behaviour and made it work with openssl-1.1.
-rw-r--r-- | audio/Makefile | 3 | ||||
-rw-r--r-- | audio/rtunes/DESCR | 4 | ||||
-rw-r--r-- | audio/rtunes/Makefile | 30 | ||||
-rw-r--r-- | audio/rtunes/PLIST | 4 | ||||
-rw-r--r-- | audio/rtunes/distinfo | 12 | ||||
-rw-r--r-- | audio/rtunes/patches/patch-rtunes_Makefile | 29 | ||||
-rw-r--r-- | audio/rtunes/patches/patch-rtunes_cipher.c | 68 | ||||
-rw-r--r-- | audio/rtunes/patches/patch-rtunes_parse.y | 21 | ||||
-rw-r--r-- | audio/rtunes/patches/patch-rtunes_rtsp.c | 33 | ||||
-rw-r--r-- | audio/rtunes/patches/patch-rtunes_rtunes.1 | 67 | ||||
-rw-r--r-- | audio/rtunes/patches/patch-rtunes_rtunes.c | 88 |
11 files changed, 358 insertions, 1 deletions
diff --git a/audio/Makefile b/audio/Makefile index 200426d0699..77e95946a16 100644 --- a/audio/Makefile +++ b/audio/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.624 2021/02/18 16:38:26 nia Exp $ +# $NetBSD: Makefile,v 1.625 2021/03/30 12:01:04 nia Exp $ # COMMENT= Audio tools, players, and libraries @@ -411,6 +411,7 @@ SUBDIR+= rhythmbox SUBDIR+= rip SUBDIR+= rosegarden SUBDIR+= rsynth +SUBDIR+= rtunes SUBDIR+= rubberband SUBDIR+= ruby-mp3info SUBDIR+= ruby-taglib diff --git a/audio/rtunes/DESCR b/audio/rtunes/DESCR new file mode 100644 index 00000000000..b095c53145e --- /dev/null +++ b/audio/rtunes/DESCR @@ -0,0 +1,4 @@ +rtunes streams audio to an AirTunes compatible receivers. + +This is a fork of rtunes 0.8, to fix compilation issues on modern systems +(e.g. support newer OpenSSL versions) diff --git a/audio/rtunes/Makefile b/audio/rtunes/Makefile new file mode 100644 index 00000000000..1c24d81b1f7 --- /dev/null +++ b/audio/rtunes/Makefile @@ -0,0 +1,30 @@ +# $NetBSD: Makefile,v 1.14 2021/03/30 12:01:04 nia Exp $ + +DISTNAME= rtunes-0.8 +CATEGORIES= audio +MASTER_SITES= http://www.nazgul.ch/dev/ + +MAINTAINER= nia@NetBSD.org +HOMEPAGE= http://www.nazgul.ch/dev_rtunes.html +COMMENT= Stream audio to an AirTunes device +LICENSE= modified-bsd + +BUILD_DIRS= rtunes +INSTALL_DIRS= rtunes + +MAKE_FLAGS+= NOGCCERROR=1 +MAKE_FLAGS+= NOCLANGERROR=1 + +USE_BSD_MAKEFILE= yes + +INSTALLATION_DIRS+= bin +INSTALLATION_DIRS+= ${PKGMANDIR}/man1 +INSTALLATION_DIRS+= ${PKGMANDIR}/man5 + +.include "../../mk/bsd.prefs.mk" +.if ${OPSYS} != "NetBSD" && ${OPSYS} != "OpenBSD" +LDFLAGS+= -lbsd +. include "../../devel/libbsd/buildlink3.mk" +.endif +.include "../../security/openssl/buildlink3.mk" +.include "../../mk/bsd.pkg.mk" diff --git a/audio/rtunes/PLIST b/audio/rtunes/PLIST new file mode 100644 index 00000000000..091c3a455b3 --- /dev/null +++ b/audio/rtunes/PLIST @@ -0,0 +1,4 @@ +@comment $NetBSD: PLIST,v 1.4 2021/03/30 12:01:04 nia Exp $ +bin/rtunes +man/man1/rtunes.1 +man/man5/rtunes.conf.5 diff --git a/audio/rtunes/distinfo b/audio/rtunes/distinfo new file mode 100644 index 00000000000..c1d9dcfe960 --- /dev/null +++ b/audio/rtunes/distinfo @@ -0,0 +1,12 @@ +$NetBSD: distinfo,v 1.8 2021/03/30 12:01:04 nia Exp $ + +SHA1 (rtunes-0.8.tar.gz) = 16830fbdceaf2d70943113ee427ad9eeeddaed14 +RMD160 (rtunes-0.8.tar.gz) = 725b454b9c0f7d7b1170d8c89ec70536cd86d0ae +SHA512 (rtunes-0.8.tar.gz) = 8e540b66c16d4a5f745999ceb6c07853dccf8270b5e5650cf3c21297dd45add3583ee0e866b27fb7082a279375b4be95f301ff1157e455a7d959b60f9a30a924 +Size (rtunes-0.8.tar.gz) = 21636 bytes +SHA1 (patch-rtunes_Makefile) = f46e906afff59ad0f31817c0a87c622f37fa0597 +SHA1 (patch-rtunes_cipher.c) = 9b55b4f5fd0e48ba9039f52f2925bd1005e9a68b +SHA1 (patch-rtunes_parse.y) = 76294edfb4d0c56cb08189578d7fe9991c533cb3 +SHA1 (patch-rtunes_rtsp.c) = ab8f8bf845258b9a994e02195fe65ce9ceba2c07 +SHA1 (patch-rtunes_rtunes.1) = c3d64a8c671dac0fdf1cd87ccbc562f2fb0d446e +SHA1 (patch-rtunes_rtunes.c) = 0a177c985c642b9b1cfa122aa9ff67b5e54f5038 diff --git a/audio/rtunes/patches/patch-rtunes_Makefile b/audio/rtunes/patches/patch-rtunes_Makefile new file mode 100644 index 00000000000..06426998d02 --- /dev/null +++ b/audio/rtunes/patches/patch-rtunes_Makefile @@ -0,0 +1,29 @@ +$NetBSD: patch-rtunes_Makefile,v 1.1 2021/03/30 12:01:04 nia Exp $ + +Merge fixes from https://github.com/erincandescent/rtunes + +--- rtunes/Makefile.orig 2009-06-27 10:10:32.000000000 +0000 ++++ rtunes/Makefile +@@ -10,22 +10,12 @@ SRCS+= y.tab.h + y.tab.h: parse.y + .endif + +-.if ${OS} == "NetBSD" +-VPATH= ../libbsd +-SRCS+= strtonum.c +-.endif +- + CFLAGS+= -Wall -Wstrict-prototypes -ansi + LDADD+= -lcrypto + LINTFLAGS+= -u + + CLEANFILES+= y.tab.h + +-PIPE= -pipe +- + MAN= rtunes.1 rtunes.conf.5 +-MANDIR= /usr/local/man/cat +- +-BINDIR= /usr/local/bin + + .include <bsd.prog.mk> diff --git a/audio/rtunes/patches/patch-rtunes_cipher.c b/audio/rtunes/patches/patch-rtunes_cipher.c new file mode 100644 index 00000000000..45550629718 --- /dev/null +++ b/audio/rtunes/patches/patch-rtunes_cipher.c @@ -0,0 +1,68 @@ +$NetBSD: patch-rtunes_cipher.c,v 1.1 2021/03/30 12:01:04 nia Exp $ + +Merge fixes from https://github.com/erincandescent/rtunes + +--- rtunes/cipher.c.orig 2009-06-27 10:10:32.000000000 +0000 ++++ rtunes/cipher.c +@@ -26,10 +26,6 @@ + #include "extern.h" + #include "proto.h" + +-#ifdef __linux__ +-#include "../libbsd/arc4random.h" +-#endif +- + /* + * cipher_ aes_sendsample() + * AES encrypt audio sample +@@ -62,7 +58,7 @@ cipher_aes_sendsample(unsigned char *buf + len_encrypt = len; + + /* prepend sample header */ +- memcpy(buf + 16, buf, len_encrypt); ++ memmove(buf + 16, buf, len_encrypt); + memcpy(buf, header, 16L); + /* write sample size into header */ + j = len_encrypt + 12; +@@ -122,15 +118,11 @@ cipher_rsa_encrypt_aeskey(unsigned char + + /* initialize RSA public key */ + key = RSA_new(); +- key->n = BN_bin2bn(n_bin, 256, key->n);; +- key->e = BN_bin2bn(e_bin, 3, key->e); +- key->d = NULL; +- key->p = NULL; +- key->q = NULL; +- key->dmp1 = NULL; +- key->dmq1 = NULL; +- key->iqmp = NULL; +- ++ RSA_set0_key(key, ++ BN_bin2bn(n_bin, 256, NULL), ++ BN_bin2bn(e_bin, 3, NULL), ++ NULL); ++ + /* RSA encrypt */ + to = malloc(256); + if (RSA_public_encrypt(16, aeskey, to, key, RSA_PKCS1_OAEP_PADDING) < 1) +@@ -150,18 +142,11 @@ cipher_rsa_encrypt_aeskey(unsigned char + unsigned char * + cipher_aes_generate_key(void) + { +- int i, v; + unsigned char *p = NULL; +- unsigned char key[16]; +- +- for (i = 0; i <= sizeof(key) - sizeof(v); i += sizeof(v)) { +- v = arc4random(); +- memcpy(&key[i], &v, sizeof(v)); +- } + + p = malloc(16); +- memcpy(p, key, 16); +- ++ RAND_bytes(p, 16); ++ + return (p); + } + diff --git a/audio/rtunes/patches/patch-rtunes_parse.y b/audio/rtunes/patches/patch-rtunes_parse.y new file mode 100644 index 00000000000..51bef2c73c5 --- /dev/null +++ b/audio/rtunes/patches/patch-rtunes_parse.y @@ -0,0 +1,21 @@ +$NetBSD: patch-rtunes_parse.y,v 1.3 2021/03/30 12:01:04 nia Exp $ + +Merge fixes from https://github.com/erincandescent/rtunes + +--- rtunes/parse.y.orig 2009-06-27 10:10:32.000000000 +0000 ++++ rtunes/parse.y +@@ -27,9 +27,13 @@ + #include <stdarg.h> + #include <stdint.h> + #include <stdio.h> ++#include <stdlib.h> + #include <string.h> + #include <syslog.h> +- ++#ifdef __linux__ ++#include <bsd/stdlib.h> ++#endif ++ + FILE *fin; + int lineno = 1; + int errors = 0; diff --git a/audio/rtunes/patches/patch-rtunes_rtsp.c b/audio/rtunes/patches/patch-rtunes_rtsp.c new file mode 100644 index 00000000000..d096c93385e --- /dev/null +++ b/audio/rtunes/patches/patch-rtunes_rtsp.c @@ -0,0 +1,33 @@ +$NetBSD: patch-rtunes_rtsp.c,v 1.1 2021/03/30 12:01:04 nia Exp $ + +Merge fixes from https://github.com/erincandescent/rtunes + +--- rtunes/rtsp.c.orig 2009-06-27 10:10:32.000000000 +0000 ++++ rtunes/rtsp.c +@@ -19,15 +19,14 @@ + #include <stdio.h> + #include <stdlib.h> + #include <string.h> ++#include <openssl/rand.h> + + #include "config.h" + #include "extern.h" + #include "proto.h" + + #ifdef __linux__ +-#include "../libbsd/strlcpy.h" +-#include "../libbsd/strlcat.h" +-#include "../libbsd/arc4random.h" ++#include "bsd/string.h" + #endif + + /* global vars local */ +@@ -48,7 +47,7 @@ rtsp_generate_sid(char *buf, int len) + int i = 0; + + while (i < 1000000000) +- i = arc4random(); ++ RAND_bytes((unsigned char*) &i, sizeof(i)); + + snprintf(buf, len, "%d", i); + diff --git a/audio/rtunes/patches/patch-rtunes_rtunes.1 b/audio/rtunes/patches/patch-rtunes_rtunes.1 new file mode 100644 index 00000000000..0d96204a075 --- /dev/null +++ b/audio/rtunes/patches/patch-rtunes_rtunes.1 @@ -0,0 +1,67 @@ +$NetBSD: patch-rtunes_rtunes.1,v 1.1 2021/03/30 12:01:04 nia Exp $ + +Merge fixes from https://github.com/erincandescent/rtunes + +--- rtunes/rtunes.1.orig 2009-06-26 14:43:09.000000000 +0000 ++++ rtunes/rtunes.1 +@@ -15,22 +15,23 @@ + .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + .\" +-.Dd Feb 10, 2008 ++.Dd March 24, 2021 + .Dt RTUNES 1 + .Os + .Sh NAME + .Nm rtunes +-.Nd Stream audio data to an Apple AirPort Express device ++.Nd Stream audio data to an Apple AirPlay device + .Sh SYNOPSIS + .Nm rtunes + .Op Fl 46 + .Op Fl f Ar configfile + .Op Fl h Ar host ++.Op Fl p Ar port + .Ar file(s) + .Sh DESCRIPTION + .Nm +-streams files containing Apple Lossless audio data to an Apple AirPort +-Express device. ++streams files containing Apple Lossless audio data to an Apple AirPlay ++device. + If a '-' is given as the + .Ar file(s) + argument, +@@ -40,7 +41,7 @@ and encodes it to the Apple Lossless for + With this method it is possible to stream audio data from any source + that can output raw PCM audio data on stdout, e.g.: + .Bd -literal -offset indent +-madplay -S -R44100 -o raw:- benson.mp3 | rtunes - ++mpg123 -o raw -r 44100 benson.mp3 | rtunes -h 10.69.69.147 -p 36666 - + .Ed + .Pp + Here the audio player madplay is used to decode benson.mp3 to raw PCM +@@ -56,17 +57,20 @@ Use only IPv6 transport. + .It Fl f + Specify an alternative configuration file. + .It Fl h +-Specify the hostname of device to stream audio to. ++Specify the hostname of the device to stream audio to. ++.It Fl p ++Specify the port of the device to stream audio to. ++.El + .Sh FILES + .Bl -tag -width "/etc/rtunes.confXX" -compact + .It Pa /etc/rtunes.conf + Default location of the configuration file. + .El ++.Sh SEE ALSO ++.Xr rtunes.conf 5 + .Sh AUTHORS + .Nm + was written by + .An Marcus Glocker Aq marcus@nazgul.ch + and + .An Marc Balmer Aq marc@msys.ch . +-.Sh SEE ALSO +-.Xr rtunes.conf 5 diff --git a/audio/rtunes/patches/patch-rtunes_rtunes.c b/audio/rtunes/patches/patch-rtunes_rtunes.c new file mode 100644 index 00000000000..9b767be49eb --- /dev/null +++ b/audio/rtunes/patches/patch-rtunes_rtunes.c @@ -0,0 +1,88 @@ +$NetBSD: patch-rtunes_rtunes.c,v 1.1 2021/03/30 12:01:04 nia Exp $ + +Merge fixes from https://github.com/erincandescent/rtunes + +--- rtunes/rtunes.c.orig 2008-02-10 11:51:02.000000000 +0000 ++++ rtunes/rtunes.c +@@ -25,8 +25,11 @@ + #include <signal.h> + #include <stdio.h> + #include <stdlib.h> ++#include <stdint.h> + #include <string.h> + #include <unistd.h> ++#include <endian.h> ++#include <errno.h> + + #include "config.h" + #include "extern.h" +@@ -65,7 +68,7 @@ usage(void) + { + extern char *__progname; + +- fprintf(stderr, "usage: %s [-46] [-f configfile] [-h host] <file(s)>\n", ++ fprintf(stderr, "usage: %s [-46] [-f configfile] [-h host] [-p port] <file(s)>\n", + __progname); + + exit(1); +@@ -175,7 +178,9 @@ main(int argc, char *argv[]) + { + size_t a, e; + ssize_t nread; +- int i, r, s, ch, fd, raw = 0, sample; ++ long parsedn; ++ int port = AIRPORT; ++ int i, r, ch, fd, raw = 0, sample; + char cwd[1024]; + unsigned char bufraw[4096 * 2 * 2], bufala[(4096 * 2 * 2) + 3]; + unsigned char *buf; +@@ -184,7 +189,7 @@ main(int argc, char *argv[]) + struct stsc *c; + + /* get command line options */ +- while ((ch = getopt(argc, argv, "46f:h:")) != -1) { ++ while ((ch = getopt(argc, argv, "46f:h:p:y")) != -1) { + switch (ch) { + case '4': + if (ai_family != PF_UNSPEC) +@@ -202,6 +207,13 @@ main(int argc, char *argv[]) + case 'h': + host = optarg; + break; ++ case 'p': ++ errno = 0; ++ parsedn = strtol(optarg, NULL, 0); ++ if (parsedn < 0 || parsedn > UINT16_MAX || errno != 0) ++ errx(1, "Invalid port number"); ++ port = (int)parsedn; ++ break; + default: + usage(); + } +@@ -220,7 +232,7 @@ main(int argc, char *argv[]) + errx(1, "Can't get local hosts IP address"); + + /* connect airport rtsp port */ +- if ((sfd_rtsp = sys_connect(host, AIRPORT)) == -1) ++ if ((sfd_rtsp = sys_connect(host, port)) == -1) + err(1, "Connect rtsp port"); + + /* rtsp connection sequence */ +@@ -325,7 +337,7 @@ main(int argc, char *argv[]) + + e = cipher_aes_sendsample(buf, nread); + +- s = sys_write(sfd_stream, buf, e); ++ (void)sys_write(sfd_stream, buf, e); + + free(buf); + } +@@ -354,7 +366,7 @@ main(int argc, char *argv[]) + + e = cipher_aes_sendsample(buf, a); + +- s = sys_write(sfd_stream, buf, e); ++ (void)sys_write(sfd_stream, buf, e); + + free(buf); + } |