Package init
This commit is contained in:
commit
c689f4ac00
91
0000-lockdev-euidaccess.patch
Normal file
91
0000-lockdev-euidaccess.patch
Normal file
@ -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 <errno.h>
|
||||||
|
#include <signal.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
@@ -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 <fcntl.h>
|
||||||
|
#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
|
||||||
44
0001-major-and-minor-functions-moved-to-sysmacros.h.patch
Normal file
44
0001-major-and-minor-functions-moved-to-sysmacros.h.patch
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
From fb98a845d155fdfbd45c22a6b062c3cfbe692a0a Mon Sep 17 00:00:00 2001
|
||||||
|
From: Sebastian Kisela <skisela@redhat.com>
|
||||||
|
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
|
||||||
|
<sys/sysmacros.h>
|
||||||
|
|
||||||
|
"
|
||||||
|
...
|
||||||
|
The macros 'major', 'minor', and 'makedev' are now only available from
|
||||||
|
the header <sys/sysmacros.h>; not from <sys/types.h> or various other
|
||||||
|
headers that happen to include <sys/types.h>. 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.
|
||||||
|
|
||||||
|
<sys/sysmacros.h> is a GNU extension. Portable programs that require
|
||||||
|
these macros should first include <sys/types.h>, and then include
|
||||||
|
<sys/sysmacros.h> if __GNU_LIBRARY__ is defined.
|
||||||
|
...
|
||||||
|
"
|
||||||
|
|
||||||
|
Signed-off-by: Sebastian Kisela <skisela@redhat.com>
|
||||||
|
---
|
||||||
|
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 <sys/stat.h>
|
||||||
|
#include <sys/file.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
+#include <sys/sysmacros.h>
|
||||||
|
#include <sys/wait.h>
|
||||||
|
#include "lockdev.h"
|
||||||
|
#include "ttylock.h"
|
||||||
|
--
|
||||||
|
2.14.4
|
||||||
|
|
||||||
BIN
lockdev-1.0.4.20111007git.tar.gz
Normal file
BIN
lockdev-1.0.4.20111007git.tar.gz
Normal file
Binary file not shown.
94
lockdev.spec
Normal file
94
lockdev.spec
Normal file
@ -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 <<EOF
|
||||||
|
|
||||||
|
d %{_lockdir} 0775 root lock -
|
||||||
|
EOF
|
||||||
|
|
||||||
|
%pre
|
||||||
|
getent group lock >/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 <buildteam@openeuler.org> - 1.0.4-0.29
|
||||||
|
- Package init
|
||||||
Loading…
x
Reference in New Issue
Block a user