From d0a2077b844ce9fc6293f2f285befad70993d10d Mon Sep 17 00:00:00 2001 From: Artjoms Rimdjonoks Date: Mon, 16 Nov 2020 16:12:52 +0200 Subject: ........S. [ZBXNEXT-6207] added server side auth token validation --- tests/zabbix_server/trapper/Makefile.am | 3 ++- tests/zabbix_server/trapper/zbx_trapper_preproc_test_run.c | 10 ++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/zabbix_server/trapper/Makefile.am b/tests/zabbix_server/trapper/Makefile.am index 06437cbdb77..5b9d49d6bc8 100644 --- a/tests/zabbix_server/trapper/Makefile.am +++ b/tests/zabbix_server/trapper/Makefile.am @@ -44,7 +44,8 @@ zbx_trapper_preproc_test_run_LDFLAGS = @SERVER_LDFLAGS@ zbx_trapper_preproc_test_run_CFLAGS = \ -I@top_srcdir@/tests @LIBXML2_CFLAGS@ \ -Wl,--wrap=zbx_preprocessor_test \ - -Wl,--wrap=DBget_user_by_active_session + -Wl,--wrap=DBget_user_by_active_session \ + -Wl,--wrap=DBget_user_by_auth_token endif diff --git a/tests/zabbix_server/trapper/zbx_trapper_preproc_test_run.c b/tests/zabbix_server/trapper/zbx_trapper_preproc_test_run.c index 4f4a93d78f2..4251f28fc58 100644 --- a/tests/zabbix_server/trapper/zbx_trapper_preproc_test_run.c +++ b/tests/zabbix_server/trapper/zbx_trapper_preproc_test_run.c @@ -92,6 +92,16 @@ int __wrap_DBget_user_by_active_session(const char *sessionid, zbx_user_t *user) return SUCCEED; } +int __wrap_DBget_user_by_auth_token(const char *authtoken, zbx_user_t *user) +{ + ZBX_UNUSED(authtoken); + + user->type = USER_TYPE_ZABBIX_ADMIN; + user->userid = 0; + + return SUCCEED; +} + void zbx_mock_test_entry(void **state) { const char *request; -- cgit v1.2.3