[openvas-libraries] Commiting Michal Amborz' changes
Stjepan Gros
sgros at fedoraproject.org
Wed Mar 23 21:33:20 UTC 2011
commit ad3402933e3b84b78af10defbc21ba3c943e5af4
Author: Stjepan Gros <stjepan.gros at gmail.com>
Date: Wed Mar 23 22:32:49 2011 +0100
Commiting Michal Amborz' changes
openvas-libraries-notused.patch | 366 +++++++++++++++++++++++++++++++++++++++
openvas-libraries.spec | 15 ++-
2 files changed, 377 insertions(+), 4 deletions(-)
---
diff --git a/openvas-libraries-notused.patch b/openvas-libraries-notused.patch
new file mode 100644
index 0000000..0a76c59
--- /dev/null
+++ b/openvas-libraries-notused.patch
@@ -0,0 +1,366 @@
+New version of gcc used for fedora 15 is reporting errors with -Werror also for
+variables set, but never used.
+Where it was obvious I fixed the code. In other cases avoid this error by
+(void) variable
+diff -ru openvas-libraries-4.0.3.old/misc/network.c openvas-libraries-4.0.3.new/misc/network.c
+--- openvas-libraries-4.0.3.old/misc/network.c 2011-03-03 09:44:22.000000000 +0100
++++ openvas-libraries-4.0.3.new/misc/network.c 2011-03-22 23:58:10.000000000 +0100
+@@ -137,6 +137,9 @@
+ // @todo: Check value if renice_result to see if it was successful.
+ // Keep in mind that even -1 can mean success here; see man page of nice
+ // for details.
++
++ // renice set but not used - workaround
++ (void) renice_result;
+ }
+ }
+
+diff -ru openvas-libraries-4.0.3.old/misc/plugutils.c openvas-libraries-4.0.3.new/misc/plugutils.c
+--- openvas-libraries-4.0.3.old/misc/plugutils.c 2011-03-03 09:44:22.000000000 +0100
++++ openvas-libraries-4.0.3.new/misc/plugutils.c 2011-03-23 00:16:53.000000000 +0100
+@@ -1550,7 +1550,7 @@
+ socketpair (AF_UNIX, SOCK_STREAM, 0, sockpair);
+ if ((pid = fork ()) == 0)
+ {
+- int tictac = 0;
++ int tictac = 120;
+ int old, soc;
+ struct arglist *globals, *preferences = NULL;
+
+@@ -1578,7 +1578,7 @@
+
+ sig_term (_exit);
+ sig_alarm (_exit);
+- alarm (120);
++ alarm (tictac);
+
+
+ if (res->type == KB_TYPE_INT)
+diff -ru openvas-libraries-4.0.3.old/nasl/charcnv.c openvas-libraries-4.0.3.new/nasl/charcnv.c
+--- openvas-libraries-4.0.3.old/nasl/charcnv.c 2011-03-03 09:44:22.000000000 +0100
++++ openvas-libraries-4.0.3.new/nasl/charcnv.c 2011-03-23 00:24:39.000000000 +0100
+@@ -330,19 +330,21 @@
+
+ retval = smb_iconv_ntlmssp(descriptor, &inbuf, &i_len, &outbuf, &o_len);
+ if(retval==(size_t)-1) {
++ /* variable reason set but never used
+ const char *reason="unknown error";
++ */
+ switch(errno) {
+ case EINVAL:
+- reason="Incomplete multibyte sequence";
++ /* reason="Incomplete multibyte sequence"; */
+ if (!conv_silent_ntlmssp)
+ if (allow_bad_conv)
+ goto use_as_is;
+ return (size_t)-1;
+ case E2BIG:
+- reason="No more room";
++ /* reason="No more room"; */
+ break;
+ case EILSEQ:
+- reason="Illegal multibyte sequence";
++ /* reason="Illegal multibyte sequence"; */
+ if (allow_bad_conv)
+ goto use_as_is;
+
+diff -ru openvas-libraries-4.0.3.old/nasl/nasl_builtin_openvas_tcp_scanner.c openvas-libraries-4.0.3.new/nasl/nasl_builtin_openvas_tcp_scanner.c
+--- openvas-libraries-4.0.3.old/nasl/nasl_builtin_openvas_tcp_scanner.c 2011-03-03 09:44:22.000000000 +0100
++++ openvas-libraries-4.0.3.new/nasl/nasl_builtin_openvas_tcp_scanner.c 2011-03-23 00:45:55.000000000 +0100
+@@ -691,6 +691,8 @@
+ if (rtt_max[0] > 0 || ping_rtt > 0)
+ {
+ int y;
++ /* avoid compile warning - y is used only in debug output */
++ (void) y;
+ if (rtt_max[0] > 0)
+ y = x = rtt_max[0];
+ else
+diff -ru openvas-libraries-4.0.3.old/nasl/nasl_builtin_synscan.c openvas-libraries-4.0.3.new/nasl/nasl_builtin_synscan.c
+--- openvas-libraries-4.0.3.old/nasl/nasl_builtin_synscan.c 2011-03-03 09:44:22.000000000 +0100
++++ openvas-libraries-4.0.3.new/nasl/nasl_builtin_synscan.c 2011-03-23 00:49:21.000000000 +0100
+@@ -927,7 +927,9 @@
+ struct in6_addr *dst6 = plug_get_host_ip (env);
+ struct in_addr *dst;
+ struct in_addr inaddr;
++#ifdef DEBUG
+ struct timeval tv;
++#endif
+
+ inaddr.s_addr = dst6->s6_addr32[3];
+ dst = &inaddr;
+@@ -944,14 +946,9 @@
+ rtt = htonl (1 << 28);
+
+ #ifdef DEBUG
+- printf ("RTT = 0x%.8x\n", ntohl (rtt));
+-#endif
+-
+- /** @TODO belongs to debug section? */
++ printf ("RTT = 0x%.8x\n", ntohl (rtt));
+ tv = timeval (rtt);
+-
+-#ifdef DEBUG
+- printf ("That's %ld seconds and %ld usecs\n", tv.tv_sec, tv.tv_usec);
++ printf ("That's %ld seconds and %ld usecs\n", tv.tv_sec, tv.tv_usec);
+ #endif
+
+ struct arglist *hostinfos = arg_get_value (env, "HOSTNAME");
+diff -ru openvas-libraries-4.0.3.old/nasl/nasl_func.c openvas-libraries-4.0.3.new/nasl/nasl_func.c
+--- openvas-libraries-4.0.3.old/nasl/nasl_func.c 2011-03-03 09:44:22.000000000 +0100
++++ openvas-libraries-4.0.3.new/nasl/nasl_func.c 2011-03-23 01:22:50.000000000 +0100
+@@ -50,6 +50,9 @@
+ nasl_func *v, *prev;
+ lex_ctxt *c;
+
++ /* avoid compile warning - prev is set but not used */
++ (void) prev;
++
+ for (c = ctxt; c != NULL; c = c->up_ctxt)
+ {
+ for (prev = NULL, v = c->functions[h]; v != NULL; v = v->next_func)
+diff -ru openvas-libraries-4.0.3.old/nasl/nasl_host.c openvas-libraries-4.0.3.new/nasl/nasl_host.c
+--- openvas-libraries-4.0.3.old/nasl/nasl_host.c 2011-03-03 09:44:22.000000000 +0100
++++ openvas-libraries-4.0.3.new/nasl/nasl_host.c 2011-03-23 01:31:41.000000000 +0100
+@@ -155,11 +155,17 @@
+ struct arglist *script_infos = lexic->script_infos;
+ struct in6_addr *dst = plug_get_host_ip (script_infos);
+ tree_cell *retc;
++ /* variable inaddr set but never used
+ struct in_addr inaddr;
++ */
+
+ retc = alloc_tree_cell (0, NULL);
+ retc->type = CONST_INT;
++
++ /* inaddr set but not used causing compile time warnings
+ inaddr.s_addr = dst->s6_addr32[3];
++ */
++
+ retc->x.i_val = v6_islocalhost (dst);
+ return retc;
+ }
+@@ -171,11 +174,15 @@
+ struct arglist *script_infos = lexic->script_infos;
+ struct in6_addr *ip = plug_get_host_ip (script_infos);
+ tree_cell *retc;
+- struct in_addr inaddr;
++ /* struct in_addr inaddr; */
+
+ retc = alloc_tree_cell (0, NULL);
+ retc->type = CONST_INT;
++
++ /* inaddr not used causing compile errors
+ inaddr.s_addr = ip->s6_addr32[3];
++ */
++
+ retc->x.i_val = v6_is_local_ip (ip);
+ return retc;
+ }
+diff -ru openvas-libraries-4.0.3.old/nasl/nddasl_misc_funcs.c openvas-libraries-4.0.3.new/nasl/nasl_misc_funcs.c
+--- openvas-libraries-4.0.3.old/nasl/nasl_misc_funcs.c 2011-03-03 09:44:22.000000000 +0100
++++ openvas-libraries-4.0.3.new/nasl/nasl_misc_funcs.c 2011-03-23 01:33:18.000000000 +0100
+@@ -430,7 +430,8 @@
+ nasl_make_array (lex_ctxt * lexic)
+ {
+ tree_cell *retc = NULL;
+- int i, vi;
++ /* variable i was set but not used */
++ int vi;
+ anon_nasl_var *v, *v2;
+ nasl_array *a;
+
+@@ -439,7 +440,7 @@
+ retc->type = DYN_ARRAY;
+ retc->x.ref_val = a = emalloc (sizeof (nasl_array));
+
+- i = vi = 0;
++ vi = 0;
+ while ((v = nasl_get_var_by_num (&lexic->ctx_vars, vi++, 0)) != NULL)
+ {
+ v2 = nasl_get_var_by_num (&lexic->ctx_vars, vi++, 0);
+diff -ru openvas-libraries-4.0.3.old/nasl/nasl_packet_forgery.c openvas-libraries-4.0.3.new/nasl/nasl_packet_forgery.c
+--- openvas-libraries-4.0.3.old/nasl/nasl_packet_forgery.c 2011-03-03 09:44:22.000000000 +0100
++++ openvas-libraries-4.0.3.new/nasl/nasl_packet_forgery.c 2011-03-23 01:37:37.000000000 +0100
+@@ -465,7 +465,8 @@
+ tree_cell *retc;
+ char *data;
+ int len;
+- u_char *pkt;
++ /* variable pkt set but not used */
++ /* u_char *pkt; */
+ struct ip *ip, *tcp_packet;
+ struct tcphdr *tcp;
+ int ipsz;
+@@ -492,7 +493,8 @@
+ retc->type = CONST_DATA;
+ tcp_packet = (struct ip *) emalloc (ipsz + sizeof (struct tcphdr) + len);
+ retc->x.str_val = (char *) tcp_packet;
+- pkt = (u_char *) tcp_packet;
++ /* variable pkt set but not used */
++ /* pkt = (u_char *) tcp_packet; */
+
+ bcopy (ip, tcp_packet, ipsz);
+ /* recompute the ip checksum, because the ip length changed */
+@@ -1409,13 +1411,17 @@
+ { 139, 135, 445, 80, 22, 515, 23, 21, 6000, 1025, 25, 111, 1028, 9100, 1029,
+ 79, 497, 548, 5000, 1917, 53, 161, 9001, 65535, 443, 113, 993, 8080, 0 };
+ int num_ports = 0;
+- struct in_addr *pinaddr;
++ /* variable pinaddr set but not used
++ struct in_addr *pinaddr;
++ */
+ struct in_addr inaddr;
+
+ if (dst == NULL || (IN6_IS_ADDR_V4MAPPED (dst) != 1))
+ return NULL;
+ inaddr.s_addr = dst->s6_addr32[3];
++ /* variable pinaddr set but not used
+ pinaddr = &inaddr;
++ */
+ for (i = 0; i < sizeof (sports) / sizeof (int); i++)
+ {
+ if (sports[i] == 0)
+diff -ru openvas-libraries-4.0.3.old/nasl/nasl_packet_forgery_v6.c openvas-libraries-4.0.3.new/nasl/nasl_packet_forgery_v6.c
+--- openvas-libraries-4.0.3.old/nasl/nasl_packet_forgery_v6.c 2011-03-03 09:44:22.000000000 +0100
++++ openvas-libraries-4.0.3.new/nasl/nasl_packet_forgery_v6.c 2011-03-23 01:46:50.000000000 +0100
+@@ -292,9 +292,11 @@
+ tree_cell *retc = alloc_tree_cell (0, NULL);
+ struct ip6_hdr *pkt;
+ char *s;
++ /* variables ver,tc,fl set but not used
+ int ver;
+ int tc;
+ int fl;
++ */
+
+ if (o_pkt == NULL)
+ {
+@@ -305,10 +307,11 @@
+ pkt = (struct ip6_hdr *) emalloc (size);
+ bcopy (o_pkt, pkt, size);
+
++ /* variables ver,tc,fl set but not used
+ ver = get_int_local_var_by_name (lexic, "ip6_v", (pkt->ip6_flow & 0x3ffff));
+- tc =
+- get_int_local_var_by_name (lexic, "ip6_tc", (pkt->ip6_flow >> 20) & 0xff);
++ tc = get_int_local_var_by_name (lexic, "ip6_tc", (pkt->ip6_flow >> 20) & 0xff);
+ fl = get_int_local_var_by_name (lexic, "ip6_fl", pkt->ip6_flow >> 28);
++ */
+
+ pkt->ip6_plen = get_int_local_var_by_name (lexic, "ip6_plen", pkt->ip6_plen);
+ pkt->ip6_nxt = get_int_local_var_by_name (lexic, "ip6_nxt", pkt->ip6_nxt);
+@@ -476,7 +479,9 @@
+ tree_cell *retc;
+ char *data;
+ int len;
++ /* variable pkt set but not used
+ u_char *pkt;
++ */
+ struct ip6_hdr *ip6, *tcp_packet;
+ struct tcphdr *tcp;
+ int ipsz;
+@@ -502,7 +507,9 @@
+ retc->type = CONST_DATA;
+ tcp_packet = (struct ip6_hdr *) emalloc (ipsz + sizeof (struct tcphdr) + len);
+ retc->x.str_val = (char *) tcp_packet;
++ /* variable pkt set but not used
+ pkt = (u_char *) tcp_packet;
++ */
+
+ bcopy (ip6, tcp_packet, ipsz);
+ /* Adjust length in ipv6 header */
+@@ -949,7 +956,9 @@
+ tree_cell *retc;
+ char *udp;
+ char *element;
++ /* variable ip6 set but not used
+ struct ip6_hdr *ip6;
++ */
+ int ipsz;
+ struct udphdr *udphdr;
+ int ret;
+@@ -964,7 +973,9 @@
+ printf ("element = get_udp_v6_element(udp:<udp>,element:<element>\n");
+ return NULL;
+ }
++ /* variable ip6 set but not used
+ ip6 = (struct ip6_hdr *) udp;
++ */
+
+ if (40 + sizeof (struct udphdr) > ipsz)
+ return NULL;
+diff -ru openvas-libraries-4.0.3.old/nasl/nasl_var.c openvas-libraries-4.0.3.new/nasl/nasl_var.c
+--- openvas-libraries-4.0.3.old/nasl/nasl_var.c 2011-03-03 09:44:22.000000000 +0100
++++ openvas-libraries-4.0.3.new/nasl/nasl_var.c 2011-03-23 01:49:31.000000000 +0100
+@@ -130,6 +130,9 @@
+ int h = hash_str (name);
+ lex_ctxt *c;
+
++ /* avoid compile time error - prev is set but never used */
++ (void) prev;
++
+ if (climb != 0)
+ {
+ for (c = ctxt; c != NULL; c = c->up_ctxt)
+diff -ru openvas-libraries-4.0.3.old/nasl/regex.c openvas-libraries-4.0.3.new/nasl/regex.c
+--- openvas-libraries-4.0.3.old/nasl/regex.c 2011-03-03 09:44:22.000000000 +0100
++++ openvas-libraries-4.0.3.new/nasl/regex.c 2011-03-23 01:52:50.000000000 +0100
+@@ -4058,6 +4058,10 @@
+ unsigned char *pdummy;
+ const char *sdummy;
+
++ /*avoid compile time error - sdummy,pdummy set but never used */
++ (void) sdummy;
++ (void) pdummy;
++
+ DEBUG_PRINT1 ("EXECUTING pop_failure_jump.\n");
+ POP_FAILURE_POINT (sdummy, pdummy,
+ dummy_low_reg, dummy_high_reg,
+diff -ru openvas-libraries-4.0.3.old/nasl/smb_crypt.c openvas-libraries-4.0.3.new/nasl/smb_crypt.c
+--- openvas-libraries-4.0.3.old/nasl/smb_crypt.c 2011-03-03 09:44:22.000000000 +0100
++++ openvas-libraries-4.0.3.new/nasl/smb_crypt.c 2011-03-23 01:55:32.000000000 +0100
+@@ -455,10 +455,17 @@
+
+ void SMBencrypt_ntlmssp(const char *passwd, const uchar *c8, uchar p24[24])
+ {
++ /* variable ret set but not used
+ bool ret;
++ */
++
+ uchar lm_hash[16];
+
++ /* variable ret set but not used
+ ret = E_deshash_ntlmssp(passwd, lm_hash);
++ */
++
++ E_deshash_ntlmssp(passwd, lm_hash);
+ SMBencrypt_hash_ntlmssp(lm_hash, c8, p24);
+ }
+
+diff -ru openvas-libraries-4.0.3.old/omp/omp.c openvas-libraries-4.0.3.new/omp/omp.c
+--- openvas-libraries-4.0.3.old/omp/omp.c 2011-03-03 09:44:22.000000000 +0100
++++ openvas-libraries-4.0.3.new/omp/omp.c 2011-03-23 01:59:06.000000000 +0100
+@@ -2274,8 +2274,11 @@
+ int
+ omp_get_system_reports (gnutls_session_t* session, const char* name, int brief,
+ entity_t *reports)
+-{
++{
++ /* variable ret set but never used
+ int ret;
++ */
++
+ const char *status_code;
+
+ if (name)
+@@ -2312,7 +2315,9 @@
+ return -1;
+ }
+ if (status_code[0] == '2') return 0;
++ /* variable ret set but never used
+ ret = (int) strtol (status_code, NULL, 10);
++ */
+ free_entity (*reports);
+ if (errno == ERANGE) return -1;
+ return 1;
diff --git a/openvas-libraries.spec b/openvas-libraries.spec
index 7516b59..bd168e3 100644
--- a/openvas-libraries.spec
+++ b/openvas-libraries.spec
@@ -1,11 +1,12 @@
Name: openvas-libraries
Summary: Support libraries for Open Vulnerability Assessment (OpenVAS) Scanner
-Version: 4.0.3
-Release: 1%{?dist}
-Source0: http://wald.intevation.org/frs/download.php/859/%{name}-%{version}.tar.gz
URL: http://www.openvas.org
-License: LGPLv2
+License: LGPLv2
Group: System Environment/Libraries
+Version: 4.0.3
+Release: 2%{?dist}
+Source0: http://wald.intevation.org/frs/download.php/859/%{name}-%{version}.tar.gz
+Patch0: openvas-libraries-notused.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
Obsoletes: openvas-libnasl
BuildRequires: glib2-devel
@@ -34,8 +35,11 @@ Development libraries and headers for use with openvas-libraries.
%prep
%setup -q
+%patch0 -p 1 -b notused.patch
+
%build
+#export CFLAGS=-Werror=unused-but-set-variable
%cmake -DLOCALSTATEDIR:PATH=%{_var}
# No parallel build because it causes compilation problems
make
@@ -82,6 +86,9 @@ rm -rf %{buildroot}
%{_libdir}/pkgconfig/libopenvas.pc
%changelog
+* Tue Mar 22 2011 Michal Ambroz <rebus at, seznam.cz> - 4.0.3-2
+- patch not used
+
* Fri Mar 18 2011 Michal Ambroz <rebus at, seznam.cz> - 4.0.3-1
- Bump to latest stable release 4
More information about the scm-commits
mailing list