commit c689f4ac00c7ffa3e5bc67bd2656c2c0e292c75d Author: overweight <5324761+overweight@user.noreply.gitee.com> Date: Mon Sep 30 11:02:45 2019 -0400 Package init diff --git a/0000-lockdev-euidaccess.patch b/0000-lockdev-euidaccess.patch new file mode 100644 index 0000000..2ed5cee --- /dev/null +++ b/0000-lockdev-euidaccess.patch @@ -0,0 +1,91 @@ +diff -up lockdev-scm-2011-10-07/src/lockdev.c.access lockdev-scm-2011-10-07/src/lockdev.c +--- lockdev-scm-2011-10-07/src/lockdev.c.access 2011-07-22 09:37:10.000000000 +0200 ++++ lockdev-scm-2011-10-07/src/lockdev.c 2013-12-05 11:56:57.836961642 +0100 +@@ -95,6 +95,10 @@ + * + */ + ++#ifndef _GNU_SOURCE ++ #define _GNU_SOURCE ++#endif ++ + #include + #include + #include +@@ -125,6 +125,10 @@ + #include "lockdev.h" + #include "ttylock.h" + ++#ifndef LOCKDEV_ACCESS ++#define LOCKDEV_ACCESS euidaccess ++#endif ++ + #define LOCKDEV_PATH SBINDIR "/lockdev" + + /* +@@ -616,7 +620,10 @@ dev_lock (const char *devname) + if ( stat( device, &statbuf) == -1 ) { + close_n_return(-errno); + } +- if ( access( device, W_OK ) == -1 ) { ++ /* check that the caller has write permission to the device ++ * to prevent denial-of-service attack by unauthorized users ++ */ ++ if ( LOCKDEV_ACCESS( device, W_OK ) == -1 ) { + close_n_return(-errno); + } + +@@ -780,7 +787,10 @@ dev_relock (const char *devname, + if ( stat( device, &statbuf) == -1 ) { + close_n_return(-errno); + } +- if ( access( device, W_OK ) == -1 ) { ++ /* check that the caller has write permission to the device ++ * to prevent denial-of-service attack by unauthorized users ++ */ ++ if ( LOCKDEV_ACCESS( device, W_OK ) == -1 ) { + close_n_return(-errno); + } + +@@ -870,7 +880,10 @@ dev_unlock (const char *devname, + if ( stat( device, &statbuf) == -1 ) { + close_n_return(-errno); + } +- if ( access( device, W_OK ) == -1 ) { ++ /* check that the caller has write permission to the device ++ * to prevent denial-of-service attack by unauthorized users ++ */ ++ if ( LOCKDEV_ACCESS( device, W_OK ) == -1 ) { + close_n_return(-errno); + } + +diff -ru lockdev-save/src/Makefile.am lockdev-scm-2011-10-07/src/Makefile.am +--- lockdev-save/src/Makefile.am 2014-09-18 13:42:00.363741658 +0200 ++++ lockdev-scm-2011-10-07/src/Makefile.am 2014-09-18 13:52:10.307868154 +0200 +@@ -6,7 +6,6 @@ + AM_CPPFLAGS = -include $(top_builddir)/config.h -DSBINDIR=\"$(sbindir)\" + + lockdev_SOURCES = sample.c +-lockdev_LDADD = liblockdev.la + + baudboy_SOURCES = baudboy_test.c + baudboy_LDADD = liblockdev.la +Solo in lockdev-scm-2011-10-07/src: Makefile.in +diff -ru lockdev-save/src/sample.c lockdev-scm-2011-10-07/src/sample.c +--- lockdev-save/src/sample.c 2014-09-18 13:42:00.363741658 +0200 ++++ lockdev-scm-2011-10-07/src/sample.c 2014-09-18 14:06:03.769023380 +0200 +@@ -6,6 +6,13 @@ + #include + #include "lockdev.h" + ++/* ttylock functions swap the real/effective uid/gid for us, so ++ * use access instead of euidaccess. ++ */ ++#define LOCKDEV_ACCESS access ++#undef TTYLOCK_USE_HELPER ++#include "lockdev.c" ++ + void + usage (void) + { +Solo in lockdev-scm-2011-10-07: VERSION diff --git a/0001-major-and-minor-functions-moved-to-sysmacros.h.patch b/0001-major-and-minor-functions-moved-to-sysmacros.h.patch new file mode 100644 index 0000000..9b70b0e --- /dev/null +++ b/0001-major-and-minor-functions-moved-to-sysmacros.h.patch @@ -0,0 +1,44 @@ +From fb98a845d155fdfbd45c22a6b062c3cfbe692a0a Mon Sep 17 00:00:00 2001 +From: Sebastian Kisela +Date: Wed, 25 Jul 2018 09:18:33 +0200 +Subject: [PATCH] major and minor functions moved to sysmacros.h + +According to https://sourceware.org/git/?p=glibc.git;a=blob_plain;f=NEWS;hb=HEAD +(glibc changelog) the below happened, therefore explicitly include + + +" +... +The macros 'major', 'minor', and 'makedev' are now only available from +the header ; not from or various other +headers that happen to include . These macros are rarely +used, not part of POSIX nor XSI, and their names frequently collide with +user code; see https://sourceware.org/bugzilla/show_bug.cgi?id=19239 for +further explanation. + + is a GNU extension. Portable programs that require +these macros should first include , and then include + if __GNU_LIBRARY__ is defined. +... +" + +Signed-off-by: Sebastian Kisela +--- + src/lockdev.c | 1 + + 1 files changed, 1 insertions(+) + +diff --git a/src/lockdev.c b/src/lockdev.c +index 6e69894..ec86f65 100644 +--- a/src/lockdev.c ++++ b/src/lockdev.c +@@ -121,6 +121,7 @@ + #include + #include + #include ++#include + #include + #include "lockdev.h" + #include "ttylock.h" +-- +2.14.4 + diff --git a/lockdev-1.0.4.20111007git.tar.gz b/lockdev-1.0.4.20111007git.tar.gz new file mode 100644 index 0000000..55f9131 Binary files /dev/null and b/lockdev-1.0.4.20111007git.tar.gz differ diff --git a/lockdev.spec b/lockdev.spec new file mode 100644 index 0000000..3a27f04 --- /dev/null +++ b/lockdev.spec @@ -0,0 +1,94 @@ +%global _lockdir /run/lock/lockdev +%global co_date 2011-10-07 + +Name: lockdev +Version: 1.0.4 +Release: 0.29 +Summary: A library for locking devices +License: LGPLv2 +URL: https://alioth.debian.org/projects/lockdev/ + +Source0: lockdev-%{version}.20111007git.tar.gz + +Patch0: 0000-lockdev-euidaccess.patch +Patch1: 0001-major-and-minor-functions-moved-to-sysmacros.h.patch + +Requires: shadow-utils glibc systemd + +BuildRequires: autoconf automake libtool perl-interpreter systemd perl(ExtUtils::MakeMaker) + +%description +Lockdev provides a reliable way to put an exclusive lock to devices +using both FSSTND and SVr4 methods. + +%package devel +Summary: The header files for the lockdev library +Requires: lockdev = %{version}-%{release} + +%description devel +The devel for %{name} + + +%package help +Summary: The doc files for the lockdev +Requires: lockdev = %{version}-%{release} + +%description help +The doc files for %{name} + +%prep +%autosetup -n lockdev-scm-%{co_date} -p1 + +%build +./scripts/git-version > VERSION +touch ChangeLog +autoreconf -vfi + +CFLAGS="%{optflags} -D_PATH_LOCK=\\\"%{_lockdir}\\\"" \ +%configure --enable-helper --disable-silent-rules + +make %{?_smp_mflags} + +%install +%make_install + +mkdir -p %{buildroot}%{_lockdir} +mkdir -p ${RPM_BUILD_ROOT}%{_tmpfilesdir} +cat > ${RPM_BUILD_ROOT}%{_tmpfilesdir}/lockdev.conf </dev/null 2>&1 || groupadd -g 54 -r -f lock >/dev/null 2>&1 || : + +%post +/sbin/ldconfig +if [ $1 -eq 1 ] ; then +%tmpfiles_create +fi + +%postun -p /sbin/ldconfig + + +%files +%{license} COPYING +%doc AUTHORS +%ghost %dir %attr(0775,root,lock) %{_lockdir} +%attr(2711,root,lock) %{_sbindir}/lockdev +%{_tmpfilesdir}/lockdev.conf +%{_libdir}/*.so.* +%exclude %{_libdir}/*.la + +%files devel +%{_libdir}/*.so +%{_libdir}/pkgconfig/lockdev.pc +%{_includedir}/* + +%files help +%{_mandir}/man3/* +%{_mandir}/man8/* + +%changelog +* Mon Aug 19 2019 openEuler Buildteam - 1.0.4-0.29 +- Package init