Skip to content
Open
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
5 changes: 4 additions & 1 deletion src/OVAL/probes/SEAP/seap-packet.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@ SEAP_packet_t *SEAP_packet_new (void)

void SEAP_packet_free (SEAP_packet_t *packet)
{
free(packet);
if (packet != NULL) {
free(packet);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indentation.

}
return;
}

void *SEAP_packet_settype (SEAP_packet_t *packet, uint8_t type)
Expand Down
16 changes: 16 additions & 0 deletions src/OVAL/probes/unix/routingtable_probe.c
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,14 @@ int routingtable_probe_main(probe_ctx *ctx, void *arg)
switch(probe_ent_getdatatype(dst_ent)) {
case OVAL_DATATYPE_IPV4ADDR:
fp = fopen("/proc/net/route", "r");
if (fp == NULL) {
if (errno == ENOENT) {
dI("/proc/net/route does not exist. No IPv4 routing table available.");
} else {
dE("Failed to open /proc/net/route: %s", strerror(errno));
}
break;
}
/* Skip the header line */
if (getline(&line_buf, &line_len, fp) != -1) {
while(getline(&line_buf, &line_len, fp) != -1) {
Expand All @@ -346,6 +354,14 @@ int routingtable_probe_main(probe_ctx *ctx, void *arg)
break;
case OVAL_DATATYPE_IPV6ADDR:
fp = fopen("/proc/net/ipv6_route", "r");
if (fp == NULL) {
if (errno == ENOENT) {
dI("/proc/net/route does not exist. No IPv4 routing table available.");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IPv6.

} else {
dE("Failed to open /proc/net/route: %s", strerror(errno));
}
break;
}

while(getline(&line_buf, &line_len, fp) != -1) {
if (process_line_ip6(line_buf, &rt) != 0)
Expand Down
10 changes: 8 additions & 2 deletions src/OVAL/probes/unix/xinetd_probe.c
Original file line number Diff line number Diff line change
Expand Up @@ -1097,7 +1097,10 @@ int xiconf_parse_section(xiconf_t *xiconf, xiconf_file_t *xifile, int type, char
if (scur->protocol == NULL) {
struct servent *service = getservbyname(scur->name, NULL);
dD("protocol is empty, trying to guess from /etc/services for %s", scur->name);
if (service != NULL) {
if (service == NULL) {
return -1;
}
else {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Newline.

scur->protocol = strdup(service->s_proto);
dD("service %s has default protocol=%s", scur->name, scur->protocol);
}
Expand All @@ -1107,7 +1110,10 @@ int xiconf_parse_section(xiconf_t *xiconf, xiconf_file_t *xifile, int type, char
if (scur->port == 0) {
struct servent *service = getservbyname(scur->name, scur->protocol);
dD("port not set, trying to guess from /etc/services for %s", scur->name);
if (service != NULL) {
if (service == NULL) {
return -1;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indentation.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also this change is breaking the logic of the probe. Test is failing.

}
else {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Newline.

if (service->s_port > 0 && service->s_port < 65536) {
scur->port = ntohs((uint16_t)service->s_port);
dD("service %s has default port=%hu/%s",
Expand Down
1 change: 1 addition & 0 deletions src/XCCDF/rule.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ static bool xccdf_item_parse_deps(xmlTextReaderPtr reader, struct xccdf_item *it
}
if (reqs->itemcount == 0) {
oscap_list_free(reqs, NULL);
free(idsstr);
return false;
}

Expand Down
Loading