diff --git a/rust/src/krb/log.rs b/rust/src/krb/log.rs index 7cb952581bc7..58c0d64b4893 100644 --- a/rust/src/krb/log.rs +++ b/rust/src/krb/log.rs @@ -22,6 +22,7 @@ use crate::krb::krb5::{KRB5Transaction,test_weak_encryption}; fn krb5_log_response(jsb: &mut JsonBuilder, tx: &mut KRB5Transaction) -> Result<(), JsonError> { + jsb.open_object("krb5")?; match tx.error_code { Some(c) => { jsb.set_string("msg_type", &format!("{:?}", tx.msg_type))?; @@ -63,12 +64,13 @@ fn krb5_log_response(jsb: &mut JsonBuilder, tx: &mut KRB5Transaction) -> Result< jsb.set_string("ticket_encryption", &refs)?; jsb.set_bool("ticket_weak_encryption", test_weak_encryption(x))?; } + jsb.close()?; return Ok(()); } #[no_mangle] -pub extern "C" fn rs_krb5_log_json_response(jsb: &mut JsonBuilder, tx: &mut KRB5Transaction) -> bool +pub extern "C" fn rs_krb5_log_json_response(tx: &mut KRB5Transaction, jsb: &mut JsonBuilder) -> bool { krb5_log_response(jsb, tx).is_ok() } diff --git a/src/output-json-krb5.c b/src/output-json-krb5.c index 5e6fbad5ecd1..9fc45c5d3c53 100644 --- a/src/output-json-krb5.c +++ b/src/output-json-krb5.c @@ -59,11 +59,9 @@ static int JsonKRB5Logger(ThreadVars *tv, void *thread_data, return TM_ECODE_FAILED; } - jb_open_object(jb, "krb5"); - if (!rs_krb5_log_json_response(jb, krb5tx)) { + if (!rs_krb5_log_json_response(krb5tx, jb)) { goto error; } - jb_close(jb); OutputJsonBuilderBuffer(jb, thread); diff --git a/src/output.c b/src/output.c index 5aa341d2cbd4..149dda58c284 100644 --- a/src/output.c +++ b/src/output.c @@ -1149,8 +1149,8 @@ static EveJsonSimpleAppLayerLogger simple_json_applayer_loggers[ALPROTO_MAX] = { { ALPROTO_NTP, NULL }, // no logging { ALPROTO_FTPDATA, EveFTPDataAddMetadata }, { ALPROTO_TFTP, (EveJsonSimpleTxLogFunc)rs_tftp_log_json_request }, - { ALPROTO_IKE, NULL }, // special: uses state - { ALPROTO_KRB5, NULL }, // TODO missing + { ALPROTO_IKE, NULL }, // special: uses state + { ALPROTO_KRB5, (EveJsonSimpleTxLogFunc)rs_krb5_log_json_response }, { ALPROTO_QUIC, rs_quic_to_json }, { ALPROTO_DHCP, NULL }, // TODO missing { ALPROTO_SNMP, (EveJsonSimpleTxLogFunc)rs_snmp_log_json_response },