Package init

This commit is contained in:
overweight 2019-09-30 10:51:38 -04:00
commit cfba158aef
12 changed files with 352 additions and 0 deletions

View File

@ -0,0 +1,47 @@
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 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

View File

@ -0,0 +1,27 @@
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 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

View File

@ -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 ***********************/

View File

@ -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

45
gpm-1.20.6-multilib.patch Normal file
View File

@ -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.

View File

@ -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

View File

@ -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);

View File

@ -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 <sys/stat.h> /* stat() */
#include <sys/ioctl.h> /* ioctl */
+#ifdef HAVE_SYS_SYSMACROS_H
+#include <sys/sysmacros.h> /* major() w/newer glibc */
+#endif
+
/* Linux specific (to be outsourced in gpm2 */
#include <linux/serial.h> /* for serial console check */
#include <asm/ioctls.h> /* for serial console check */

BIN
gpm-1.20.7.tar.xz Normal file

Binary file not shown.

12
gpm-format-security.patch Normal file
View File

@ -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);

14
gpm.service Normal file
View File

@ -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

118
gpm.spec Normal file
View File

@ -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 <wangyiru1@huawei.com> - 1.20.7-17
- Pakcage init