prelude-manager/master: Minor XMLmod fixes
[email protected] Wed, 5 May 2010 11:17:43 +0200 (CEST)
| Newsgroups | gmane.comp.security.ids.prelude.cvs |
|---|---|
| Message-ID | <[email protected]> |
commit d46bdc3b87d7ca47747d6783f59729429488f885 Author: Yoann Vandoorselaere <[email protected]> Date: Wed May 5 11:17:49 2010 +0200 Minor XMLmod fixes Fix prelude-string warning in case of a NULL IDMEF impact description: this is an optional element. Closes #376. Always create a CorrelationAlert name element, since the associated prelude_string_t can never be NULL. Code simplification for Action element creation. ======================================== plugins/reports/xmlmod/xmlmod.c | 21 +++++++++++---------- 1 files changed, 11 insertions(+), 10 deletions(-) ======================================== diff --git a/plugins/reports/xmlmod/xmlmod.c b/plugins/reports/xmlmod/xmlmod.c index 7ebc452..7ff96cc 100644 --- a/plugins/reports/xmlmod/xmlmod.c +++ b/plugins/reports/xmlmod/xmlmod.c @@ -678,12 +678,17 @@ static void process_additional_data(xmlNodePtr parent, idmef_additional_data_t * static void process_impact(xmlNodePtr parent, idmef_impact_t *impact) { xmlNodePtr new; + const char *s = NULL; + prelude_string_t *str; if ( ! impact ) return; - new = xmlNewTextChild(parent, NULL, (const xmlChar *) "Impact", - (const xmlChar *) prelude_string_get_string(idmef_impact_get_description(impact))); + str = idmef_impact_get_description(impact); + if ( str ) + s = prelude_string_get_string(str); + + new = xmlNewTextChild(parent, NULL, (const xmlChar *) "Impact", (const xmlChar *) s); if ( ! new ) return; @@ -721,6 +726,7 @@ static void process_confidence(xmlNodePtr parent, idmef_confidence_t *confidence static void process_action(xmlNodePtr parent, idmef_action_t *action) { xmlNodePtr new; + const char *s = NULL; prelude_string_t *str; if ( ! action ) @@ -728,11 +734,9 @@ static void process_action(xmlNodePtr parent, idmef_action_t *action) str = idmef_action_get_description(action); if ( str ) - new = xmlNewTextChild(parent, NULL, (const xmlChar *) "Action", - (const xmlChar *) prelude_string_get_string(str)); - else - new = xmlNewChild(parent, NULL, (const xmlChar *) "Action", NULL); + s = prelude_string_get_string(str); + new = xmlNewTextChild(parent, NULL, (const xmlChar *) "Action", (const xmlChar *) s); if ( ! new ) return; @@ -768,7 +772,6 @@ static void process_assessment(xmlNodePtr parent, idmef_assessment_t *assessment static void process_correlation_alert(xmlNodePtr parent, idmef_correlation_alert_t *ca) { xmlNodePtr new, anew; - prelude_string_t *str; idmef_alertident_t *alertident = NULL; if ( ! ca ) @@ -778,9 +781,7 @@ static void process_correlation_alert(xmlNodePtr parent, idmef_correlation_alert if ( ! new ) return; - str = idmef_correlation_alert_get_name(ca); - if ( str ) - xmlNewTextChild(new, NULL, (const xmlChar *) "name", (const xmlChar *) prelude_string_get_string(str)); + xmlNewTextChild(new, NULL, (const xmlChar *) "name", (const xmlChar *) prelude_string_get_string(idmef_correlation_alert_get_name(ca))); while ( (alertident = idmef_correlation_alert_get_next_alertident(ca, alertident)) ) { anew = xmlNewTextChild(new, NULL, (const xmlChar *) "alertident", _______________________________________________ Prelude-cvslog site list [email protected] http://lists.prelude-technologies.com/mailman/listinfo/prelude-cvslog