mirror of
https://github.com/samba-team/samba.git
synced 2024-12-24 21:34:56 +03:00
48ad90d93b
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>
92 lines
2.8 KiB
C
92 lines
2.8 KiB
C
/*
|
|
common routines for audit logging
|
|
|
|
Copyright (C) Andrew Bartlett <abartlet@samba.org> 2018
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation; either version 3 of the License, or
|
|
(at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#include <talloc.h>
|
|
#include "lib/messaging/irpc.h"
|
|
#include "lib/tsocket/tsocket.h"
|
|
|
|
char* audit_get_timestamp(TALLOC_CTX *frame);
|
|
void audit_log_human_text(const char *prefix,
|
|
const char *message,
|
|
int debug_class,
|
|
int debug_level);
|
|
|
|
#ifdef HAVE_JANSSON
|
|
#include <jansson.h>
|
|
/*
|
|
* Wrapper for jannson JSON object
|
|
*
|
|
*/
|
|
struct json_object {
|
|
json_t *root;
|
|
bool error;
|
|
};
|
|
|
|
void audit_log_json(const char *prefix,
|
|
struct json_object *message,
|
|
int debug_class,
|
|
int debug_level);
|
|
void audit_message_send(struct imessaging_context *msg_ctx,
|
|
const char *server_name,
|
|
uint32_t message_type,
|
|
struct json_object *message);
|
|
struct json_object json_new_object(void);
|
|
struct json_object json_new_array(void);
|
|
void json_free(struct json_object *object);
|
|
void json_assert_is_array(struct json_object *array);
|
|
bool json_is_invalid(struct json_object *object);
|
|
|
|
void json_add_int(struct json_object *object,
|
|
const char* name,
|
|
const int value);
|
|
void json_add_bool(struct json_object *object,
|
|
const char* name,
|
|
const bool value);
|
|
void json_add_string(struct json_object *object,
|
|
const char* name,
|
|
const char* value);
|
|
void json_add_object(struct json_object *object,
|
|
const char* name,
|
|
struct json_object *value);
|
|
void json_add_stringn(struct json_object *object,
|
|
const char *name,
|
|
const char *value,
|
|
const size_t len);
|
|
void json_add_version(struct json_object *object,
|
|
int major,
|
|
int minor);
|
|
void json_add_timestamp(struct json_object *object);
|
|
void json_add_address(struct json_object *object,
|
|
const char *name,
|
|
const struct tsocket_address *address);
|
|
void json_add_sid(struct json_object *object,
|
|
const char *name,
|
|
const struct dom_sid *sid);
|
|
void json_add_guid(struct json_object *object,
|
|
const char *name,
|
|
const struct GUID *guid);
|
|
|
|
struct json_object json_get_array(struct json_object *object,
|
|
const char* name);
|
|
struct json_object json_get_object(struct json_object *object,
|
|
const char* name);
|
|
char *json_to_string(TALLOC_CTX *mem_ctx,
|
|
struct json_object *object);
|
|
#endif
|