diff options
-rw-r--r-- | testing/gpm/APKBUILD | 73 | ||||
-rw-r--r-- | testing/gpm/constify-format-strings.patch | 85 | ||||
-rw-r--r-- | testing/gpm/error-format.patch | 39 | ||||
-rw-r--r-- | testing/gpm/fix-highly-illegal-return-of-in-as-char.patch | 44 | ||||
-rw-r--r-- | testing/gpm/fix-signedness-issue.patch | 24 | ||||
-rw-r--r-- | testing/gpm/gpm.confd | 8 | ||||
-rw-r--r-- | testing/gpm/gpm.initd | 10 | ||||
-rw-r--r-- | testing/gpm/install-shared-libs-with-+x-perms.patch | 25 | ||||
-rw-r--r-- | testing/gpm/install-unversioned-solibrary.patch | 36 | ||||
-rw-r--r-- | testing/gpm/musl-fixes.patch | 64 |
10 files changed, 408 insertions, 0 deletions
diff --git a/testing/gpm/APKBUILD b/testing/gpm/APKBUILD new file mode 100644 index 0000000000..cee2ef3df3 --- /dev/null +++ b/testing/gpm/APKBUILD @@ -0,0 +1,73 @@ +# Contributor: Jeff Pohlmeyer <yetanothergeek@gmail.com> +# Maintainer: Natanael Copa <ncopa@alpinelinux.org> +pkgname=gpm +pkgver=1.20.7 +pkgrel=0 +pkgdesc="A mouse server for the console" +url="http://www.nico.schottelius.org/software/gpm/" +arch="all" +license="GPL-2.0" +depends="" +depends_dev="$pkgname-libs" +makedepends="$depends_dev texinfo autoconf automake libtool bison linux-headers + ncurses-dev" +install="" +subpackages="$pkgname-dev $pkgname-doc $pkgname-libs $pkgname-utils + $pkgname-openrc" +source="http://www.nico.schottelius.org/software/gpm/archives/$pkgname-$pkgver.tar.bz2 + error-format.patch + fix-highly-illegal-return-of-in-as-char.patch + fix-signedness-issue.patch + install-shared-libs-with-+x-perms.patch + install-unversioned-solibrary.patch + musl-fixes.patch + constify-format-strings.patch + + $pkgname.initd + $pkgname.confd + " + +builddir="$srcdir"/$pkgname-$pkgver + +build() { + cd "$builddir" + ./autogen.sh + ./configure \ + --build=$CBUILD \ + --host=$CHOST \ + --prefix=/usr \ + --sysconfdir=/etc \ + --mandir=/usr/share/man \ + --infodir=/usr/share/info \ + --localstatedir=/var + make +} + +package() { + cd "$builddir" + make DESTDIR="$pkgdir" install + + install -m755 -D "$srcdir"/$pkgname.initd \ + "$pkgdir"/etc/init.d/$pkgname + install -m644 -D "$srcdir"/$pkgname.confd \ + "$pkgdir"/etc/conf.d/$pkgname +} + +utils() { + depends="$pkgname" + pkgdesc="Mouse utilities for console" + mkdir -p "$subpkgdir"/usr + mv "$pkgdir"/usr/bin "$subpkgdir"/usr/ + rmdir "$pkgdir"/usr/lib +} + +sha512sums="51c1141ed502f8b6bc846485a8e315bafe3cf2b7c9d1ea8a710d9748ff2058f29c7ab5715fc1730a8437c613181d2050f37b134e9288c69ba8ff7fb0be7ec0d1 gpm-1.20.7.tar.bz2 +b4a883cb3a5b3977e0ba3909d68335b5543ae3a7d9aaa704ec82693a474813996cc6822a086737da17c67e2c2b827e3d4a48ec27d9c82f3070f75c1126651896 error-format.patch +15c4f1459a28c931362a4f6cd22278b52c998b3b6f7164ee2e0dbd88fdace74b5e3599d3f3ac665c1df79a6ece14faac2b35f57d5d834a7714de2419954e6b5f fix-highly-illegal-return-of-in-as-char.patch +db7e02b50bb02726ca743d2c7bef7d49edb359bb1594cc18f371662471d425a32f5c9f99743f237046b5a3534d2c6257fdd5cb6d9e08824c6d84725b7ddf0272 fix-signedness-issue.patch +ec21b7029e0880b342bca5a70522e33d5cabbf77c44c1dd23b16d829d8fcc6cadcdf77b01724a91a6640916673f6d5ab91d18db4cd709ed77f9ce22dec723a13 install-shared-libs-with-+x-perms.patch +05bdf6a03870175dcee5414d6d2d434b6cd3e06686f0be22d70fc7f9759db8ccea0bf9ae900d95e6d2872845cd66ee0a794afc5ece78c6640be163cad2065c58 install-unversioned-solibrary.patch +45d3a20a8f9f00f78b21c10143e138add17d414e9b5ecc28d9efee9c2190450c79dca00b13a8247ee7753ff778b09bc88fe8c512366d5b1622981bb5d612f933 musl-fixes.patch +36a5059c6336010b504ec6fc53c2d3df0811b1f1249c0e04c13066db06667119377a21e58121aaa8d4b620be2a5c21da0b018f168e36a44f85802cc50c936ba5 constify-format-strings.patch +d268504bd0cf83706863a8af5c5719b0d192c34ae6a78ff0378521841eca242b39a6e6891080a5fc5512732f84e7439697ba92bfda3ecc1aaebd36b16e946477 gpm.initd +0e7c96f29222d33301fc9c5c8cf409b7dbe6cbb1e79d76444ae5724e8b793679d3ea597a8ad64187e85680799847632095e469445ae56f893616cb0235a29f3a gpm.confd" diff --git a/testing/gpm/constify-format-strings.patch b/testing/gpm/constify-format-strings.patch new file mode 100644 index 0000000000..799aac875e --- /dev/null +++ b/testing/gpm/constify-format-strings.patch @@ -0,0 +1,85 @@ +From 7d21d7f469d90c2d55b23926c866bba635aa7e6f Mon Sep 17 00:00:00 2001 +From: Mike Frysinger <vapier@gentoo.org> +Date: Sun, 14 Feb 2016 18:05:49 -0500 +Subject: [PATCH] report/oops: constify format strings + +--- + src/headers/gpm.h | 4 ++-- + src/headers/message.h | 2 +- + src/lib/report-lib.c | 4 ++-- + src/prog/mouse-test.c | 2 +- + src/report.c | 2 +- + 5 files changed, 7 insertions(+), 7 deletions(-) + +diff --git a/src/headers/gpm.h b/src/headers/gpm.h +index 57dc618..9e96deb 100644 +--- a/src/headers/gpm.h ++++ b/src/headers/gpm.h +@@ -280,10 +280,10 @@ int Gpm_GetSnapshot(Gpm_Event *ePtr); + char *Gpm_get_console( void ); + int Gpm_x_high_y(int base, int pot_y); + int Gpm_cnt_digits(int number); +-void gpm_oops(int line, char *file, char *text, ... ); ++void gpm_oops(int line, const char *file, const char *text, ... ); + + /* report.c / report-lib.c */ +-void gpm_report(int line, char *file, int stat, char *text, ... ); ++void gpm_report(int line, const char *file, int stat, const char *text, ... ); + + #ifdef __cplusplus + }; +diff --git a/src/headers/message.h b/src/headers/message.h +index a0fed0e..25cad8c 100644 +--- a/src/headers/message.h ++++ b/src/headers/message.h +@@ -226,7 +226,7 @@ + /* #define GPM_MESS_ "" */ + + /* functions */ +-void gpm_report(int line, char *file, int stat, char *text, ... ); ++void gpm_report(int line, const char *file, int stat, const char *text, ... ); + + /* rest of wd.h */ + #ifdef HAVE_SYSLOG_H +diff --git a/src/lib/report-lib.c b/src/lib/report-lib.c +index c0ae086..b565b77 100644 +--- a/src/lib/report-lib.c ++++ b/src/lib/report-lib.c +@@ -24,9 +24,9 @@ + + #include "headers/message.h" + +-void gpm_report(int line, char *file, int stat, char *text, ... ) ++void gpm_report(int line, const char *file, int stat, const char *text, ... ) + { +- char *string = NULL; ++ const char *string = NULL; + int log_level; + va_list ap; + +diff --git a/src/prog/mouse-test.c b/src/prog/mouse-test.c +index 0bb1982..ab8d602 100644 +--- a/src/prog/mouse-test.c ++++ b/src/prog/mouse-test.c +@@ -182,7 +182,7 @@ Gpm_Type *(*I_serial)(int fd, unsigned short flags, struct Gpm_Type *type, + /*----------------------------------------------------------------------------- + Place the description here. + -----------------------------------------------------------------------------*/ +-int mousereopen(int oldfd, char *name, Gpm_Type *type) ++int mousereopen(int oldfd, const char *name, Gpm_Type *type) + { + int fd; + if (!type) type=mice+1; /* ms */ +diff --git a/src/report.c b/src/report.c +index 6c7c2ee..286c1b7 100644 +--- a/src/report.c ++++ b/src/report.c +@@ -69,7 +69,7 @@ + * + */ + +-void gpm_report(int line, char *file, int stat, char *text, ... ) ++void gpm_report(int line, const char *file, int stat, const char *text, ...) + { + FILE *console = NULL; + va_list ap, ap3; diff --git a/testing/gpm/error-format.patch b/testing/gpm/error-format.patch new file mode 100644 index 0000000000..df7aa65125 --- /dev/null +++ b/testing/gpm/error-format.patch @@ -0,0 +1,39 @@ +From 7ba518ff8b5e5c06d0a74b1fecf3b682f14c631c Mon Sep 17 00:00:00 2001 +From: Mike Frysinger <vapier@gentoo.org> +Date: Sun, 14 Feb 2016 18:07:46 -0500 +Subject: [PATCH] report: avoid -Wformat-security warnings + +Some functions warn when you pass a string to a printf style function +that is a dynamic buffer as its contents cannot be verified. Since we +don't want to support that here, just use %s. +--- + src/lib/report-lib.c | 2 +- + src/prog/mouse-test.c | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/lib/report-lib.c b/src/lib/report-lib.c +index b565b77..03230b4 100644 +--- a/src/lib/report-lib.c ++++ b/src/lib/report-lib.c +@@ -47,7 +47,7 @@ void gpm_report(int line, const char *file, int stat, const char *text, ... ) + log_level = LOG_CRIT; break; + } + #ifdef HAVE_VSYSLOG +- syslog(log_level, string); ++ syslog(log_level, "%s", string); + vsyslog(log_level, text, ap); + #else + fprintf(stderr,"%s[%s(%d)]:\n",string,file,line); +diff --git a/src/prog/mouse-test.c b/src/prog/mouse-test.c +index ab8d602..d7d1027 100644 +--- a/src/prog/mouse-test.c ++++ b/src/prog/mouse-test.c +@@ -189,7 +189,7 @@ int mousereopen(int oldfd, const char *name, Gpm_Type *type) + close(oldfd); + usleep(100000); + fd=open(name,O_RDWR); +- if (fd < 0) gpm_report(GPM_PR_OOPS,name); ++ if (fd < 0) gpm_report(GPM_PR_OOPS, "%s", name); + (*I_serial)(fd,type->flags,type,1,&type->name); /* ms initialization */ + return fd; + } diff --git a/testing/gpm/fix-highly-illegal-return-of-in-as-char.patch b/testing/gpm/fix-highly-illegal-return-of-in-as-char.patch new file mode 100644 index 0000000000..6cf0e22a2d --- /dev/null +++ b/testing/gpm/fix-highly-illegal-return-of-in-as-char.patch @@ -0,0 +1,44 @@ +From 5648239f18ac041fe1a93b8b784bf3ca8e1d83bc Mon Sep 17 00:00:00 2001 +From: nick black <nick.black@sprezzatech.com> +Date: Fri, 8 Feb 2013 05:52:13 -0500 +Subject: [PATCH] fix highly illegal return of int as char *, and less worrying + set-but-not-used warning + +--- + src/twiddler.c | 9 +++++---- + 1 file changed, 5 insertions(+), 4 deletions(-) + +diff --git a/src/twiddler.c b/src/twiddler.c +index 1d2bd50..972a616 100644 +--- a/src/twiddler.c ++++ b/src/twiddler.c +@@ -250,7 +250,6 @@ static inline int twiddler_use_item(char *item) + int twiddler_key(unsigned long message) + { + char **table = twiddler_get_table(message); +- char *val; + /* + * These two are needed to avoid transmitting single keys when typing + * chords. When the number of keys being held down decreases, data +@@ -269,7 +268,6 @@ int twiddler_key(unsigned long message) + + if (!table) return 0; + message &= 0xff; +- val = table[message]; + + if ((message < last_message) && !marked) { /* ok, do it */ + marked++; /* don't retransmit on release */ +@@ -428,8 +426,11 @@ char *twiddler_rest_to_value(char *s) + buf[ibuf]='\0'; + return strdup(buf); + } +- if (*ptr == '\\') +- return (char *)twiddler_escape_sequence(ptr+1, &len /* unused */); ++ if (*ptr == '\\') { ++ buf[ibuf++] = twiddler_escape_sequence(ptr+1, &len /* unused */); ++ buf[ibuf] = '\0'; ++ return strdup(buf); ++ } + + if (strlen(ptr)==1) return ((char *)((unsigned long)*ptr & 0xFF)); + diff --git a/testing/gpm/fix-signedness-issue.patch b/testing/gpm/fix-signedness-issue.patch new file mode 100644 index 0000000000..6b2b6ce75a --- /dev/null +++ b/testing/gpm/fix-signedness-issue.patch @@ -0,0 +1,24 @@ +From 4337fd9fc2d2ea83654f2ca69245503730231ac3 Mon Sep 17 00:00:00 2001 +From: iljavs <ivansprundel@ioactive.com> +Date: Mon, 27 Jun 2016 01:17:57 -0700 +Subject: [PATCH] fix signedness issue + +This commit fixes a signedness issue, where a negative vc coming from a malicious client could possibly cause memory corruption. +--- + src/daemon/processconn.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/src/daemon/processconn.c b/src/daemon/processconn.c +index a5839a3..e92fa63 100644 +--- a/src/daemon/processconn.c ++++ b/src/daemon/processconn.c +@@ -67,7 +67,8 @@ int processConn(int fd) + return -1; + } + +- if((vc = request->vc) > MAX_VC) { ++ vc = request->vc; ++ if(vc > MAX_VC || vc < 0) { + gpm_report(GPM_PR_DEBUG, GPM_MESS_REQUEST_ON, vc, MAX_VC); + free(info); + close(newfd); diff --git a/testing/gpm/gpm.confd b/testing/gpm/gpm.confd new file mode 100644 index 0000000000..eb77c711fe --- /dev/null +++ b/testing/gpm/gpm.confd @@ -0,0 +1,8 @@ +# gpm conf.d file for alpine linux + +# +# Specify gpm mouse daemon options here. +# + +#gpm_opts="-m /dev/input/mice -t imps2" + diff --git a/testing/gpm/gpm.initd b/testing/gpm/gpm.initd new file mode 100644 index 0000000000..85b292c317 --- /dev/null +++ b/testing/gpm/gpm.initd @@ -0,0 +1,10 @@ +#!/sbin/openrc-run + +pidfile=/var/run/gpm.pid +command=/usr/sbin/gpm +command_args=${gpm_opts:--m /dev/input/mice -t imps2} + +depend() { + after localmount + use hotplug logger +} diff --git a/testing/gpm/install-shared-libs-with-+x-perms.patch b/testing/gpm/install-shared-libs-with-+x-perms.patch new file mode 100644 index 0000000000..d32619c2da --- /dev/null +++ b/testing/gpm/install-shared-libs-with-+x-perms.patch @@ -0,0 +1,25 @@ +From 01373f6fd5dd274116c8ec693245677dbf5390e6 Mon Sep 17 00:00:00 2001 +From: Mike Frysinger <vapier@gentoo.org> +Date: Sun, 28 Oct 2012 07:25:40 -0400 +Subject: [PATCH] install shared lib with +x perms + +This is executable code, so it should have +x perms on the file. + +Signed-off-by: Mike Frysinger <vapier@gentoo.org> +--- + src/Makefile.in | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/Makefile.in b/src/Makefile.in +index d3b1dcd..6b60ad3 100644 +--- a/src/Makefile.in ++++ b/src/Makefile.in +@@ -113,7 +113,7 @@ install: check + # 2.x goes along; unfortunately that means an additional + # headache in cases like this + if test "x@SHLIB@" != "x" ; then \ +- $(INSTALL_DATA) -m 644 lib/libgpm.so.@abi_full@ $(libdir)/libgpm.so.@abi_full@ ; \ ++ $(INSTALL_DATA) -m 755 lib/libgpm.so.@abi_full@ $(libdir)/libgpm.so.@abi_full@ ; \ + cd $(libdir) && $(LN_S) -f libgpm.so.@abi_full@ libgpm.so.@abi_lev@ ; \ + echo "WARNING: We installed a lib, you should now call ldconfig" ; \ + echo "f.i.: ldconfig -n -l $(libdir)/libgpm.so.@abi_full@" ; \ diff --git a/testing/gpm/install-unversioned-solibrary.patch b/testing/gpm/install-unversioned-solibrary.patch new file mode 100644 index 0000000000..0af762e9da --- /dev/null +++ b/testing/gpm/install-unversioned-solibrary.patch @@ -0,0 +1,36 @@ +From 06b00d53d8bd513ad5d262dc94a016c6fbf2d3aa Mon Sep 17 00:00:00 2001 +From: Kamil Rytarowski <n54@gmx.com> +Date: Sat, 4 May 2013 01:30:17 +0200 +Subject: [PATCH] Install unversioned solibrary + +Unversioned solibraries are shipped with -devel packages in Linux +distros. Generate and install it for the consistency. +--- + src/Makefile.in | 7 +++---- + 1 file changed, 3 insertions(+), 4 deletions(-) + +diff --git a/src/Makefile.in b/src/Makefile.in +index 6b60ad3..7e9e2ef 100644 +--- a/src/Makefile.in ++++ b/src/Makefile.in +@@ -79,7 +79,7 @@ prog/%: prog/%.o + # | $(SED) '\''s/\($*\)\.o\([ :]*\)/\1.o \1.lo\2/g'\'' > $(DEPDIR)/$@' + + # Do it all! +-all: gpm lib/libgpm.so.@abi_lev@ @LIBGPM_A@ $(PROG) ++all: gpm lib/libgpm.so.@abi_lev@ lib/libgpm.so @LIBGPM_A@ $(PROG) + + gpm: $(GOBJ) + $(CC) @LDFLAGS@ $(LDFLAGS) -o $@ $(GOBJ) @LIBS@ $(LIBS) -lm +@@ -168,9 +168,8 @@ lib/libgpm.so.@abi_full@: $(PICS) + @LDFLAGS@ $(LDFLAGS) -o lib/libgpm.so.@abi_full@ $^ @LIBS@ @SHARED_LIBS@ $(LIBS) + lib/libgpm.so.@abi_lev@: lib/libgpm.so.@abi_full@ + $(LN_S) -f libgpm.so.@abi_full@ lib/libgpm.so.@abi_lev@ +-# unneeded, isn't it? +-#lib/libgpm.so: lib/libgpm.so.@abi_full@ +-# $(LN_S) -f libgpm.so.@abi_full@ lib/libgpm.so ++lib/libgpm.so: lib/libgpm.so.@abi_full@ ++ $(LN_S) -f libgpm.so.@abi_full@ lib/libgpm.so + + include $(DEPFILE) + diff --git a/testing/gpm/musl-fixes.patch b/testing/gpm/musl-fixes.patch new file mode 100644 index 0000000000..6653aaf475 --- /dev/null +++ b/testing/gpm/musl-fixes.patch @@ -0,0 +1,64 @@ +From d88fb1de5803c366ab62f7de9ee5d83207fb2afe Mon Sep 17 00:00:00 2001 +From: Dima Krasner <dima@dimakrasner.com> +Date: Wed, 12 Nov 2014 23:06:46 +0200 +Subject: [PATCH] Added musl support to libgpm and the daemon. + +--- + src/daemon/open_console.c | 1 + + src/prog/display-buttons.c | 1 + + src/prog/display-coords.c | 1 + + src/prog/gpm-root.y | 4 ++-- + 4 files changed, 5 insertions(+), 2 deletions(-) + +diff --git a/src/daemon/open_console.c b/src/daemon/open_console.c +index 98297c9..4d6c0af 100644 +--- a/src/daemon/open_console.c ++++ b/src/daemon/open_console.c +@@ -21,6 +21,7 @@ + + #include <fcntl.h> /* open and co. */ + #include <sys/stat.h> /* stat() */ ++#include <sys/types.h> /* major() */ + #include <sys/ioctl.h> /* ioctl */ + + /* Linux specific (to be outsourced in gpm2 */ +diff --git a/src/prog/display-buttons.c b/src/prog/display-buttons.c +index de8e5b2..38d2f11 100644 +--- a/src/prog/display-buttons.c ++++ b/src/prog/display-buttons.c +@@ -36,6 +36,7 @@ + #include <stdio.h> /* printf() */ + #include <time.h> /* time() */ + #include <errno.h> /* errno */ ++#include <sys/select.h> /* fd_set and FD_* */ + #include <gpm.h> /* gpm information */ + + /* display resulting data */ +diff --git a/src/prog/display-coords.c b/src/prog/display-coords.c +index 1fb810f..82afd12 100644 +--- a/src/prog/display-coords.c ++++ b/src/prog/display-coords.c +@@ -38,6 +38,7 @@ + #include <stdio.h> /* printf() */ + #include <time.h> /* time() */ + #include <errno.h> /* errno */ ++#include <sys/select.h> /* fd_set and FD_* */ + #include <gpm.h> /* gpm information */ + + /* display resulting data */ +diff --git a/src/prog/gpm-root.y b/src/prog/gpm-root.y +index 069d801..188ae35 100644 +--- a/src/prog/gpm-root.y ++++ b/src/prog/gpm-root.y +@@ -1199,9 +1199,9 @@ int main(int argc, char **argv) + #if defined(__GLIBC__) + __sigemptyset(&childaction.sa_mask); + #else /* __GLIBC__ */ +- childaction.sa_mask=0; ++ sigemptyset(&childaction.sa_mask); + #endif /* __GLIBC__ */ +- childaction.sa_flags=SA_INTERRUPT; /* need to break the select() call */ ++ childaction.sa_flags=0; + sigaction(SIGCHLD,&childaction,NULL); + + /*....................................... Connect and get your buffer */ |