Skip to content

[TACACS] Ignore TACACS accounting trace log when debug disabled. #16482

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ Subject: [PATCH] Remove user secret from accounting log.
regex_helper.h | 17 +++
sudoers_helper.c | 250 +++++++++++++++++++++++++++++++++++++++
sudoers_helper.h | 18 +++
trace.c | 21 ++++
trace.c | 31 +++++
trace.h | 10 ++
unittest/Makefile | 21 ++++
unittest/mock.h | 17 +++
unittest/mock_helper.c | 65 ++++++++++
unittest/mock_helper.h | 48 ++++++++
unittest/password_test.c | 199 +++++++++++++++++++++++++++++++
unittest/sudoers | 5 +
17 files changed, 931 insertions(+), 4 deletions(-)
17 files changed, 941 insertions(+), 4 deletions(-)
create mode 100644 password.c
create mode 100644 password.h
create mode 100644 regex_helper.c
Expand Down Expand Up @@ -700,7 +700,7 @@ new file mode 100644
index 0000000..44bbbc7
--- /dev/null
+++ b/trace.c
@@ -0,0 +1,21 @@
@@ -0,0 +1,31 @@
+#include <stdarg.h>
+#include <stdio.h>
+#include <string.h>
Expand All @@ -709,9 +709,19 @@ index 0000000..44bbbc7
+
+#include "trace.h"
+
+/* Tacacs+ support lib */
+#include <libtac/support.h>
+
+/* Tacacs control flag */
+extern int tacacs_ctrl;
+
+/* Output trace log. */
+void trace(const char *format, ...)
+{
+ if ((tacacs_ctrl & PAM_TAC_DEBUG) == 0) {
+ return;
+ }
+
+ // convert log to a string because va args resoursive issue:
+ // http://www.c-faq.com/varargs/handoff.html
+ char logBuffer[MAX_LINE_SIZE];
Expand Down