From: Gary Lockyer Date: Mon, 9 Apr 2018 18:47:40 +0000 (+1200) Subject: auth log: Log the unique session GUID X-Git-Tag: ldb-1.4.0~372 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=52a3318be8316a8956d7bb6f62d64e32fed6f952;p=thirdparty%2Fsamba.git auth log: Log the unique session GUID Log the unique_session_token GUID on successful Authorizations. This patch adds the "sessionID" attribute to the Authorization object and increments the version to 1.1 Signed-off-by: Gary Lockyer Reviewed-by: Andrew Bartlett --- diff --git a/auth/auth_log.c b/auth/auth_log.c index c143ae306fb..97b65371bdc 100644 --- a/auth/auth_log.c +++ b/auth/auth_log.c @@ -43,7 +43,7 @@ #define AUTH_MAJOR 1 #define AUTH_MINOR 0 #define AUTHZ_MAJOR 1 -#define AUTHZ_MINOR 0 +#define AUTHZ_MINOR 1 #include "includes.h" #include "../lib/tsocket/tsocket.h" @@ -56,6 +56,7 @@ #include "source4/lib/messaging/irpc.h" #include "lib/util/server_id_db.h" #include "lib/param/param.h" +#include "librpc/ndr/libndr.h" /* * Get a human readable timestamp. @@ -430,6 +431,26 @@ static void add_sid(struct json_context *context, add_string(context, name, sid_buf); } +/* + * Add a formatted string representation of a GUID to a json object. + * + */ +static void add_guid(struct json_context *context, + const char *name, + struct GUID *guid) +{ + + char *guid_str; + struct GUID_txt_buf guid_buff; + + if (context->error) { + return; + } + + guid_str = GUID_buf_string(guid, &guid_buff); + add_string(context, name, guid_str); +} + /* * Write a machine parsable json formatted authentication log entry. * @@ -561,6 +582,9 @@ static void log_successful_authz_event_json( add_string(&authorization, "domain", session_info->info->domain_name); add_string(&authorization, "account", session_info->info->account_name); add_sid(&authorization, "sid", &session_info->security_token->sids[0]); + add_guid(&authorization, + "sessionId", + &session_info->unique_session_token); add_string(&authorization, "logonServer", session_info->info->logon_server);