SHA256
1
0
forked from pool/rpmlint

Accepting request 372897 from devel:openSUSE:Factory:rpmlint

- add regression test for boo#970170

- whitelist rabbitmq user and group

- Fix boo#970170: rpmlint no longer detects gethostbyname calls,
  also detect gethostbyname{,2}{,_r}, gethostbyaddr{,_r}
  * update suse-binariescheck.diff
  * rpmlint-check-gethostbyname.patch

OBS-URL: https://build.opensuse.org/request/show/372897
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/rpmlint?expand=0&rev=248
This commit is contained in:
Dominique Leuenberger 2016-03-18 20:31:37 +00:00 committed by Git OBS Bridge
commit 71e4485861
6 changed files with 171 additions and 2 deletions

2
config
View File

@ -197,6 +197,7 @@ setOption('StandardGroups', (
'qemu', 'qemu',
'quagga', 'quagga',
'quasselcore', 'quasselcore',
'rabbitmq',
'radiusd', 'radiusd',
'root', 'root',
'sabayon-admin', 'sabayon-admin',
@ -359,6 +360,7 @@ setOption('StandardUsers', (
'qemu', 'qemu',
'quagga', 'quagga',
'quasselcore', 'quasselcore',
'rabbitmq',
'radiusd', 'radiusd',
'radvd', 'radvd',
'root', 'root',

View File

@ -0,0 +1,146 @@
From 415d04b8d4fbb1421b9277294cf94b851c408795 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20Br=C3=BCns?= <stefan.bruens@rwth-aachen.de>
Date: Tue, 8 Mar 2016 23:48:45 +0100
Subject: [PATCH] gethostbyname
---
tests/gethostbyname.ignore | 4 ++
tests/gethostbyname.ref | 7 ++++
tests/gethostbyname.spec | 101 +++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 112 insertions(+)
create mode 100644 tests/gethostbyname.ignore
create mode 100644 tests/gethostbyname.ref
create mode 100644 tests/gethostbyname.spec
diff --git a/tests/gethostbyname.ignore b/tests/gethostbyname.ignore
new file mode 100644
index 0000000..410e7a4
--- /dev/null
+++ b/tests/gethostbyname.ignore
@@ -0,0 +1,3 @@
+#addFilter(" files-duplicate")
+addFilter(" no-manual-page-for-binary ")
+#addFilter(" no-binary")
diff --git a/tests/gethostbyname.ref b/tests/gethostbyname.ref
new file mode 100644
index 0000000..fb4a5b9
--- /dev/null
+++ b/tests/gethostbyname.ref
@@ -0,0 +1,7 @@
+gethostbyname: I: binary-or-shlib-calls-gethostbyname /usr/bin/call_gethostbyaddr
+gethostbyname: I: binary-or-shlib-calls-gethostbyname /usr/bin/call_gethostbyname2
+gethostbyname: I: binary-or-shlib-calls-gethostbyname /usr/bin/call_gethostbyname
+gethostbyname: I: binary-or-shlib-calls-gethostbyname /usr/bin/call_gethostbyname2_r
+gethostbyname: I: binary-or-shlib-calls-gethostbyname /usr/bin/call_gethostbyaddr_r
+gethostbyname: I: binary-or-shlib-calls-gethostbyname /usr/bin/call_gethostbyname_r
+1 packages and 0 specfiles checked; 0 errors, 0 warnings.
diff --git a/tests/gethostbyname.spec b/tests/gethostbyname.spec
new file mode 100644
index 0000000..2cd2457
--- /dev/null
+++ b/tests/gethostbyname.spec
@@ -0,0 +1,101 @@
+Name: gethostbyname
+Version: 0
+Release: 0
+Group: Development/Tools/Building
+Summary: Lorem ipsum
+License: GPL-2.0+
+BuildRoot: %_tmppath/%name-%version-build
+Url: http://www.opensuse.org/
+
+%description
+Lorem ipsum dolor sit amet, consectetur adipisici elit, sed
+eiusmod tempor incidunt ut labore et dolore magna aliqua. Ut enim
+ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut
+aliquid ex ea commodi consequat. Quis aute iure reprehenderit in
+voluptate velit esse cillum dolore eu fugiat nulla pariatur.
+Excepteur sint obcaecat cupiditat non proident, sunt in culpa qui
+officia deserunt mollit anim id est laborum.
+
+%prep
+%build
+# int gethostent_r(
+# struct hostent *ret, char *buf, size_t buflen,
+# struct hostent **result, int *h_errnop);
+#
+# int gethostbyaddr_r(const void *addr, socklen_t len, int type,
+# struct hostent *ret, char *buf, size_t buflen,
+# struct hostent **result, int *h_errnop);
+#
+# int gethostbyname_r(const char *name,
+# struct hostent *ret, char *buf, size_t buflen,
+# struct hostent **result, int *h_errnop);
+#
+# int gethostbyname2_r(const char *name, int af,
+# struct hostent *ret, char *buf, size_t buflen,
+# struct hostent **result, int *h_errnop);
+
+cat <<EOF > call_gethostbyname.c
+#include <netdb.h>
+int main(void)
+{
+ return gethostbyname("") > 0;
+}
+EOF
+
+cat <<EOF > call_gethostbyname2.c
+#include <netdb.h>
+int main(void)
+{
+ return gethostbyname2("", 0) > 0;
+}
+EOF
+
+cat <<EOF > call_gethostbyaddr.c
+#include <netdb.h>
+int main(void)
+{
+ return gethostbyaddr(0, 0, 0) > 0;
+}
+EOF
+
+cat <<EOF > call_gethostbyaddr_r.c
+#include <netdb.h>
+int main(void)
+{
+ return gethostbyaddr_r(0, 0, 0, 0, 0, 0, 0, 0) > 0;
+}
+EOF
+
+cat <<EOF > call_gethostbyname_r.c
+#include <netdb.h>
+int main(void)
+{
+ return gethostbyname_r("", 0, 0, 0, 0, 0) > 0;
+}
+EOF
+
+cat <<EOF > call_gethostbyname2_r.c
+#include <netdb.h>
+int main(void)
+{
+ return gethostbyname2_r("", 0, 0, 0, 0, 0, 0) > 0;
+}
+EOF
+
+%install
+for f in gethostbyname gethostbyname2 gethostbyaddr gethostbyaddr_r gethostbyname_r gethostbyname2_r; do
+ gcc $RPM_OPT_FLAGS -o call_$f call_$f.c
+ strip call_$f
+ install -D -m 755 call_$f %buildroot/usr/bin/call_$f
+done
+
+%clean
+rm -rf %buildroot
+
+%files
+%defattr(-,root,root)
+/usr/bin/*
+
+%changelog
+* Sat Mar 05 2016 stefan.bruens@rwth-aachen.de
+- dummy
--
2.7.2

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Tue Mar 8 22:57:31 UTC 2016 - stefan.bruens@rwth-aachen.de
- add regression test for boo#970170
------------------------------------------------------------------- -------------------------------------------------------------------
Mon Nov 30 14:58:36 UTC 2015 - lnussel@suse.de Mon Nov 30 14:58:36 UTC 2015 - lnussel@suse.de

View File

@ -30,6 +30,7 @@ Group: Development/Tools/Building
BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRoot: %{_tmppath}/%{name}-%{version}-build
Url: http://www.opensuse.org/ Url: http://www.opensuse.org/
Source: rpmlint-tests-%version.tar.xz Source: rpmlint-tests-%version.tar.xz
Patch0: rpmlint-check-gethostbyname.patch
%description %description
This package doesn't actually contain any files and is not meant to This package doesn't actually contain any files and is not meant to
@ -38,6 +39,7 @@ regression tests against rpmlint(-mini).
%prep %prep
%setup -q %setup -q
%patch0 -p1
%build %build
mkdir rpms mkdir rpms

View File

@ -1,3 +1,16 @@
-------------------------------------------------------------------
Mon Mar 14 16:08:20 UTC 2016 - christoph@stop.pe
- whitelist rabbitmq user and group
-------------------------------------------------------------------
Tue Mar 8 23:29:11 UTC 2016 - stefan.bruens@rwth-aachen.de
- Fix boo#970170: rpmlint no longer detects gethostbyname calls,
also detect gethostbyname{,2}{,_r}, gethostbyaddr{,_r}
* update suse-binariescheck.diff
* rpmlint-check-gethostbyname.patch
------------------------------------------------------------------- -------------------------------------------------------------------
Mon Feb 22 08:16:34 UTC 2016 - dmueller@suse.com Mon Feb 22 08:16:34 UTC 2016 - dmueller@suse.com

View File

@ -20,13 +20,14 @@ index d2ed87a..2e5758e 100644
import AbstractCheck import AbstractCheck
import Config import Config
import Pkg import Pkg
@@ -53,6 +53,9 @@ class BinaryInfo: @@ -53,6 +53,10 @@ class BinaryInfo:
unused_regex = re.compile('^\s+(\S+)') unused_regex = re.compile('^\s+(\S+)')
exit_call_regex = create_regexp_call('_?exit') exit_call_regex = create_regexp_call('_?exit')
fork_call_regex = create_regexp_call('fork') fork_call_regex = create_regexp_call('fork')
+ debuginfo_regex=re.compile('^\s+\[\s*\d+\]\s+\.debug_.*\s+') + debuginfo_regex=re.compile('^\s+\[\s*\d+\]\s+\.debug_.*\s+')
+ symtab_regex=re.compile('^\s+\[\s*\d+\]\s+\.symtab\s+') + symtab_regex=re.compile('^\s+\[\s*\d+\]\s+\.symtab\s+')
+ gethostbyname_call_regex = re.compile('\s+FUNC\s+.*?\s+(gethostbyname(?:@\S+)?)(?:\s|$)') + gethostbyname_call_regex = create_regexp_call(['gethostbyname', 'gethostbyname2',
+ 'gethostbyaddr', 'gethostbyname_r', 'gethostbyname2_r', 'gethostbyaddr_r'])
# regexp for setgid setegid setresgid set(?:res|e)?gid # regexp for setgid setegid setresgid set(?:res|e)?gid
setgid_call_regex = create_regexp_call(['setresgid', 'setegid', 'setgid']) setgid_call_regex = create_regexp_call(['setresgid', 'setegid', 'setgid'])
setuid_call_regex = create_regexp_call(['setresuid', 'seteuid', 'setuid']) setuid_call_regex = create_regexp_call(['setresuid', 'seteuid', 'setuid'])