Skip to content

Commit

Permalink
cleanup warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
ekoby committed Oct 1, 2024
1 parent 2a95ba7 commit 95a6bac
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 19 deletions.
30 changes: 17 additions & 13 deletions library/auth_queries.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@ void ziti_mfa_enroll_post_internal_cb(void *empty, const ziti_error *err, void *
if (err == NULL) {
ziti_ctrl_get_mfa(ztx_get_controller(ztx), ziti_mfa_enroll_get_internal_cb, ctx);
} else {
ZTX_LOG(ERROR, "error during create MFA call: %d - %s - %s", err->http_code, err->code, err->message);
mfa_enroll_cb_ctx->cb(mfa_enroll_cb_ctx->ztx, err->err, NULL, mfa_enroll_cb_ctx->cb_ctx);
ZTX_LOG(ERROR, "error during create MFA call: %d - %s - %s", (int)err->http_code, err->code, err->message);
mfa_enroll_cb_ctx->cb(mfa_enroll_cb_ctx->ztx, (int)err->err, NULL, mfa_enroll_cb_ctx->cb_ctx);
FREE(ctx);
}
}
Expand All @@ -146,8 +146,8 @@ void ziti_mfa_enroll_get_internal_cb(ziti_mfa_enrollment *mfa_enrollment, const

if (err != NULL) {
if (err->http_code != 404) {
ZTX_LOG(ERROR, "error during enroll MFA call: %d - %s - %s", err->http_code, err->code, err->message);
mfa_enroll_cb_ctx->cb(mfa_enroll_cb_ctx->ztx, err->err, NULL, mfa_enroll_cb_ctx->cb_ctx);
ZTX_LOG(ERROR, "error during enroll MFA call: %d - %s - %s", (int)err->http_code, err->code, err->message);
mfa_enroll_cb_ctx->cb(mfa_enroll_cb_ctx->ztx, (int)err->err, NULL, mfa_enroll_cb_ctx->cb_ctx);
FREE(ctx);
return;
}
Expand Down Expand Up @@ -182,8 +182,8 @@ void ziti_mfa_remove_internal_cb(void *empty, const ziti_error *err, void *ctx)
ziti_context ztx = mfa_cb_ctx->ztx;

if (err != NULL) {
ZTX_LOG(ERROR, "error during remove MFA call: %d - %s - %s", err->http_code, err->code, err->message);
mfa_cb_ctx->cb(mfa_cb_ctx->ztx, err->err, mfa_cb_ctx->cb_ctx);
ZTX_LOG(ERROR, "error during remove MFA call: %d - %s - %s", (int)err->http_code, err->code, err->message);
mfa_cb_ctx->cb(mfa_cb_ctx->ztx, (int)err->err, mfa_cb_ctx->cb_ctx);
} else {
mfa_cb_ctx->cb(mfa_cb_ctx->ztx, ZITI_OK, mfa_cb_ctx->cb_ctx);
}
Expand Down Expand Up @@ -212,8 +212,8 @@ void ziti_mfa_verify_internal_cb(void *empty, const ziti_error *err, void *ctx)
ziti_context ztx = mfa_cb_ctx->ztx;

if (err != NULL) {
ZTX_LOG(ERROR, "error during verify MFA call: %d - %s - %s", err->http_code, err->code, err->message);
mfa_cb_ctx->cb(mfa_cb_ctx->ztx, err->err, mfa_cb_ctx->cb_ctx);
ZTX_LOG(ERROR, "error during verify MFA call: %d - %s - %s", (int)err->http_code, err->code, err->message);
mfa_cb_ctx->cb(mfa_cb_ctx->ztx, (int)err->err, mfa_cb_ctx->cb_ctx);
} else {
ziti_force_api_session_refresh(ztx);
mfa_cb_ctx->cb(mfa_cb_ctx->ztx, ZITI_OK, mfa_cb_ctx->cb_ctx);
Expand Down Expand Up @@ -242,10 +242,13 @@ void ziti_mfa_get_recovery_codes_internal_cb(ziti_mfa_recovery_codes *rc, const
ziti_mfa_recovery_codes_cb_ctx *mfa_recovery_codes_cb_ctx = ctx;
ziti_context ztx = mfa_recovery_codes_cb_ctx->ztx;
if (err != NULL) {
ZTX_LOG(ERROR, "error during get recovery codes MFA call: %d - %s - %s", err->http_code, err->code, err->message);
mfa_recovery_codes_cb_ctx->cb(mfa_recovery_codes_cb_ctx->ztx, err->err, NULL, mfa_recovery_codes_cb_ctx->cb_ctx);
ZTX_LOG(ERROR, "error during get recovery codes MFA call: %d - %s - %s",
(int)err->http_code, err->code, err->message);
mfa_recovery_codes_cb_ctx->cb(mfa_recovery_codes_cb_ctx->ztx, (int)err->err, NULL,
mfa_recovery_codes_cb_ctx->cb_ctx);
} else {
mfa_recovery_codes_cb_ctx->cb(mfa_recovery_codes_cb_ctx->ztx, ZITI_OK, rc->recovery_codes, mfa_recovery_codes_cb_ctx->cb_ctx);
mfa_recovery_codes_cb_ctx->cb(mfa_recovery_codes_cb_ctx->ztx, ZITI_OK, rc->recovery_codes,
mfa_recovery_codes_cb_ctx->cb_ctx);
free_ziti_mfa_recovery_codes(rc);
}

Expand Down Expand Up @@ -273,8 +276,9 @@ void ziti_mfa_post_recovery_codes_internal_cb(void *empty, const ziti_error *err
ziti_context ztx = mfa_recovery_codes_cb_ctx->ztx;

if (err != NULL) {
ZTX_LOG(ERROR, "error during create recovery codes MFA call: %d - %s - %s", err->http_code, err->code, err->message);
mfa_recovery_codes_cb_ctx->cb(mfa_recovery_codes_cb_ctx->ztx, err->err, NULL, mfa_recovery_codes_cb_ctx->cb_ctx);
ZTX_LOG(ERROR, "error during create recovery codes MFA call: %d - %s - %s",
(int)err->http_code, err->code, err->message);
mfa_recovery_codes_cb_ctx->cb(mfa_recovery_codes_cb_ctx->ztx, (int)err->err, NULL, mfa_recovery_codes_cb_ctx->cb_ctx);
} else {
ziti_mfa_get_recovery_codes(mfa_recovery_codes_cb_ctx->ztx, mfa_recovery_codes_cb_ctx->code, mfa_recovery_codes_cb_ctx->cb,
mfa_recovery_codes_cb_ctx->cb_ctx);
Expand Down
6 changes: 4 additions & 2 deletions library/authenticators.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ static void extend_cb(ziti_extend_cert_authenticator_resp* resp, const ziti_erro
ziti_context ztx = wrapped_ctx->ztx;

if(err){
ZTX_LOG(ERROR, "error response returned when attempting to extend authenticator: %d %s: %s, calling cb", err->http_code, err->code, err->message);
ZTX_LOG(ERROR, "error response returned when attempting to extend authenticator: %d %s: %s, calling cb",
(int)err->http_code, err->code, err->message);
if(err->http_code == 404) {
wrapped_ctx->extend_cb(ztx, NULL, ZITI_NOT_FOUND, wrapped_ctx->ctx);
} else if(strncmp(err->code, CAN_NOT_UPDATE_AUTHENTICATOR, strlen(CAN_NOT_UPDATE_AUTHENTICATOR)) == 0){
Expand Down Expand Up @@ -62,7 +63,8 @@ static void verify_cb(void* empty, const ziti_error* err, void* ctx){
ziti_context ztx = wrapped_ctx->ztx;

if(err) {
ZTX_LOG(ERROR, "error response returned when attempting to verify extended authenticator: %d %s: %s", err->http_code, err->code, err->message);
ZTX_LOG(ERROR, "error response returned when attempting to verify extended authenticator: %d %s: %s",
(int)err->http_code, err->code, err->message);
if(err->http_code == 404) {
wrapped_ctx->verify_cb(ztx, ZITI_NOT_FOUND, wrapped_ctx->ctx);
} else if(strncmp(err->code, CAN_NOT_UPDATE_AUTHENTICATOR, strlen(CAN_NOT_UPDATE_AUTHENTICATOR)) == 0){
Expand Down
10 changes: 6 additions & 4 deletions library/posture.c
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,8 @@ static void handle_pr_resp_timer_events(ziti_context ztx, ziti_pr_response *pr_r
for(service_timer = pr_resp->services; *service_timer != NULL; service_timer++){
NEWP(val, bool);
*val = true;
ZTX_LOG(DEBUG, "handle_pr_resp_timer_events: forcing service name[%s] id[%s] with timeout[%d] timeoutRemaining[%d]", (*service_timer)->name, (*service_timer)->id, *(*service_timer)->timeout, *(*service_timer)->timeoutRemaining);
ZTX_LOG(DEBUG, "handle_pr_resp_timer_events: forcing service name[%s] id[%s] with timeout[%d] timeoutRemaining[%d]",
(*service_timer)->name, (*service_timer)->id, (int)*(*service_timer)->timeout, (int)*(*service_timer)->timeoutRemaining);
ziti_force_service_update(ztx, (*service_timer)->id);
}

Expand All @@ -452,7 +453,7 @@ static void ziti_pr_post_bulk_cb(ziti_pr_response *pr_resp, const ziti_error *er
// if ztx is disabled this request is cancelled and posture_checks is cleared
if (ztx->posture_checks) {
if (err != NULL) {
ZTX_LOG(ERROR, "error during bulk posture response submission (%d) %s", err->http_code, err->message);
ZTX_LOG(ERROR, "error during bulk posture response submission (%d) %s", (int)err->http_code, err->message);
ztx->posture_checks->must_send = true; //error, must try again
} else {
ztx->posture_checks->must_send = false; //did not error, can skip submissions
Expand Down Expand Up @@ -489,7 +490,7 @@ static void ziti_pr_post_cb(ziti_pr_response *pr_resp, const ziti_error *err, vo
ZTX_LOG(DEBUG, "ziti_pr_post_cb: starting");

if (err != NULL) {
ZTX_LOG(ERROR, "error during individual posture response submission (%d) %s - object: %s", err->http_code,
ZTX_LOG(ERROR, "error during individual posture response submission (%d) %s - object: %s", (int)err->http_code,
err->message, pr_ctx->info->obj);
ziti_pr_set_info_errored(pr_ctx->ztx, pr_ctx->info->id);
} else {
Expand Down Expand Up @@ -850,7 +851,8 @@ static void process_check_work(uv_work_t *w) {
void ziti_endpoint_state_pr_cb(ziti_pr_response *pr_resp, const ziti_error *err, void *ctx) {
ziti_context ztx = ctx;
if (err) {
ZTX_LOG(ERROR, "error during endpoint state posture response submission: %d - %s", err->http_code, err->message);
ZTX_LOG(ERROR, "error during endpoint state posture response submission: %d - %s",
(int)err->http_code, err->message);
} else {
ZTX_LOG(INFO, "endpoint state sent");
handle_pr_resp_timer_events(ztx, pr_resp);
Expand Down

0 comments on commit 95a6bac

Please sign in to comment.