Skip to content

Commit

Permalink
check for disabled ztx before using ztx_get_controller
Browse files Browse the repository at this point in the history
  • Loading branch information
scareything committed Oct 23, 2024
1 parent a3d892a commit 53e7adb
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions library/posture.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,11 @@ static pr_info *get_resp_info(ziti_context ztx, const char *id) {
}

void ziti_send_posture_data(ziti_context ztx) {
if (!ztx->posture_checks) {
ZTX_LOG(DEBUG, "endpoint is disabled");
return;
}

if(ztx->auth_state != ZitiAuthStateFullyAuthenticated) {
ZTX_LOG(DEBUG, "api_session is partially authenticated, can't submit posture responses");
return;
Expand Down Expand Up @@ -509,6 +514,11 @@ static void ziti_pr_send(ziti_context ztx) {
}

static void ziti_pr_send_bulk(ziti_context ztx) {
if (!ztx->posture_checks) {
ZTX_LOG(DEBUG, "endpoint is disabled");
return;
}

size_t body_len = 0;
char *body;

Expand Down Expand Up @@ -560,6 +570,10 @@ static void ziti_pr_send_bulk(ziti_context ztx) {
}

static void ziti_pr_send_individually(ziti_context ztx) {
if (!ztx->posture_checks) {
ZTX_LOG(DEBUG, "endpoint is disabled");
return;
}

__attribute__((unused)) const char *key;
pr_info *info;
Expand Down Expand Up @@ -863,6 +877,11 @@ void ziti_endpoint_state_pr_cb(ziti_pr_response *pr_resp, const ziti_error *err,


void ziti_endpoint_state_change(ziti_context ztx, bool woken, bool unlocked) {
if (!ztx->posture_checks) {
ZTX_LOG(WARN, "endpoint is disabled");
return;
}

if (woken || unlocked) {
ZTX_LOG(INFO, "endpoint state change reported: woken[%s] unlocked[%s]", woken ? "TRUE":"FALSE", unlocked ? "TRUE":"FALSE");
ziti_pr_endpoint_state_req state_req = {
Expand Down

0 comments on commit 53e7adb

Please sign in to comment.