SHA256
1
0
forked from pool/rpmlint
rpmlint/rpmlint-check-gethostbyname.patch

147 lines
4.1 KiB
Diff

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