[Openvas-commits] r5648 - in trunk/openvas-scanner: . openvassd

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Tue Oct 20 16:42:57 CEST 2009


Author: jan
Date: 2009-10-20 16:42:55 +0200 (Tue, 20 Oct 2009)
New Revision: 5648

Modified:
   trunk/openvas-scanner/ChangeLog
   trunk/openvas-scanner/openvassd/attack.c
   trunk/openvas-scanner/openvassd/comm.c
   trunk/openvas-scanner/openvassd/comm.h
   trunk/openvas-scanner/openvassd/ntp_11.c
   trunk/openvas-scanner/openvassd/openvassd.c
   trunk/openvas-scanner/openvassd/utils.c
   trunk/openvas-scanner/openvassd/utils.h
Log:
Removing remains of old ntp_caps.

* openvassd/utils.c (plugins_set_ntp_caps): Removed.

* openvassd/utils.h: Removed proto accordingly.

* openvassd/openvassd.c (scanner_thread): Removed call to
set global ntp_caps. Removed call of plugins_set_ntp_caps
which initalized the plugins with the gobal ntp_caps.

* openvassd/comm.c (comm_init): changed return value from
ntp_caps to just int, specifiying the protocol version.

* openvassd/comm.h: Adjusted proto accordingly.

* openvassd/attack.c, openvassd/utils.c, openvassd/ntp_11.c:
Removed unnecessary include of ntp.h. 



Modified: trunk/openvas-scanner/ChangeLog
===================================================================
--- trunk/openvas-scanner/ChangeLog	2009-10-20 12:26:56 UTC (rev 5647)
+++ trunk/openvas-scanner/ChangeLog	2009-10-20 14:42:55 UTC (rev 5648)
@@ -1,3 +1,23 @@
+2009-10-20  Jan-Oliver Wagner <jan-oliver.wagner at greenbone.net>
+
+	Removing remains of old ntp_caps.
+
+	* openvassd/utils.c (plugins_set_ntp_caps): Removed.
+
+	* openvassd/utils.h: Removed proto accordingly.
+
+	* openvassd/openvassd.c (scanner_thread): Removed call to
+	set global ntp_caps. Removed call of plugins_set_ntp_caps
+	which initalized the plugins with the gobal ntp_caps.
+
+	* openvassd/comm.c (comm_init): changed return value from
+	ntp_caps to just int, specifiying the protocol version.
+
+	* openvassd/comm.h: Adjusted proto accordingly.
+
+	* openvassd/attack.c, openvassd/utils.c, openvassd/ntp_11.c:
+	Removed unnecessary include of ntp.h. 
+
 2009-10-19  Michael Wiegand <michael.wiegand at intevation.de>
 
 	Post-release version bump.

Modified: trunk/openvas-scanner/openvassd/attack.c
===================================================================
--- trunk/openvas-scanner/openvassd/attack.c	2009-10-20 12:26:56 UTC (rev 5647)
+++ trunk/openvas-scanner/openvassd/attack.c	2009-10-20 14:42:55 UTC (rev 5648)
@@ -45,7 +45,6 @@
 #include "comm.h"
 #include "hosts.h"
 #include "log.h"
-#include "ntp.h"
 #include "ntp_11.h"
 #include "openvas_ssh_login.h"
 #include "pluginlaunch.h"

Modified: trunk/openvas-scanner/openvassd/comm.c
===================================================================
--- trunk/openvas-scanner/openvassd/comm.c	2009-10-20 12:26:56 UTC (rev 5647)
+++ trunk/openvas-scanner/openvassd/comm.c	2009-10-20 14:42:55 UTC (rev 5648)
@@ -40,7 +40,7 @@
 
 #include "comm.h"
 #include "network.h" /* for recv_line */
-#include "ntp.h"
+#include "ntp.h" /* for OTP_10 */
 #include "ntp_11.h"
 #include "log.h"
 #include "plugs_hash.h"
@@ -63,14 +63,14 @@
 /**
  * @brief Initializes the communication between the scanner (us) and the client.
  */
-ntp_caps*
+int
 comm_init (int soc)
 {
   char buf[1024];
-  ntp_caps* caps = emalloc(sizeof(ntp_caps));
+  int version = 0;
   int n;
 
-  /* We must read the version of the NTP the client
+  /* We must read the version of the OTP the client
      wants us to use */
   n = recv_line(soc, buf, sizeof(buf) - 1);
   if(n <= 0)
@@ -79,16 +79,15 @@
   buf[sizeof(buf) - 1] = '\0';
   if(!strncmp(buf, "< OTP/1.0 >", 11))
     {
-      caps->ntp_version = OTP_10;
+      version = OTP_10;
       nsend(soc, "< OTP/1.0 >\n", 12, 0);
     }
-  /*ENABLE_CRYPTO_LAYER*/
   else
     {
       EXIT(0);
     }
   log_write ("Client requested protocol %s.\n", buf);
-  return(caps);
+  return(version);
 }
 
 

Modified: trunk/openvas-scanner/openvassd/comm.h
===================================================================
--- trunk/openvas-scanner/openvassd/comm.h	2009-10-20 12:26:56 UTC (rev 5647)
+++ trunk/openvas-scanner/openvassd/comm.h	2009-10-20 14:42:55 UTC (rev 5648)
@@ -30,10 +30,9 @@
 #ifndef _OPENVAS_COMM_H
 #define _OPENVAS_COMM_H
 
-#include "ntp.h" /* for struct ntp_caps */
 #include <openvas/arglists.h> /* for struct arglist */
 
-ntp_caps* comm_init(int);
+int comm_init(int);
 void comm_terminate(struct arglist *);
 void comm_send_pluginlist(struct arglist *);
 void comm_send_preferences(struct arglist *);

Modified: trunk/openvas-scanner/openvassd/ntp_11.c
===================================================================
--- trunk/openvas-scanner/openvassd/ntp_11.c	2009-10-20 12:26:56 UTC (rev 5647)
+++ trunk/openvas-scanner/openvassd/ntp_11.c	2009-10-20 14:42:55 UTC (rev 5648)
@@ -35,7 +35,6 @@
 #include <openvas/plugutils.h> /* for plug_get_name */
 #include <openvas/system.h> /* for emalloc */
 
-#include "ntp.h"
 #include "ntp_11.h"
 #include "otp_1_0.h"
 #include "comm.h"

Modified: trunk/openvas-scanner/openvassd/openvassd.c
===================================================================
--- trunk/openvas-scanner/openvassd/openvassd.c	2009-10-20 12:26:56 UTC (rev 5647)
+++ trunk/openvas-scanner/openvassd/openvassd.c	2009-10-20 14:42:55 UTC (rev 5648)
@@ -78,7 +78,6 @@
 #include "log.h"
 #include "processes.h"
 #include "users.h"
-#include "ntp.h"
 #include "ntp_11.h"
 #include "utils.h"
 #include "corevers.h"
@@ -332,7 +331,7 @@
  struct openvas_rules* perms;
  char * asciiaddr;
  struct openvas_rules * rules = arg_get_value(globals, "rules");
- ntp_caps* caps;
+ int protocol_version;
  int e;
  int opt = 1;
  void *addr = arg_get_value (globals, "client_address");
@@ -412,16 +411,14 @@
    efree (&addrstr);
  }
 #endif
- caps = comm_init(soc2);
- if(!caps)
+ protocol_version = comm_init(soc2);
+ if(!protocol_version)
  {
   log_write("New connection timeout -- closing the socket\n");
   close_stream_connection(soc);
   EXIT(0);
  }
- arg_add_value(globals, "ntp_caps", ARG_STRUCT, sizeof(*caps), caps);
 
-
  if(((perms = auth_check_user(globals, asciiaddr, x509_dname))==BAD_LOGIN_ATTEMPT)||
    !perms)
  {
@@ -470,7 +467,6 @@
 #endif
    comm_wait_order (globals);
    preferences_reset_cache ();
-   plugins_set_ntp_caps (plugins, arg_get_value(globals, "ntp_caps"));
    rules = arg_get_value (globals, "rules");
    ntp_1x_timestamp_scan_starts (globals);
    e = attack_network (globals);

Modified: trunk/openvas-scanner/openvassd/utils.c
===================================================================
--- trunk/openvas-scanner/openvassd/utils.c	2009-10-20 12:26:56 UTC (rev 5647)
+++ trunk/openvas-scanner/openvassd/utils.c	2009-10-20 14:42:55 UTC (rev 5648)
@@ -34,7 +34,6 @@
 #include <openvas/system.h> /* for emalloc */
 
 #include "log.h"
-#include "ntp.h"
 #include "auth.h"
 #include "comm.h"
 #include "ntp_11.h"
@@ -226,35 +225,6 @@
  return num;
 }
 
-
-
-
-void
-plugins_set_ntp_caps (struct arglist * plugins, ntp_caps* caps)
-{
- if(!caps || !plugins)return;
- while(plugins->next)
- {
-  struct arglist * v;
-  if( plugins->value != NULL )
-   v = plugins->value;
-  else 
-   v = NULL;
-
-  if( v != NULL ){
-	struct ntp_caps * old = arg_get_value(v, "NTP_CAPS");
-	if ( old != NULL )
-		arg_set_value(v, "NTP_CAPS", sizeof(*caps), caps);
-	else
-		arg_add_value(v, "NTP_CAPS", ARG_STRUCT, sizeof(*caps), caps);
-	}
-
-  plugins = plugins->next;
- }
-}
-
-
-
 /*--------------------------------------------------------------------*/
 
 

Modified: trunk/openvas-scanner/openvassd/utils.h
===================================================================
--- trunk/openvas-scanner/openvassd/utils.h	2009-10-20 12:26:56 UTC (rev 5647)
+++ trunk/openvas-scanner/openvassd/utils.h	2009-10-20 14:42:55 UTC (rev 5648)
@@ -31,7 +31,6 @@
 #ifndef _OPENVAS_UTILS_H
 #define _OPENVAS_UTILS_H
 
-#include "ntp.h" /* for struct ntp_caps */
 #include <openvas/arglists.h> /* for struct arglist */
 
 struct attack_atom
@@ -45,7 +44,6 @@
 int get_max_hosts_number(struct arglist *, struct arglist *);
 int get_max_checks_number(struct arglist *, struct arglist *);
 int get_active_plugins_number(struct arglist *);
-void plugins_set_ntp_caps(struct arglist *, ntp_caps*);
 void send_plugin_order(struct arglist *, struct arglist *);
 int check_threads_input(struct attack_atom **, int, struct arglist *);
 int is_symlink(char *);



More information about the Openvas-commits mailing list