diff options
author | Gary Lockyer <gary@catalyst.net.nz> | 2018-05-17 08:03:00 +1200 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2018-06-01 08:28:26 +0200 |
commit | 77e66b86db606ff135c8c76a95c5576feec0fa51 (patch) | |
tree | 9da7d6b4189f665eae94caf6db2e5a7709b51c49 /auth/auth_log.c | |
parent | 7a0d82b6948930506afd35c4d9fb7e7641adb8ba (diff) | |
download | samba-77e66b86db606ff135c8c76a95c5576feec0fa51.tar.gz |
lib audit_logging: re-factor and add functions.
Re-factor the common calls to json_dumps DEBUGC and audit_message_send
into a separate function.
Add functions to retrieve json object and json array elements
Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'auth/auth_log.c')
-rw-r--r-- | auth/auth_log.c | 22 |
1 files changed, 2 insertions, 20 deletions
diff --git a/auth/auth_log.c b/auth/auth_log.c index 87daf2f110f..369a5c96162 100644 --- a/auth/auth_log.c +++ b/auth/auth_log.c @@ -82,31 +82,13 @@ static void log_json(struct imessaging_context *msg_ctx, int debug_class, int debug_level) { - char* json = NULL; - - if (object->error) { - return; - } - - json = json_dumps(object->root, 0); - if (json == NULL) { - DBG_ERR("Unable to convert JSON object to string\n"); - object->error = true; - return; - } - - DEBUGC(debug_class, debug_level, ("JSON %s: %s\n", type, json)); + audit_log_json(type, object, debug_class, debug_level); if (msg_ctx && lp_ctx && lpcfg_auth_event_notification(lp_ctx)) { audit_message_send(msg_ctx, AUTH_EVENT_NAME, MSG_AUTH_LOG, - json); - } - - if (json) { - free(json); + object); } - } /* |