Skip to content

Instantly share code, notes, and snippets.

@jrmuizel
Created February 9, 2024 17:11
Show Gist options
  • Save jrmuizel/f9b2b379986fa63fdece61109f52b93b to your computer and use it in GitHub Desktop.
Save jrmuizel/f9b2b379986fa63fdece61109f52b93b to your computer and use it in GitHub Desktop.
test.c
#include <assert.h>
#include <bsm/audit.h>
#include <bsm/audit_session.h>
int main() {
auditinfo_addr_t auditInfo;
int result = getaudit_addr(&auditInfo, sizeof(auditInfo));
assert(result == 0 );
if (auditInfo.ai_flags & AU_SESSION_FLAG_IS_INITIAL) {
printf("AU_SESSION_FLAG_IS_INITIAL\n");
}
if (auditInfo.ai_flags & AU_SESSION_FLAG_HAS_GRAPHIC_ACCESS) {
printf("AU_SESSION_FLAG_HAS_GRAPHIC_ACCESS\n");
}
if (auditInfo.ai_flags & AU_SESSION_FLAG_HAS_TTY) {
printf("AU_SESSION_FLAG_HAS_TTY\n");
}
if (auditInfo.ai_flags & AU_SESSION_FLAG_IS_REMOTE) {
printf("AU_SESSION_FLAG_IS_REMOTE\n");
}
if (auditInfo.ai_flags & AU_SESSION_FLAG_HAS_CONSOLE_ACCESS) {
printf("AU_SESSION_FLAG_HAS_CONSOLE_ACCESS\n");
}
if (auditInfo.ai_flags & AU_SESSION_FLAG_HAS_AUTHENTICATED) {
printf("AU_SESSION_FLAG_HAS_AUTHENTICATED\n");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment