commit cfba158aef4198d3be5818c1820f94237b0525be Author: overweight <5324761+overweight@user.noreply.gitee.com> Date: Mon Sep 30 10:51:38 2019 -0400 Package init diff --git a/fix-highly-illegal-return-of-int-as-char-and-less-wo.patch b/fix-highly-illegal-return-of-int-as-char-and-less-wo.patch new file mode 100644 index 0000000..2c13544 --- /dev/null +++ b/fix-highly-illegal-return-of-int-as-char-and-less-wo.patch @@ -0,0 +1,47 @@ +From 5648239f18ac041fe1a93b8b784bf3ca8e1d83bc Mon Sep 17 00:00:00 2001 +From: nick black +Date: Fri, 8 Feb 2013 05:52:13 -0500 +Subject: [PATCH 07/21] 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)); + +-- +2.19.1 + diff --git a/fix-signedness-issue.patch b/fix-signedness-issue.patch new file mode 100644 index 0000000..c296adc --- /dev/null +++ b/fix-signedness-issue.patch @@ -0,0 +1,27 @@ +From 4337fd9fc2d2ea83654f2ca69245503730231ac3 Mon Sep 17 00:00:00 2001 +From: iljavs +Date: Mon, 27 Jun 2016 01:17:57 -0700 +Subject: [PATCH 21/21] 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); +-- +2.19.1 + diff --git a/gpm-1.20.5-close-fds.patch b/gpm-1.20.5-close-fds.patch new file mode 100644 index 0000000..f33f07c --- /dev/null +++ b/gpm-1.20.5-close-fds.patch @@ -0,0 +1,17 @@ +diff -up gpm-1.20.5/src/daemon/startup.c.close-fds gpm-1.20.5/src/daemon/startup.c +--- gpm-1.20.5/src/daemon/startup.c.close-fds 2008-06-13 10:08:19.000000000 +0200 ++++ gpm-1.20.5/src/daemon/startup.c 2008-12-02 10:11:12.000000000 +0100 +@@ -135,6 +135,13 @@ void startup(int argc, char **argv) + check_uniqueness(); + gpm_report(GPM_PR_INFO,GPM_MESS_STARTED); + ++ // close extra fds ++ if (option.run_status == GPM_RUN_STARTUP ) { ++ close(0); ++ close(1); ++ close(2); ++ } ++ + //return mouse_table[1].fd; /* the second is handled in the main() */ + + /****************** OLD CODE from gpn.c END ***********************/ diff --git a/gpm-1.20.6-missing-header-dir-in-make-depend.patch b/gpm-1.20.6-missing-header-dir-in-make-depend.patch new file mode 100644 index 0000000..cd35729 --- /dev/null +++ b/gpm-1.20.6-missing-header-dir-in-make-depend.patch @@ -0,0 +1,12 @@ +diff -Naur gpm-1.20.6.orig/src/Makefile.in gpm-1.20.6/src/Makefile.in +--- gpm-1.20.6.orig/src/Makefile.in 2009-02-09 10:58:53.000000000 +0100 ++++ gpm-1.20.6/src/Makefile.in 2013-03-19 14:33:58.092659991 +0100 +@@ -96,7 +96,7 @@ + + # create dependencies + for DEPS in `echo *.c */*.c`; do \ +- $(CC) -I. -I $(srcdir) -M @CPPFLAGS@ $(CPPFLAGS) $$DEPS | \ ++ $(CC) -I. -Iheaders -I $(srcdir) -M @CPPFLAGS@ $(CPPFLAGS) $$DEPS | \ + $(SED) 's/^\(.*\)\.o\([ :]+\)/\1.o \1.lo\2/g' >> $(DEPFILE) ; done + + ### INSTALL diff --git a/gpm-1.20.6-multilib.patch b/gpm-1.20.6-multilib.patch new file mode 100644 index 0000000..820db88 --- /dev/null +++ b/gpm-1.20.6-multilib.patch @@ -0,0 +1,45 @@ +diff -up gpm-1.20.6/contrib/Makefile.in.multilib gpm-1.20.6/contrib/Makefile.in +--- gpm-1.20.6/contrib/Makefile.in.multilib 2008-06-19 07:48:48.000000000 +0200 ++++ gpm-1.20.6/contrib/Makefile.in 2009-02-24 10:36:09.000000000 +0100 +@@ -9,10 +9,10 @@ top_builddir = .. + + include $(top_builddir)/Makefile.include + +-all: $(srcdir)/$(ELISP) ++all: $(filter-out %.elc,$(srcdir)/$(ELISP)) + + install: all +- if [ -n "$(ELISP)" ]; then for i in `echo $(ELISP)`; do \ ++ if [ -n "$(filter-out %.elc,$(ELISP))" ]; then for i in `echo $(filter-out %.elc,$(ELISP))`; do \ + $(INSTALL_DATA) $(srcdir)/$$i $(lispdir)/`basename $$i` ;\ + done; fi + +@@ -20,7 +20,7 @@ install: all + $(EMACS) -batch -l $(srcdir)/emacs/exec.el -exec '(byte-compile-file "$<")' + + uninstall: +- if [ -n "$(ELISP)" ]; then for i in `echo $(ELISP)`; do \ ++ if [ -n "$(filter-out %.elc,$(ELISP))" ]; then for i in `echo $(filter-out %.elc,$(ELISP))`; do \ + rm -f $(lispdir)/$$i ;\ + done; fi + +@@ -28,4 +28,4 @@ dist: + $(CP) -r $(srcdir) $(top_builddir)/gpm-$(release)/ + + clean distclean: +- $(RM) -f $(srcdir)/emacs/*.elc Makefile ++ $(RM) $(srcdir)/emacs/*.elc Makefile +diff -up gpm-1.20.6/doc/Makefile.in.multilib gpm-1.20.6/doc/Makefile.in +--- gpm-1.20.6/doc/Makefile.in.multilib 2009-02-09 10:58:53.000000000 +0100 ++++ gpm-1.20.6/doc/Makefile.in 2009-02-24 10:36:09.000000000 +0100 +@@ -130,8 +130,8 @@ install: all installdirs + #i keep all my infopages compressed and i'm tired to do it by + #hand, so check if there are any compressed pages and do this + #one too +- -ls $(infodir)/*[-.]info.gz >/dev/null 2>&1 \ +- && gzip -f $(infodir)/gpm.info ++ #-ls $(infodir)/*[-.]info.gz >/dev/null 2>&1 \ ++ # && gzip -f $(infodir)/gpm.info + # Hmm.... shouldn't man pages be compressed too? + # maybe they should, but at least at my system they are not. + diff --git a/gpm-1.20.7-rhbz-668480-gpm-types-7-manpage-fixes.patch b/gpm-1.20.7-rhbz-668480-gpm-types-7-manpage-fixes.patch new file mode 100644 index 0000000..6199462 --- /dev/null +++ b/gpm-1.20.7-rhbz-668480-gpm-types-7-manpage-fixes.patch @@ -0,0 +1,30 @@ +diff -Naur gpm-1.20.7.orig/doc/doc.gpm.in gpm-1.20.7/doc/doc.gpm.in +--- gpm-1.20.7.orig/doc/doc.gpm.in 2012-10-26 23:21:38.000000000 +0200 ++++ gpm-1.20.7/doc/doc.gpm.in 2013-07-19 19:40:33.374213536 +0200 +@@ -600,7 +600,7 @@ + that one of @t{\-o dtr}, @t{\-o rts}, @t{\-o both} can be specified to + toggle the control lines of the serial port. + +-The following mouse type are corrently recognized: ++The following mouse type are currently recognized: + + @table @code + @item bare Microsoft +@@ -621,7 +621,7 @@ + this is your case, use the @samp{bare} mouse type. Some new + two-button devices are ``plug and play'', and they don't play + fair at all; in this case try @t{\-t pnp}. Many (most) +- three-button devices that use the microsoft protocol fail to ++ three-button devices that use the Microsoft protocol fail to + report some middle-button events during mouse motion. Since + the protocol does not distinguish between the middle button + going up and the middle button going down it would be liable +@@ -649,7 +649,7 @@ + decoder gets into a confused state where it thinks the middle + button is up when it's down and vice versa. (If you get sick + of having to do this, please don't blame gpm; blame your buggy +- mouse! Note that most three-button mice that do the microsoft ++ mouse! Note that most three-button mice that do the Microsoft + protocol can be made to do the MouseSystems protocol + instead. The ``3 Button Serial Mouse mini-HOWTO'' has + information about this.) This mouse decoder accepts standard diff --git a/gpm-1.20.7-sigemptyset.patch b/gpm-1.20.7-sigemptyset.patch new file mode 100644 index 0000000..a789037 --- /dev/null +++ b/gpm-1.20.7-sigemptyset.patch @@ -0,0 +1,16 @@ +diff -r -u gpm-1.20.7-orig/src/prog/gpm-root.y gpm-1.20.7/src/prog/gpm-root.y +--- gpm-1.20.7-orig/src/prog/gpm-root.y 2012-10-26 16:21:38.000000000 -0500 ++++ gpm-1.20.7/src/prog/gpm-root.y 2017-10-10 13:50:02.115721252 -0500 +@@ -1196,11 +1196,7 @@ + LOG_DAEMON : LOG_USER); + /* reap your zombies */ + childaction.sa_handler=reap_children; +-#if defined(__GLIBC__) +- __sigemptyset(&childaction.sa_mask); +-#else /* __GLIBC__ */ +- childaction.sa_mask=0; +-#endif /* __GLIBC__ */ ++ sigemptyset(&childaction.sa_mask); + childaction.sa_flags=SA_INTERRUPT; /* need to break the select() call */ + sigaction(SIGCHLD,&childaction,NULL); + diff --git a/gpm-1.20.7-sysmacros.patch b/gpm-1.20.7-sysmacros.patch new file mode 100644 index 0000000..630f971 --- /dev/null +++ b/gpm-1.20.7-sysmacros.patch @@ -0,0 +1,14 @@ +diff -r -u gpm-1.20.7-orig/src/daemon/open_console.c gpm-1.20.7/src/daemon/open_console.c +--- gpm-1.20.7-orig/src/daemon/open_console.c 2012-10-26 16:21:38.000000000 -0500 ++++ gpm-1.20.7/src/daemon/open_console.c 2017-10-10 13:40:39.896316258 -0500 +@@ -23,6 +23,10 @@ + #include /* stat() */ + #include /* ioctl */ + ++#ifdef HAVE_SYS_SYSMACROS_H ++#include /* major() w/newer glibc */ ++#endif ++ + /* Linux specific (to be outsourced in gpm2 */ + #include /* for serial console check */ + #include /* for serial console check */ diff --git a/gpm-1.20.7.tar.xz b/gpm-1.20.7.tar.xz new file mode 100644 index 0000000..9afc73c Binary files /dev/null and b/gpm-1.20.7.tar.xz differ diff --git a/gpm-format-security.patch b/gpm-format-security.patch new file mode 100644 index 0000000..3705206 --- /dev/null +++ b/gpm-format-security.patch @@ -0,0 +1,12 @@ +diff -Naur gpm-1.20.6.orig/src/lib/report-lib.c gpm-1.20.6/src/lib/report-lib.c +--- gpm-1.20.6.orig/src/lib/report-lib.c 2014-02-05 19:11:58.688000000 +0100 ++++ gpm-1.20.6/src/lib/report-lib.c 2014-02-05 19:11:23.968000000 +0100 +@@ -55,7 +55,7 @@ + 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/gpm.service b/gpm.service new file mode 100644 index 0000000..5803501 --- /dev/null +++ b/gpm.service @@ -0,0 +1,14 @@ +[Unit] +Description=Console Mouse manager + +# This could probably benefit from socket activation, but honestly I think it +# is time for gpm to go away, and hence I am not planning to spend the time +# to add socket activation here. + +[Service] +ExecStart=/usr/sbin/gpm -m /dev/input/mice -t exps2 +Type=forking +PIDFile=/var/run/gpm.pid + +[Install] +WantedBy=multi-user.target diff --git a/gpm.spec b/gpm.spec new file mode 100644 index 0000000..42a332c --- /dev/null +++ b/gpm.spec @@ -0,0 +1,118 @@ +Name: gpm +Version: 1.20.7 +Release: 17 +Summary: The gpm package contains a mouse server for the console and xterm +License: GPLv2 and GPLv2+ with exceptions and GPLv3+ and Verbatim and Copyright only +URL: http://www.nico.schottelius.org/software/gpm/ +Source: %{name}-%{version}.tar.xz +Source1: gpm.service + +Patch1: gpm-1.20.6-multilib.patch +Patch2: gpm-1.20.5-close-fds.patch +Patch3: gpm-1.20.7-rhbz-668480-gpm-types-7-manpage-fixes.patch +Patch4: gpm-1.20.6-missing-header-dir-in-make-depend.patch +Patch5: gpm-format-security.patch +Patch6: gpm-1.20.7-sysmacros.patch +Patch7: gpm-1.20.7-sigemptyset.patch + +Patch6000: fix-highly-illegal-return-of-int-as-char-and-less-wo.patch +Patch6001: fix-signedness-issue.patch + +Requires(post): systemd systemd-sysv info +Requires(preun): systemd info +Requires(postun): systemd +Requires: linuxconsoletools +BuildRequires: autoconf automake bison gawk libtool libcap-ng-devel ncurses-devel sed systemd texinfo +Requires: %{name}-libs = %{version}-%{release} + +%description +GPM(General Purpose Mouse) is a mouse serer for the console and xterm, with +sample clients included like emacs. + +%package libs +Summary: Library for the gpm + +%description libs +This package contains the library which contains +the gpm system calls and library functions. + +%package devel +Requires: %{name} = %{version}-%{release} +Requires: %{name}-libs = %{version}-%{release} +Summary: Development files for the gpm library +Provides: gpm-static +Obsoletes: gpm-static + +%description devel +The gpm-devel package includes header files and libraries necessary +for the gpm library. + +%package help +Summary: This package contains help documents +Requires: %{name}-libs = %{version}-%{release} + +%description help +Files for help with gpm. + +%prep +%autosetup -p1 +./autogen.sh + +%build +%configure +%make_build + +%install +%makeinstall + +chmod 0755 %{buildroot}/%{_libdir}/libgpm.so.2.1.0 +ln -sf libgpm.so.2.1.0 %{buildroot}/%{_libdir}/libgpm.so + +cp conf/gpm-* %{buildroot}%{_sysconfdir} +chmod 644 %{buildroot}%{_sysconfdir}/gpm-* +mkdir -p %{buildroot}%{_unitdir} +cp %{SOURCE1} %{buildroot}%{_unitdir} +chmod 644 %{buildroot}%{_unitdir}/gpm.service + +%post +%systemd_post gpm.service +if [ -e %{_infodir}/gpm.info.gz ]; then + /sbin/install-info %{_infodir}/gpm.info.gz %{_infodir}/dir || : +fi + +%preun +%systemd_preun gpm.service +if [ $1 = 0 -a -e %{_infodir}/gpm.info.gz ]; then + /sbin/install-info %{_infodir}/gpm.info.gz --delete %{_infodir}/dir || : +fi + +%postun +%systemd_postun_with_restart gpm.servic + +%ldconfig_post +%ldconfig_postun + +%files +%doc COPYING +%{_infodir}/* +%config(noreplace) %{_sysconfdir}/gpm-* +%exclude %{_datadir}/emacs/site-lisp/t-mouse.el +%{_unitdir}/gpm.service +%{_sbindir}/* +%{_bindir}/* + +%files libs +%{_libdir}/libgpm.so.* + +%files devel +%{_includedir}/* +%{_libdir}/libgpm.so +%{_libdir}/libgpm.a + +%files help +%doc README TODO doc/README* doc/FAQ doc/Announce doc/changelog +%{_mandir}/man?/* + +%changelog +* Fri Sep 20 2019 Yiru Wang - 1.20.7-17 +- Pakcage init