[Openvas-commits] r421 - in trunk/openvas-libraries: . libopenvas

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Mon Oct 8 23:12:23 CEST 2007


Author: jan
Date: 2007-10-08 23:12:22 +0200 (Mon, 08 Oct 2007)
New Revision: 421

Modified:
   trunk/openvas-libraries/ChangeLog
   trunk/openvas-libraries/libopenvas/harglists.c
   trunk/openvas-libraries/libopenvas/plugutils.c
   trunk/openvas-libraries/libopenvas/www_funcs.c
Log:
Some code cleanups.

* libopenvas/plugutils(plug_get_fresh_key): Fixed wrong number of
arguments for fprintf call.

* libopenvas/harglists.c(harg_addt, harg_set_valuet, harg_renamet): Add
more ()s to make clear && is to be evaluated before ||. This was
suggested by gcc.

* libopenvas/www_funcs.c(http_get, http_head, httpver, http10_head, http10_get,
http10_get_head, http11_head, http11_get): Removed. These functions have never been used.



Modified: trunk/openvas-libraries/ChangeLog
===================================================================
--- trunk/openvas-libraries/ChangeLog	2007-10-08 16:51:05 UTC (rev 420)
+++ trunk/openvas-libraries/ChangeLog	2007-10-08 21:12:22 UTC (rev 421)
@@ -1,3 +1,17 @@
+2007-10-08  Jan-Oliver Wagner <jan-oliver.wagner at intevation.de>
+
+	Some code cleanups.
+
+	* libopenvas/plugutils(plug_get_fresh_key): Fixed wrong number of
+	arguments for fprintf call.
+
+	* libopenvas/harglists.c(harg_addt, harg_set_valuet, harg_renamet): Add
+	more ()s to make clear && is to be evaluated before ||. This was
+	suggested by gcc.
+
+	* libopenvas/www_funcs.c(http_get, http_head, httpver, http10_head, http10_get,
+	http10_get_head, http11_head, http11_get): Removed. These functions have never been used.
+
 2007-10-08  Bernhard Herzog  <bh at intevation.de>
 
 	* libopenvas_hg/Makefile: Install hosts_gatherer.h and hg_utils.h

Modified: trunk/openvas-libraries/libopenvas/harglists.c
===================================================================
--- trunk/openvas-libraries/libopenvas/harglists.c	2007-10-08 16:51:05 UTC (rev 420)
+++ trunk/openvas-libraries/libopenvas/harglists.c	2007-10-08 21:12:22 UTC (rev 421)
@@ -671,8 +671,8 @@
 
   /* sanity check */
   if (a == 0 || key == 0 ||
-      size == 0 && ((value == 0) && is_blob_type (type) ||
-		    verify_simple_type (type, HARG_BLOB))) {
+      (size == 0 && (((value == 0) && is_blob_type(type)) ||
+       verify_simple_type (type, HARG_BLOB)))) {
     errno = EINVAL; 
     return 0;
   }
@@ -735,8 +735,8 @@
 
   /* sanity check */
   if (a == 0 || key == 0 ||
-      size == 0 && (value == 0 && is_blob_type (type) ||
-		    verify_simple_type (type, HARG_BLOB))) {
+      (size == 0 && (((value == 0) && is_blob_type(type)) ||
+       verify_simple_type (type, HARG_BLOB)))) {
     errno = EINVAL; 
     return -1;
   }
@@ -825,8 +825,8 @@
     return 0 ; /* nothing to do */
 
   /* check target type groups */
-  if (is_blob_type   (ntype) &&   is_blob_type (r->type) ||
-      is_scalar_type (ntype) && is_scalar_type (r->type) ||
+  if ((is_blob_type   (ntype) &&   is_blob_type (r->type)) ||
+      (is_scalar_type (ntype) && is_scalar_type (r->type)) ||
       is_specific_type (ntype) == 0) {
     if (same_keys == 0) {
       /* make new index */

Modified: trunk/openvas-libraries/libopenvas/plugutils.c
===================================================================
--- trunk/openvas-libraries/libopenvas/plugutils.c	2007-10-08 16:51:05 UTC (rev 420)
+++ trunk/openvas-libraries/libopenvas/plugutils.c	2007-10-08 21:12:22 UTC (rev 421)
@@ -1415,7 +1415,8 @@
 
  e = internal_send(soc, name, INTERNAL_COMM_MSG_TYPE_KB|INTERNAL_COMM_KB_GET);
  if(e < 0){
-        fprintf(stderr, "[%d] plug_get_fresh_key:internal_send(%d): %s\n",getpid(), soc,name, strerror(errno));
+        fprintf(stderr, "[%d] plug_get_fresh_key:internal_send(%d, %s): %s\n",
+                getpid(), soc, name, strerror(errno));
 	goto err;
 	}
 

Modified: trunk/openvas-libraries/libopenvas/www_funcs.c
===================================================================
--- trunk/openvas-libraries/libopenvas/www_funcs.c	2007-10-08 16:51:05 UTC (rev 420)
+++ trunk/openvas-libraries/libopenvas/www_funcs.c	2007-10-08 21:12:22 UTC (rev 421)
@@ -518,121 +518,3 @@
  efree(&url);
  return ret;		
 }
-
-static char *
-http11_get(port, data, path, name)
- struct arglist * data;
- int	port;
- char *  path;
- char *  name;
-{
-  return http11_get_head(port, data, path, name, "GET");
-}
-
-static char *
-http11_head(port, data, path, name)
- struct arglist * data;
- int	port;
- char *  path;
- char *  name;
-{
-  return http11_get_head(port, data, path, name, "HEAD");
-}
-
-/* ******** */
-
-static char *
-http10_get_head(port, data, path, name, method)
- struct arglist * data;
- int	port;
- char *  path;
- char *  name;
- char *  method;
-{
- char * url = build_encode_URL(data, method, path, name, "HTTP/1.0"); 
- char * ret;
- char * auth_string, tmp[32];
- struct kb_item ** kb = plug_get_kb(data);
-
- snprintf(tmp, sizeof(tmp), "/tmp/http/auth/%d", port);
- auth_string = kb_item_get_str(kb, tmp);
- if (auth_string == NULL)
-   auth_string = kb_item_get_str(kb, "http/auth");
- 
- ret = emalloc(strlen(url) + 1024 + (auth_string ? strlen(auth_string) : 0));
- 
- sprintf(ret, "%s\r\n%s\r\n%s",
-		url,
-		auth_string?auth_string:"",
-		auth_string?"\r\n":"");
- efree(&url);
- return ret;
-}
-
-static char *
-http10_get(port, data, path, name)
- struct arglist * data;
- int	port;
- char *  path;
- char *  name;
-{
-  return http10_get_head(port, data, path, name, "GET");
-}
-
-static char *
-http10_head(port, data, path, name)
- struct arglist * data;
- int	port;
- char *  path;
- char *  name;
-{
-  return http10_get_head(port, data, path, name, "HEAD");
-}
-
-/* ******** */
-
-static char *
-http_get(port, data, ver, path, name)
- int	port;
- struct arglist * data;
- int ver;
- char *  path;
- char *  name;
-{
- if(ver == 10)
-  return http10_get(port, data, path, name);
- else
-  return http11_get(port, data, path, name);
-}
-
-static char *
-http_head(port, data, ver, path, name)
- struct arglist * data;
- int	port;
- int ver;
- char *  path;
- char *  name;
-{
- if(ver == 11)
-  return http11_head(port, data, path, name);
- else
-  return http10_head(port, data, path, name);
-}
-
-static int 
-httpver(data, port)
- struct arglist * data;
- int port;
-{
- char req[255];
- int value;
- bzero(req, sizeof(req));
- snprintf(req, sizeof(req), "http/%d", port);
- value = kb_item_get_int(plug_get_kb(data), req);
- if ( value <= 0 )
-    return 11;
- else
-    return value;
-}
-
-



More information about the Openvas-commits mailing list