Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various updates to the nasl_perror() error texts: #542

Merged
merged 1 commit into from
Jul 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Fix openvas-nasl. Add kb key/value for all vhosts. [#533](https://github.com/greenbone/openvas/pull/533)
- Wait for last plugin to finish before change to other category. [#534](https://github.com/greenbone/openvas/pull/534)
- Corrected function parameter names in nasl_perror calls. [#539](https://github.com/greenbone/openvas/pull/539)
- Various updates to the nasl_perror() error texts. [#539](https://github.com/greenbone/openvas/pull/542)
- Fix icmp checksum calculation in openvas-nasl. [#543](https://github.com/greenbone/openvas/pull/543)

### Removed
Expand Down
18 changes: 8 additions & 10 deletions nasl/nasl_packet_forgery.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,13 +164,13 @@ get_ip_element (lex_ctxt *lexic)

if (ip == NULL)
{
nasl_perror (lexic, "get_ip_element : no valid 'ip' argument!\n");
nasl_perror (lexic, "get_ip_element: no valid 'ip' argument\n");
return NULL;
}

if (element == NULL)
{
nasl_perror (lexic, "get_ip_element : no valid 'element' argument!\n");
nasl_perror (lexic, "get_ip_element: no valid 'element' argument\n");
return NULL;
}

Expand Down Expand Up @@ -437,7 +437,7 @@ forge_tcp_packet (lex_ctxt *lexic)
if (ip == NULL)
{
nasl_perror (lexic,
"forge_tcp_packet : You must supply the 'ip' argument !");
"forge_tcp_packet: You must supply the 'ip' argument\n");
return NULL;
}

Expand Down Expand Up @@ -526,8 +526,7 @@ get_tcp_element (lex_ctxt *lexic)

if (packet == NULL)
{
nasl_perror (lexic,
"get_tcp_element : Error ! No valid 'tcp' argument !\n");
nasl_perror (lexic, "get_tcp_element: No valid 'tcp' argument\n");
return NULL;
}

Expand All @@ -544,8 +543,7 @@ get_tcp_element (lex_ctxt *lexic)
element = get_str_var_by_name (lexic, "element");
if (!element)
{
nasl_perror (lexic,
"get_tcp_element : Error ! No valid 'element' argument !\n");
nasl_perror (lexic, "get_tcp_element: No valid 'element' argument\n");
return NULL;
}

Expand Down Expand Up @@ -579,7 +577,7 @@ get_tcp_element (lex_ctxt *lexic)
}
else
{
nasl_perror (lexic, "Unknown tcp field %s\n", element);
nasl_perror (lexic, "get_tcp_element: Unknown tcp field %s\n", element);
return NULL;
}

Expand All @@ -603,7 +601,7 @@ set_tcp_elements (lex_ctxt *lexic)
if (!ip)
{
nasl_perror (lexic,
"set_tcp_elements : Invalid value for the argument 'tcp'\n");
"set_tcp_elements: Invalid value for the argument 'tcp'\n");
return NULL;
}

Expand Down Expand Up @@ -1430,7 +1428,7 @@ nasl_send_packet (lex_ctxt *lexic)

if ((unsigned int) sz < sizeof (struct ip))
{
nasl_perror (lexic, "send_packet(): packet is too short!\n");
nasl_perror (lexic, "send_packet: packet is too short\n");
continue;
}

Expand Down
29 changes: 15 additions & 14 deletions nasl/nasl_packet_forgery_v6.c
Original file line number Diff line number Diff line change
Expand Up @@ -196,13 +196,13 @@ get_ipv6_element (lex_ctxt *lexic)

if (ip6 == NULL)
{
nasl_perror (lexic, "get_ipv6_element : no valid 'ipv6' argument!\n");
nasl_perror (lexic, "get_ipv6_element: no valid 'ipv6' argument\n");
return NULL;
}

if (element == NULL)
{
nasl_perror (lexic, "get_ipv6_element : no valid 'element' argument!\n");
nasl_perror (lexic, "get_ipv6_element: no valid 'element' argument\n");
return NULL;
}

Expand Down Expand Up @@ -286,7 +286,7 @@ set_ipv6_elements (lex_ctxt *lexic)

if (o_pkt == NULL)
{
nasl_perror (lexic, "set_ip_elements: missing <ip6> field\n");
nasl_perror (lexic, "set_ipv6_elements: missing <ip6> field\n");
return NULL;
}

Expand Down Expand Up @@ -461,7 +461,7 @@ forge_tcp_v6_packet (lex_ctxt *lexic)
if (ip6 == NULL)
{
nasl_perror (lexic,
"forge_tcp_packet : You must supply the 'ip6' argument !");
"forge_tcp_v6_packet: You must supply the 'ip6' argument\n");
return NULL;
}

Expand Down Expand Up @@ -547,8 +547,7 @@ get_tcp_v6_element (lex_ctxt *lexic)

if (packet == NULL)
{
nasl_perror (lexic,
"get_tcp_element : Error ! No valid 'tcp' argument !\n");
nasl_perror (lexic, "get_tcp_v6_element: No valid 'tcp' argument\n");
return NULL;
}

Expand All @@ -563,8 +562,7 @@ get_tcp_v6_element (lex_ctxt *lexic)
element = get_str_var_by_name (lexic, "element");
if (!element)
{
nasl_perror (lexic,
"get_tcp_element : Error ! No valid 'element' argument !\n");
nasl_perror (lexic, "get_tcp_v6_element: No valid 'element' argument\n");
return NULL;
}

Expand Down Expand Up @@ -594,7 +592,9 @@ get_tcp_v6_element (lex_ctxt *lexic)
retc->size = UNFIX (ip6->ip6_plen) - tcp->th_off * 4;
if (retc->size <= 0 || retc->size > ipsz - 40 - tcp->th_off * 4)
{
nasl_perror (lexic, "Erroneous tcp header offset %d", retc->size);
nasl_perror (lexic,
"get_tcp_v6_element: Erroneous tcp header offset %d\n",
retc->size);
deref_cell (retc);
return NULL;
}
Expand All @@ -604,7 +604,8 @@ get_tcp_v6_element (lex_ctxt *lexic)
}
else
{
nasl_perror (lexic, "Unknown tcp field %s\n", element);
nasl_perror (lexic, "get_tcp_v6_element: Unknown tcp field %s\n",
element);
return NULL;
}

Expand Down Expand Up @@ -634,8 +635,8 @@ set_tcp_v6_elements (lex_ctxt *lexic)

if (pkt == NULL)
{
nasl_perror (lexic,
"set_tcp_elements : Invalid value for the argument 'tcp'\n");
nasl_perror (
lexic, "set_tcp_v6_elements: Invalid value for the argument 'tcp'\n");
return NULL;
}

Expand Down Expand Up @@ -1682,7 +1683,7 @@ nasl_send_v6packet (lex_ctxt *lexic)

if ((unsigned int) sz < sizeof (struct ip6_hdr))
{
nasl_perror (lexic, "send_packet(): packet is too short!\n");
nasl_perror (lexic, "send_v6packet: packet is too short\n");
continue;
}

Expand Down Expand Up @@ -1724,7 +1725,7 @@ nasl_send_v6packet (lex_ctxt *lexic)
sizeof (txt2));
txt2[sizeof (txt2) - 1] = '\0';
nasl_perror (lexic,
"send_packet: malicious or buggy script is trying to "
"send_v6packet: malicious or buggy script is trying to "
"send packet to %s instead of designated target %s\n",
txt1, txt2);
if (bpf >= 0)
Expand Down