[Openvas-commits] r2656 - in trunk/openvas-client: . nessus
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Wed Mar 4 12:04:09 CET 2009
Author: felix
Date: 2009-03-04 12:04:07 +0100 (Wed, 04 Mar 2009)
New Revision: 2656
Modified:
trunk/openvas-client/ChangeLog
trunk/openvas-client/nessus/parser.c
Log:
Use of g_strdup_printf instead of malloc + sprintf, cosmetics in parser
module.
* nessus/parser.c: Moved defines to beginning of file.
* nessus/parser.c (is_mac_addr, parse_server_error): Shortened comment
blocks.
* nessus/parser.c (parse_modify_data): use g_strdupo_printf + g_free
instead of emalloc + sprintf + free.
* nessus/parser.c (parse_nessusd_short_status): Gave example in comment.
Modified: trunk/openvas-client/ChangeLog
===================================================================
--- trunk/openvas-client/ChangeLog 2009-03-04 10:32:14 UTC (rev 2655)
+++ trunk/openvas-client/ChangeLog 2009-03-04 11:04:07 UTC (rev 2656)
@@ -1,5 +1,20 @@
2009-03-04 Felix Wolfsteller <felix.wolfsteller at intevation.de>
+ Use of g_strdup_printf instead of malloc + sprintf, cosmetics in parser
+ module.
+
+ * nessus/parser.c: Moved defines to beginning of file.
+
+ * nessus/parser.c (is_mac_addr, parse_server_error): Shortened comment
+ blocks.
+
+ * nessus/parser.c (parse_modify_data): use g_strdupo_printf + g_free
+ instead of emalloc + sprintf + free.
+
+ * nessus/parser.c (parse_nessusd_short_status): Gave example in comment.
+
+2009-03-04 Felix Wolfsteller <felix.wolfsteller at intevation.de>
+
Disabled "Edit Priorities" menu item.
* nessus/prefs_dialog/prefs_dialog.c,
Modified: trunk/openvas-client/nessus/parser.c
===================================================================
--- trunk/openvas-client/nessus/parser.c 2009-03-04 10:32:14 UTC (rev 2655)
+++ trunk/openvas-client/nessus/parser.c 2009-03-04 11:04:07 UTC (rev 2656)
@@ -44,6 +44,10 @@
#include "backend.h"
#include "globals.h"
+#define TIMER_HOST_START 1
+#define TIMER_HOST_END 2
+#define TIMER_SCAN_START 3
+#define TIMER_SCAN_END 4
static int
is_mac_addr (char* host)
@@ -85,9 +89,7 @@
(!(mac = is_mac_addr(host))))
{
char * t;
- /*
- * Not an IP nor a MAC addr
- */
+ /* Not an IP nor a MAC addr */
t = strchr(host, '.');
if(t)
++t;
@@ -99,10 +101,8 @@
{
if(mac)
{
- /*
- * This is a MAC address. In that case, the 'subnet'
- * are the first three bytes (manufacturer id)
- */
+ /* This is a MAC address. In that case, the 'subnet'
+ * are the first three bytes (manufacturer id) */
char * t = strchr(host,'.');
int i;
for(i=0;i<2;i++)
@@ -120,7 +120,7 @@
}
else
{
- /* this is an IP */
+ /* This is an IP */
char * t = strrchr(host, '.');
if(t)t[0] = '\0';
strncpy(subnet, host, sizeof(subnet) - 1);
@@ -132,7 +132,7 @@
/**
- * Parse a configuration of multiple of "<|> ldap (389/tcp) <|> 11 <|> 3 <|>"
+ * Parse a configuration of multiple of "<|> ldap (389/tcp) <|> INFO <|> NOTE <|>"
* and return the new priority as integer if the line matches the current script.
*
* @param override Override value from the openvasrc configuration
@@ -229,15 +229,14 @@
char *prefkey;
int prio;
- prefkey = emalloc(strlen("PLUGINS_PRIORITIES")+strlen(host)+2);
- sprintf(prefkey, "PLUGINS_PRIORITIES_%s", host);
+ prefkey = g_strdup_printf ("PLUGINS_PRIORITIES_%s", host);
if ((priorities = arg_get_value(context->prefs, prefkey)) == NULL) {
- efree(&prefkey);
+ g_free (prefkey);
return NULL;
}
- efree(&prefkey);
+ g_free (prefkey);
if ((override = arg_get_value(priorities, script_id)) == NULL)
return NULL;
@@ -274,11 +273,9 @@
char *msg = parse_separator(servmsg);
char *msg1, *msg2;
- /*
- * msg2 contains the following lines of the server error.
+ /* msg2 contains the following lines of the server error.
* Currently this can only be the list of rejected hosts,
- * so don't translate them.
- */
+ * so don't translate them. */
if((msg2 = strchr(msg, ';')))
{
char *t;
@@ -289,7 +286,7 @@
t[0]='\n';
}
- /* * keep these in sync with the messages in ../nessusd/attack.c */
+ /* Keep these in sync with the messages in ../nessusd/attack.c */
if(!strncmp("E001 -", msg, 6))
msg1 = _("Invalid port range");
else if(!strncmp("E002 -", msg, 6))
@@ -345,13 +342,7 @@
char * msg = parse_separator(t);
int type = 0;
int len = 0;
-#define TIMER_HOST_START 1
-#define TIMER_HOST_END 2
-#define TIMER_SCAN_START 3
-#define TIMER_SCAN_END 4
-
-
if(!strcmp(msg, "HOST_START")){
len = strlen(msg);
type = TIMER_HOST_START;
@@ -381,7 +372,7 @@
break;
case TIMER_HOST_END:
backend_insert_timestamps(backend, host, "host_end", date);
- break;
+ break;
}
}
@@ -511,7 +502,6 @@
*action = emalloc(strlen(t2) + 1);
strncpy(*action, t2, strlen(t2));
-
efree(&t2);
t2 = parse_separator(servmsg+strlen(t1)+3);
@@ -542,7 +532,7 @@
char * t;
static char portscan[] = "portscan";
static char attack[] = "attack";
- /* the short status is : action:hostname:current:max */
+ /* The short status is : action:hostname:current:max (e.g. s:a:localhost:44:102)*/
if(msg[0]=='p')
*action = strdup(portscan);
else
@@ -671,7 +661,7 @@
/**
- * @return Pointer to the location after the ' <|> ' symbol in str or NULL if
+ * @return Pointer to the location after the ' <|> ' symbol in str or NULL if
* no ' <|> ' found.
*/
char *
More information about the Openvas-commits
mailing list