summaryrefslogtreecommitdiff
path: root/lib/audit_logging
Commit message (Collapse)AuthorAgeFilesLines
* lib/audit_logging: actually create tallocPhilipp Gesang2018-12-201-0/+6
| | | | | | | | | | | Heal damage of 79f494e51e.. That context is being passed around and freed but is never actually allocated on that stack. Signed-off-by: Philipp Gesang <philipp.gesang@intra2net.com> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Jeremy Allison <jra@samba.org>
* lib/audit_logging: Use talloc_stackframe() in audit_log_json()Andrew Bartlett2018-12-141-5/+5
| | | | | Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
* audit_logging: Remove debug log header and JSON Authentication: prefixAndrew Bartlett2018-12-142-9/+13
| | | | | | | | | | | | | Feedback from real-world users is that they really want raw JSON strings in the log. We can not easily remove the leading " " but the other strings above and before the JSON are really annoying to strip back off BUG: https://bugzilla.samba.org/show_bug.cgi?id=13714 Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
* audit_logging: Use dom_sid_str_bufVolker Lendecke2018-11-021-4/+4
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* turn --with-json-audit into global --with-jsonPhilipp Gesang2018-09-261-36/+0
| | | | | | | | | | Fold the build option --with-json-audit into the toplevel wscript to reflect the fact that JSON support is no longer local to the audit subsystem. Signed-off-by: Philipp Gesang <philipp.gesang@intra2net.com> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* lib/audit_logging: make json_{is_invalid,to_string}() accept a const*Philipp Gesang2018-09-222-4/+4
| | | | | | | | | | Allow for json_is_invalid() and json_to_string() to be used on a const pointer. Neither function requires for the json object to be mutable so constraining them to non-const* is unnecessary. Reviewed-by: Gary Lockyer <gary@catalyst.net.nz> Signed-off-by: Philipp Gesang <philipp.gesang@intra2net.com> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* lib/audit_logging: update to waf 2.0Alexander Bokovoy2018-09-051-2/+2
| | | | | Signed-off-by: Alexander Bokovoy <ab@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* auth/wscript: import from waflibAlexander Bokovoy2018-09-051-1/+1
| | | | | Signed-off-by: Alexander Bokovoy <ab@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* auth/wscript: fix options useAlexander Bokovoy2018-09-051-1/+1
| | | | | Signed-off-by: Alexander Bokovoy <ab@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* lib audit_logging: add _WARN_UNUSED_RESULT_Gary Lockyer2018-07-252-47/+66
| | | | | | | | | | | | Have the compiler issue a warning when the return code from the API is ignored. Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Jeremy Allison <jra@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Autobuild-User(master): Gary Lockyer <gary@samba.org> Autobuild-Date(master): Wed Jul 25 09:28:31 CEST 2018 on sn-devel-144
* json: Add unit tests for error handlingGary Lockyer2018-07-252-0/+900
| | | | | | | | | Add cmocka unit tests to exercise the error handling in the JSON routines. Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Jeremy Allison <jra@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* json: Modify API to use return codesGary Lockyer2018-07-253-267/+573
| | | | | | | | | Modify the auditing JSON API to return a response code, as the consensus was that the existing error handling was aesthetically displeasing. Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Jeremy Allison <jra@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* audit_logging: Remove duplciate error printingAndrew Bartlett2018-06-261-6/+0
| | | | | | | These errors are already logged at DBG_NOTICE in get_event_server() Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
* audit_logging: Initialise event_serverAndrew Bartlett2018-06-261-1/+1
| | | | | | | | It is better if this is a known zero value to start, even if we check the errors correctly. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
* audit_logging: Remove incorrect check for NT_STATUS_OBJECT_NAME_NOT_FOUNDAndrew Bartlett2018-06-261-4/+2
| | | | | | | | NT_STATUS_OBJECT_NAME_NOT_FOUND is not a case we can ignore, it would mean that event_server is not initialised. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
* audit_logging: Clarify debug messagesAndrew Bartlett2018-06-261-2/+2
| | | | | Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
* lib/audit_logging: Only build audit_logging_test for --enable-selftest on ↵Andrew Bartlett2018-06-251-1/+1
| | | | | | | | | | the AD DC This allows a --without-ad-dc --enable-selftest build to compile, still testing some fileserver-only features. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* lib/audit_logging: Require jansson JSON library for building the AD DCAndrew Bartlett2018-06-251-7/+9
| | | | | | | | | | | This combination is untested and it is reasonable to require this broadly available library for the AD DC build. Doing so keeps the combinational complexity down and ensures we test what we ship. (It was failing to compile). Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* build: Move --without-json-audit and json lib detection to lib/audit_loggingAndrew Bartlett2018-06-251-0/+34
| | | | | | | This is the common location of the audit logging code now Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* lib/audit_logging fix flapping testGary Lockyer2018-06-101-0/+4
| | | | | | | | | | | | Add an adjustment to the before and after values to cater for the occasional differences between the calculated times. The exact value of the time stamp is not important what is important is that is correctly formatted and that the value is reasonable i.e. it's close enough to the current time. Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* lib/audit_logging: Remove #ifdef HAVE_JANSSON from audit_logging_test binaryAndrew Bartlett2018-06-012-17/+14
| | | | | | | | | | Instead, we either build or do not build the entire binary. This is much more likely to raise an error in make test if the build system changes. The concern is that HAVE_JANSSON can go away and the tests just vanish. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
* lib/audit_logging: Make function prototypes look like the rest of SambaAndrew Bartlett2018-06-012-65/+55
| | | | | | | | The previous style is needed sometimes to avoid an 80-col limit, but is not how most of Samba looks. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
* lib audit_logging: re-factor and add functions.Gary Lockyer2018-06-013-11/+264
| | | | | | | | | 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>
* audit_logging: Fix CID 1435739 Dereference null return valueVolker Lendecke2018-05-241-0/+1
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* lib: Fix array size in audit_loggingAndreas Schneider2018-05-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ../lib/audit_logging/audit_logging.c: In function ‘json_add_timestamp’: ../lib/audit_logging/audit_logging.c:603:12: error: ‘%s’ directive output may be truncated writing up to 9 bytes into a region of size between 0 and 43 [-Werror=format-truncation=] "%s.%06ld%s", ^~ ../lib/audit_logging/audit_logging.c:606:3: tz); ~~ ../lib/audit_logging/audit_logging.c:600:2: note: ‘snprintf’ output between 8 and 70 bytes into a destination of size 50 snprintf( ^~~~~~~~~ timestamp, ~~~~~~~~~~ sizeof(timestamp), ~~~~~~~~~~~~~~~~~~ "%s.%06ld%s", ~~~~~~~~~~~~~ buffer, ~~~~~~~ tv.tv_usec, ~~~~~~~~~~~ tz); ~~~ BUG: https://bugzilla.samba.org/show_bug.cgi?id=13437 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Guenther Deschner <gd@samba.org> Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org> Autobuild-Date(master): Thu May 17 20:17:35 CEST 2018 on sn-devel-144
* auth logging: Extract common audit logging codeGary Lockyer2018-05-164-0/+1441
Extract the common audit logging code into a library to allow it's re-use in other logging modules. Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>