-/* Copyright (C) 2013-2023 Open Information Security Foundation
+/* Copyright (C) 2013-2024 Open Information Security Foundation
*
* You can copy, redistribute or modify this Program under the terms of
* the GNU General Public License version 2 as published by the Free
#include "output-json-modbus.h"
#include "output-json-frame.h"
#include "output-json-quic.h"
+#include "output-json-pgsql.h"
#include "util-byte.h"
#include "util-privs.h"
case ALPROTO_BITTORRENT_DHT:
AlertJsonBitTorrentDHT(p->flow, tx_id, jb);
break;
+ case ALPROTO_PGSQL:
+ jb_get_mark(jb, &mark);
+ if (!JsonPgsqlAddMetadata(p->flow, tx_id, jb)) {
+ jb_restore_mark(jb, &mark);
+ }
+ break;
default:
break;
}
-/* Copyright (C) 2022 Open Information Security Foundation
+/* Copyright (C) 2022-2024 Open Information Security Foundation
*
* You can copy, redistribute or modify this Program under the terms of
* the GNU General Public License version 2 as published by the Free
#include "rust.h"
#define PGSQL_LOG_PASSWORDS BIT_U32(0)
+#define PGSQL_DEFAULTS (PGSQL_LOG_PASSWORDS)
typedef struct OutputPgsqlCtx_ {
uint32_t flags;
OutputJsonThreadCtx *ctx;
} LogPgsqlLogThread;
+bool JsonPgsqlAddMetadata(const Flow *f, uint64_t tx_id, JsonBuilder *jb)
+{
+ void *state = FlowGetAppState(f);
+ if (state) {
+ void *tx = AppLayerParserGetTx(f->proto, ALPROTO_PGSQL, state, tx_id);
+ if (tx) {
+ return rs_pgsql_logger(tx, PGSQL_DEFAULTS, jb);
+ }
+ }
+ return false;
+}
+
static int JsonPgsqlLogger(ThreadVars *tv, void *thread_data, const Packet *p, Flow *f, void *state,
void *txptr, uint64_t tx_id)
{
-/* Copyright (C) 2022 Open Information Security Foundation
+/* Copyright (C) 2022-2024 Open Information Security Foundation
*
* You can copy, redistribute or modify this Program under the terms of
* the GNU General Public License version 2 as published by the Free
#define __OUTPUT_JSON_PGSQL_H__
void JsonPgsqlLogRegister(void);
+bool JsonPgsqlAddMetadata(const Flow *f, uint64_t tx_id, JsonBuilder *jb);
#endif /* __OUTPUT_JSON_PGSQL_H__ */