Skip to content

Commit

Permalink
Merge pull request #761 from openziti/check.disabled.ztx
Browse files Browse the repository at this point in the history
check for disabled ztx before using ztx_get_controller
  • Loading branch information
scareything authored Oct 23, 2024
2 parents a3d892a + 53e7adb commit 2120296
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 2120296

Please sign in to comment.