Author: mattm
Date: 2017-08-12 13:27:14 +0200 (Sat, 12 Aug 2017)
New Revision: 29340

Modified:
   trunk/gvm/ChangeLog
   trunk/gvm/src/gmp.c
   trunk/gvm/src/gmp.h
   trunk/gvm/src/gmpd.c
   trunk/gvm/src/gmpd.h
   trunk/gvm/src/gvmd.c
   trunk/gvm/src/manage.h
   trunk/gvm/src/manage_sql.c
   trunk/gvm/src/otp.c
   trunk/gvm/src/otp.h
Log:
        Remove --progress.  Was only used by --rebuild and --update.

        * src/gmp.c (init_gmp): Remove progress.

        * src/gmpd.c (init_gmpd, serve_gmp): Remove progress.

        * src/manage_sql.c (progress): Remove.
        (manage_option_setup): Update call.
        (check_db, init_manage_internal, init_manage)
        (init_manage_helper): Remove progress.

        * src/otp.c (parse_scanner_preference_value)
        (process_otp_scanner_input): Remove progress.

        * src/gmp.h, src/gmpd.h, src/manage.h, src/otp.h: Update headers
        accordingly.

        * src/gvmd.c (serve_client): Update call.
        (spin_progress): Remove.  No longer used.
        (update_or_rebuild_nvt_cache, rebuild_nvt_cache_retry): Remove progress.
        (fork_update_nvt_cache): Update call.
        (main): Remove --progress.  Update call.

Modified: trunk/gvm/ChangeLog
===================================================================
--- trunk/gvm/ChangeLog 2017-08-12 10:10:31 UTC (rev 29339)
+++ trunk/gvm/ChangeLog 2017-08-12 11:27:14 UTC (rev 29340)
@@ -1,5 +1,30 @@
 2017-08-10  Matthew Mundell <matthew.mund...@greenbone.net>
 
+       Remove --progress.  Was only used by --rebuild and --update.
+
+       * src/gmp.c (init_gmp): Remove progress.
+
+       * src/gmpd.c (init_gmpd, serve_gmp): Remove progress.
+
+       * src/manage_sql.c (progress): Remove.
+       (manage_option_setup): Update call.
+       (check_db, init_manage_internal, init_manage)
+       (init_manage_helper): Remove progress.
+
+       * src/otp.c (parse_scanner_preference_value)
+       (process_otp_scanner_input): Remove progress.
+
+       * src/gmp.h, src/gmpd.h, src/manage.h, src/otp.h: Update headers
+       accordingly.
+
+       * src/gvmd.c (serve_client): Update call.
+       (spin_progress): Remove.  No longer used.
+       (update_or_rebuild_nvt_cache, rebuild_nvt_cache_retry): Remove progress.
+       (fork_update_nvt_cache): Update call.
+       (main): Remove --progress.  Update call.
+
+2017-08-10  Matthew Mundell <matthew.mund...@greenbone.net>
+
        * src/gvmd.c (main): Remove --update and --rebuild now that NVTs are
        auto synced.  Also remove --otp-scanner, which was only used by those
        two.

Modified: trunk/gvm/src/gmp.c
===================================================================
--- trunk/gvm/src/gmp.c 2017-08-12 10:10:31 UTC (rev 29339)
+++ trunk/gvm/src/gmp.c 2017-08-12 11:27:14 UTC (rev 29340)
@@ -30489,7 +30489,7 @@
 int
 init_gmp (GSList *log_config, int nvt_cache_mode, const gchar *database,
           int max_ips_per_target, int max_email_attachment_size,
-          int max_email_include_size, void (*progress) (),
+          int max_email_include_size,
           int (*fork_connection) (gvm_connection_t *, gchar*),
           int skip_db_check)
 {
@@ -30500,7 +30500,7 @@
   command_data_init (&command_data);
   return init_manage (log_config, nvt_cache_mode, database, max_ips_per_target,
                       max_email_attachment_size, max_email_include_size,
-                      progress, fork_connection, skip_db_check);
+                      fork_connection, skip_db_check);
 }
 
 /**

Modified: trunk/gvm/src/gmp.h
===================================================================
--- trunk/gvm/src/gmp.h 2017-08-12 10:10:31 UTC (rev 29339)
+++ trunk/gvm/src/gmp.h 2017-08-12 11:27:14 UTC (rev 29340)
@@ -38,7 +38,7 @@
 #define TO_CLIENT_BUFFER_SIZE 26214400
 
 int
-init_gmp (GSList*, int, const gchar*, int, int, int, void (*) (),
+init_gmp (GSList*, int, const gchar*, int, int, int,
           int (*) (gvm_connection_t *, gchar*),
           int);
 

Modified: trunk/gvm/src/gmpd.c
===================================================================
--- trunk/gvm/src/gmpd.c        2017-08-12 10:10:31 UTC (rev 29339)
+++ trunk/gvm/src/gmpd.c        2017-08-12 11:27:14 UTC (rev 29340)
@@ -104,7 +104,6 @@
  * @param[in]  max_ips_per_target  Max number of IPs per target.
  * @param[in]  max_email_attachment_size  Max size of email attachments.
  * @param[in]  max_email_include_size     Max size of email inclusions.
- * @param[in]  progress         Function to update progress, or NULL.
  * @param[in]  fork_connection  Function to fork a connection to the GMP
  *                              daemon layer, or NULL.
  * @param[in]  skip_db_check    Skip DB check.
@@ -116,13 +115,13 @@
 int
 init_gmpd (GSList *log_config, int nvt_cache_mode, const gchar *database,
            int max_ips_per_target, int max_email_attachment_size,
-           int max_email_include_size, void (*progress) (),
+           int max_email_include_size,
            int (*fork_connection) (gvm_connection_t *, gchar*),
            int skip_db_check)
 {
   return init_gmp (log_config, nvt_cache_mode, database, max_ips_per_target,
                    max_email_attachment_size, max_email_include_size,
-                   progress, fork_connection, skip_db_check);
+                   fork_connection, skip_db_check);
 }
 
 /**
@@ -461,13 +460,12 @@
  * @param[in]  client_connection    Connection.
  * @param[in]  database             Location of manage database.
  * @param[in]  disable              Commands to disable.
- * @param[in]  progress             Function to mark progress, or NULL.
  *
  * @return 0 success, 1 scanner still loading, -1 error, -2 scanner has no 
cert.
  */
 int
 serve_gmp (gvm_connection_t *client_connection, const gchar *database,
-           gchar **disable, void (*progress) ())
+           gchar **disable)
 {
   int nfds, scan_handler = 0, rc = 0;
   /* True if processing of the client input is waiting for space in the
@@ -948,7 +946,7 @@
           /* Try process the scanner input, in case writing to the scanner
            * has freed some space in to_scanner. */
 
-          ret = process_otp_scanner_input (progress);
+          ret = process_otp_scanner_input ();
           if (ret == 1)
             {
               /* Received scanner BYE.  Write out the rest of to_scanner (the

Modified: trunk/gvm/src/gmpd.h
===================================================================
--- trunk/gvm/src/gmpd.h        2017-08-12 10:10:31 UTC (rev 29339)
+++ trunk/gvm/src/gmpd.h        2017-08-12 11:27:14 UTC (rev 29340)
@@ -56,7 +56,7 @@
 extern struct sockaddr_in scanner_address;
 
 int
-init_gmpd (GSList*, int, const gchar*, int, int, int, void (*) (),
+init_gmpd (GSList*, int, const gchar*, int, int, int,
            int (*) (gvm_connection_t *, gchar *),
            int);
 
@@ -64,7 +64,7 @@
 init_gmpd_process (const gchar *, gchar **);
 
 int
-serve_gmp (gvm_connection_t*, const gchar*, gchar**, void (*progress) ());
+serve_gmp (gvm_connection_t*, const gchar*, gchar**);
 
 /** @todo Temporarily declared here, for gmp.c SEND_TO_CLIENT. */
 extern char to_client[];

Modified: trunk/gvm/src/gvmd.c
===================================================================
--- trunk/gvm/src/gvmd.c        2017-08-12 10:10:31 UTC (rev 29339)
+++ trunk/gvm/src/gvmd.c        2017-08-12 11:27:14 UTC (rev 29340)
@@ -374,7 +374,7 @@
   /* Serve GMP. */
 
   /* It's up to serve_gmp to gvm_server_free client_*. */
-  if (serve_gmp (client_connection, database, disabled_commands, NULL))
+  if (serve_gmp (client_connection, database, disabled_commands))
     goto server_fail;
 
   return EXIT_SUCCESS;
@@ -914,34 +914,6 @@
 
 
 /**
- * @brief Nudge the progress indicator.
- */
-void
-spin_progress ()
-{
-  static char current = '/';
-  switch (current)
-    {
-      case '\\':
-        current = '|';
-        break;
-      case '|':
-        current = '/';
-        break;
-      case '/':
-        current = '-';
-        break;
-      case '-':
-        current = '\\';
-        break;
-    }
-  putchar ('\b');
-  putchar (current);
-  fflush (stdout);
-  g_debug ("   %c\n", current);
-}
-
-/**
  * @brief Handle a SIGABRT signal.
  *
  * @param[in]  signal  The signal that caused this function to run.
@@ -958,14 +930,13 @@
  * @param[in]  update_nvt_cache        Whether the nvt cache should be updated
  *                                     (1) or rebuilt (0).
  * @param[in]  register_cleanup        Whether to register cleanup with atexit.
- * @param[in]  progress                Function to update progress, or NULL.
  * @param[in]  skip_create_tables      Whether to skip table creation.
  *
  * @return If this function did not exit itself, returns exit code.
  */
 static int
 update_or_rebuild_nvt_cache (int update_nvt_cache, int register_cleanup,
-                             void (*progress) (), int skip_create_tables)
+                             int skip_create_tables)
 {
   int ret;
   gvm_connection_t connection;
@@ -983,7 +954,6 @@
                      manage_max_hosts (),
                      0, /* Max email attachment size. */
                      0, /* Max email include size. */
-                     progress,
                      NULL,
                      skip_create_tables))
     {
@@ -1028,7 +998,7 @@
    * request and cache the plugins, then exit. */
 
   connection.socket = update_nvt_cache ? -1 : -2;
-  ret = serve_gmp (&connection, database, NULL, progress);
+  ret = serve_gmp (&connection, database, NULL);
   openvas_scanner_close ();
   switch (ret)
     {
@@ -1054,14 +1024,13 @@
  * @param[in]  update_or_rebuild       Whether the nvt cache should be updated
  *                                     (1) or rebuilt (0).
  * @param[in]  register_cleanup        Whether to register cleanup with atexit.
- * @param[in]  progress                Function to update progress, or NULL.
  * @param[in]  skip_create_tables      Whether to skip table creation.
  *
  * @return Exit status of child spawned to do rebuild.
  */
 static int
 rebuild_nvt_cache_retry (int update_or_rebuild, int register_cleanup,
-                         void (*progress) (), int skip_create_tables)
+                         int skip_create_tables)
 {
   proctitle_set ("gvmd: Reloading");
 
@@ -1078,17 +1047,13 @@
             return WEXITSTATUS (status);
           /* Child exit status == 2 means that the scanner is still loading. */
           for (i = 0; i < 10; i++)
-            {
-              if (progress)
-                progress ();
-              gvm_sleep (1);
-            }
+            gvm_sleep (1);
         }
       else if (child_pid == 0)
         {
           /* Child: Try reload. */
           int ret = update_or_rebuild_nvt_cache (update_or_rebuild,
-                                                 register_cleanup, progress,
+                                                 register_cleanup,
                                                  skip_create_tables);
 
           exit (ret);
@@ -1149,7 +1114,7 @@
 
         /* Update the cache. */
 
-        rebuild_nvt_cache_retry (1, 0, NULL, 1);
+        rebuild_nvt_cache_retry (1, 0, 1);
 
         /* Exit. */
 
@@ -1565,7 +1530,6 @@
   static gboolean get_scanners = FALSE;
   static gboolean foreground = FALSE;
   static gboolean print_version = FALSE;
-  static gboolean progress = FALSE;
   static int max_ips_per_target = MANAGE_MAX_HOSTS;
   static int max_email_attachment_size = 0;
   static int max_email_include_size = 0;
@@ -1671,7 +1635,6 @@
         { "password", '\0', 0, G_OPTION_ARG_STRING, &password, "Password, for 
--create-user.", "<password>" },
         { "port", 'p', 0, G_OPTION_ARG_STRING, &manager_port_string, "Use port 
number <number>.", "<number>" },
         { "port2", '\0', 0, G_OPTION_ARG_STRING, &manager_port_string_2, "Use 
port number <number> for address 2.", "<number>" },
-        { "progress", '\0', 0, G_OPTION_ARG_NONE, &progress, "Display progress 
during --rebuild and --update.", NULL },
         { "role", '\0', 0, G_OPTION_ARG_STRING, &role, "Role for --create-user 
and --get-users.", "<role>" },
         { "unix-socket", 'c', 0, G_OPTION_ARG_STRING, 
&manager_address_string_unix, "Listen on UNIX socket at <filename>.", 
"<filename>" },
         { "user", '\0', 0, G_OPTION_ARG_STRING, &user, "User for 
--new-password.", "<username>" },
@@ -2160,7 +2123,7 @@
   /* Initialise GMP daemon. */
 
   switch (init_gmpd (log_config, 0, database, max_ips_per_target,
-                     max_email_attachment_size, max_email_include_size, NULL,
+                     max_email_attachment_size, max_email_include_size,
                      fork_connection_for_event, 0))
     {
       case 0:

Modified: trunk/gvm/src/manage.h
===================================================================
--- trunk/gvm/src/manage.h      2017-08-12 10:10:31 UTC (rev 29339)
+++ trunk/gvm/src/manage.h      2017-08-12 11:27:14 UTC (rev 29340)
@@ -68,12 +68,12 @@
 } name_value_t;
 
 int
-init_manage (GSList*, int, const gchar *, int, int, int, void (*) (),
+init_manage (GSList*, int, const gchar *, int, int, int,
              int (*) (gvm_connection_t *, gchar *),
              int);
 
 int
-init_manage_helper (GSList *, const gchar *, int, void (*) ());
+init_manage_helper (GSList *, const gchar *, int);
 
 void
 init_manage_process (int, const gchar*);

Modified: trunk/gvm/src/manage_sql.c
===================================================================
--- trunk/gvm/src/manage_sql.c  2017-08-12 10:10:31 UTC (rev 29339)
+++ trunk/gvm/src/manage_sql.c  2017-08-12 11:27:14 UTC (rev 29340)
@@ -338,11 +338,6 @@
 int (*manage_fork_connection) (gvm_connection_t *, gchar*) = NULL;
 
 /**
- * @brief Function to mark progress.
- */
-void (*progress) () = NULL;
-
-/**
  * @brief Max number of hosts per target.
  */
 static int max_hosts = MANAGE_MAX_HOSTS;
@@ -1108,7 +1103,7 @@
 
   db = database ? database : sql_default_database ();
 
-  ret = init_manage_helper (log_config, db, ABSOLUTE_MAX_IPS_PER_TARGET, NULL);
+  ret = init_manage_helper (log_config, db, ABSOLUTE_MAX_IPS_PER_TARGET);
   assert (ret != -4);
   switch (ret)
     {
@@ -15232,8 +15227,6 @@
   sql_begin_exclusive ();
   create_tables ();
   check_db_sequences ();
-  if (progress)
-    progress ();
   set_db_version (GVMD_DATABASE_VERSION);
   check_db_nvt_selectors ();
   check_db_nvts ();
@@ -15252,8 +15245,6 @@
   cleanup_schedule_times ();
   if (check_encryption_key && check_db_encryption_key ())
     goto fail;
-  if (progress)
-    progress ();
 
   sql_commit ();
   return 0;
@@ -15415,7 +15406,6 @@
  * @param[in]  max_ips_per_target  Max number of IPs per target.
  * @param[in]  max_email_attachment_size  Max size of email attachments.
  * @param[in]  max_email_include_size     Max size of email inclusions.
- * @param[in]  update_progress     Function to update progress, or NULL. *
  * @param[in]  stop_tasks          Stop any active tasks.
  * @param[in]  fork_connection     Function to fork a connection that will
  *                                 accept GMP requests.  Used to start tasks
@@ -15433,7 +15423,6 @@
                       int max_ips_per_target,
                       int max_email_attachment_size,
                       int max_email_include_size,
-                      void (*update_progress) (),
                       int stop_tasks,
                       int (*fork_connection)
                              (gvm_connection_t *, gchar *),
@@ -15497,7 +15486,6 @@
     max_attach_length = max_email_attachment_size;
   if (max_email_include_size)
     max_content_length = max_email_include_size;
-  progress = update_progress;
 
   g_log_set_handler (G_LOG_DOMAIN,
                      ALL_LOG_LEVELS,
@@ -15567,7 +15555,6 @@
  * @param[in]  max_ips_per_target  Max number of IPs per target.
  * @param[in]  max_email_attachment_size  Max size of email attachments.
  * @param[in]  max_email_include_size     Max size of email inclusions.
- * @param[in]  update_progress     Function to update progress, or NULL. *
  * @param[in]  fork_connection     Function to fork a connection that will
  *                                 accept GMP requests.  Used to start tasks
  *                                 with GMP when an alert occurs.
@@ -15579,7 +15566,7 @@
 int
 init_manage (GSList *log_config, int nvt_cache_mode, const gchar *database,
              int max_ips_per_target, int max_email_attachment_size,
-             int max_email_include_size, void (*update_progress) (),
+             int max_email_include_size,
              int (*fork_connection) (gvm_connection_t*, gchar*),
              int skip_db_check)
 {
@@ -15589,7 +15576,6 @@
                                max_ips_per_target,
                                max_email_attachment_size,
                                max_email_include_size,
-                               update_progress,
                                1,  /* Stop active tasks. */
                                fork_connection,
                                skip_db_check,
@@ -15606,14 +15592,13 @@
  * @param[in]  log_config      Log configuration.
  * @param[in]  database        Location of database.
  * @param[in]  max_ips_per_target  Max number of IPs per target.
- * @param[in]  update_progress     Function to update progress, or NULL. *
  *
  * @return 0 success, -1 error, -2 database is wrong version, -3 database needs
  *         to be initialised from server, -4 max_ips_per_target out of range.
  */
 int
 init_manage_helper (GSList *log_config, const gchar *database,
-                    int max_ips_per_target, void (*update_progress) ())
+                    int max_ips_per_target)
 {
   return init_manage_internal (log_config,
                                0,   /* Run daemon in NVT cache mode. */
@@ -15621,7 +15606,6 @@
                                max_ips_per_target,
                                0,   /* Default max_email_attachment_size. */
                                0,   /* Default max_email_include_size. */
-                               update_progress,
                                0,   /* Stop active tasks. */
                                NULL,
                                0,   /* Skip DB check. */

Modified: trunk/gvm/src/otp.c
===================================================================
--- trunk/gvm/src/otp.c 2017-08-12 10:10:31 UTC (rev 29339)
+++ trunk/gvm/src/otp.c 2017-08-12 11:27:14 UTC (rev 29340)
@@ -542,12 +542,11 @@
  * @brief Parse preference value.
  *
  * @param  messages  A pointer into the OTP input buffer.
- * @param  progress  Callback to update progress.
  *
  * @return 0 success, -2 too few characters (need more input).
  */
 static int
-parse_scanner_preference_value (char** messages, void (*progress) ())
+parse_scanner_preference_value (char** messages)
 {
   char *value, *end, *match;
   end = *messages + from_scanner_end - from_scanner_start;
@@ -564,8 +563,6 @@
 
           value = g_strdup (*messages);
           blank_control_chars (value);
-          if (progress)
-            progress ();
           preference = g_malloc0 (sizeof (preference_t));
           preference->name = g_strdup (current_scanner_preference);
           preference->value = value;
@@ -753,13 +750,11 @@
  * reaction to client requests, the only exception being stop requests
  * initiated in other processes.
  *
- * @param[in]  progress  Function to mark progress, or NULL.
- *
  * @return 0 success, 1 received scanner BYE, 2 bad login, 3 scanner loading, 
-1
  * error.
  */
 int
-process_otp_scanner_input (void (*progress) ())
+process_otp_scanner_input ()
 {
   char* match = NULL;
   char* messages = from_scanner + from_scanner_start;
@@ -860,7 +855,7 @@
             }
         else if (scanner_state == SCANNER_PREFERENCE_VALUE)
           {
-            switch (parse_scanner_preference_value (&messages, progress))
+            switch (parse_scanner_preference_value (&messages))
               {
                 case -2:
                   /* Need more input. */
@@ -1191,8 +1186,6 @@
                     }
                   assert (current_plugin == NULL);
                   current_plugin = nvti_new ();
-                  if (progress)
-                    progress ();
                   if (current_plugin == NULL) abort ();
                   nvti_set_oid (current_plugin, field);
                   set_scanner_state (SCANNER_PLUGIN_LIST_NAME);
@@ -1330,8 +1323,7 @@
                     else
                       current_scanner_preference = g_strdup (field);
                     set_scanner_state (SCANNER_PREFERENCE_VALUE);
-                    switch (parse_scanner_preference_value (&messages,
-                                                            progress))
+                    switch (parse_scanner_preference_value (&messages))
                       {
                         case -2:
                           /* Need more input. */

Modified: trunk/gvm/src/otp.h
===================================================================
--- trunk/gvm/src/otp.h 2017-08-12 10:10:31 UTC (rev 29339)
+++ trunk/gvm/src/otp.h 2017-08-12 11:27:14 UTC (rev 29340)
@@ -33,7 +33,7 @@
 init_otp_data ();
 
 int
-process_otp_scanner_input (void (*) ());
+process_otp_scanner_input ();
 
 /** @todo Exported for following functions. */
 /**

_______________________________________________
Openvas-commits mailing list
Openvas-commits@wald.intevation.org
https://lists.wald.intevation.org/cgi-bin/mailman/listinfo/openvas-commits

Reply via email to