@@ -579,6 +579,7 @@ stir_shaken_status_t stir_shaken_acme_respond_to_challenge(stir_shaken_context_t
579
579
{
580
580
ks_json_t * json = NULL , * auth_status = NULL , * challenges_arr = NULL ;
581
581
stir_shaken_http_req_t http_req = { 0 };
582
+ const char * auth_status_value = "" ;
582
583
583
584
584
585
if (!data ) {
@@ -617,8 +618,12 @@ stir_shaken_status_t stir_shaken_acme_respond_to_challenge(stir_shaken_context_t
617
618
goto fail ;
618
619
}
619
620
620
- if (strcmp ("valid" , ks_json_value_string (auth_status )) == 0 ) {
621
-
621
+ #if KS_VERSION_NUM >= 20000
622
+ ks_json_value_string (auth_status , & auth_status_value );
623
+ #else
624
+ auth_status_value = ks_json_value_string (auth_status );
625
+ #endif
626
+ if (strcmp ("valid" , auth_status_value ) == 0 ) {
622
627
// Authorization completed
623
628
624
629
} else {
@@ -631,8 +636,8 @@ stir_shaken_status_t stir_shaken_acme_respond_to_challenge(stir_shaken_context_t
631
636
char * kid = NULL , * nonce = NULL ;
632
637
char * jwt_encoded = NULL ;
633
638
634
- if (strcmp ("pending" , ks_json_value_string ( auth_status ) ) != 0 ) {
635
- snprintf (err_buf , STIR_SHAKEN_BUFLEN , "ACME authorization challenge malformed, 'status' field is neither 'valid' nor 'pending' (status is: '%s')" , ks_json_value_string ( auth_status ) );
639
+ if (strcmp ("pending" , auth_status_value ) != 0 ) {
640
+ snprintf (err_buf , STIR_SHAKEN_BUFLEN , "ACME authorization challenge malformed, 'status' field is neither 'valid' nor 'pending' (status is: '%s')" , auth_status_value );
636
641
stir_shaken_set_error (ss , err_buf , STIR_SHAKEN_ERROR_ACME );
637
642
goto fail ;
638
643
}
@@ -673,7 +678,11 @@ stir_shaken_status_t stir_shaken_acme_respond_to_challenge(stir_shaken_context_t
673
678
goto fail ;
674
679
}
675
680
681
+ #if KS_VERSION_NUM >= 20000
682
+ ks_json_value_string (url_item , & challenge_url );
683
+ #else
676
684
challenge_url = ks_json_value_string (url_item );
685
+ #endif
677
686
if (polling_url ) {
678
687
* polling_url = strdup (challenge_url );
679
688
}
@@ -737,6 +746,7 @@ stir_shaken_status_t stir_shaken_acme_poll(stir_shaken_context_t *ss, void *data
737
746
ks_json_t * json = NULL , * auth_status = NULL ;
738
747
int t = 0 ;
739
748
char err_buf [STIR_SHAKEN_ERROR_BUF_LEN ] = { 0 };
749
+ const char * auth_status_value = "" ;
740
750
741
751
if (!url ) {
742
752
goto fail ;
@@ -795,26 +805,31 @@ stir_shaken_status_t stir_shaken_acme_poll(stir_shaken_context_t *ss, void *data
795
805
796
806
// Check authorization status
797
807
// If status is "valid" authorization is completed and can proceed to cert acquisition
798
- if (strcmp ("valid" , ks_json_value_string (auth_status )) == 0 ) {
808
+ #if KS_VERSION_NUM >= 20000
809
+ ks_json_value_string (auth_status , & auth_status_value );
799
810
811
+ #else
812
+ auth_status_value = ks_json_value_string (auth_status );
813
+ #endif
814
+ if (strcmp ("valid" , auth_status_value ) == 0 ) {
800
815
// Authorization completed
801
816
status_is_valid = 1 ;
802
817
fprintif (STIR_SHAKEN_LOGLEVEL_MEDIUM , "\t-> Got 'valid' polling status\n" );
803
818
804
819
} else {
805
820
806
- if (strcmp ("pending" , ks_json_value_string ( auth_status ) ) != 0 ) {
821
+ if (strcmp ("pending" , auth_status_value ) != 0 ) {
807
822
808
- if (0 == strcmp ("failed" , ks_json_value_string ( auth_status ) )) {
823
+ if (0 == strcmp ("failed" , auth_status_value )) {
809
824
fprintif (STIR_SHAKEN_LOGLEVEL_MEDIUM , "\t-> Got 'failed' polling status\n" );
810
- snprintf (err_buf , STIR_SHAKEN_BUFLEN , "\t-> Got 'failed' polling status (%s): ACME authorization unsuccessful\n" , ks_json_value_string ( auth_status ) );
825
+ snprintf (err_buf , STIR_SHAKEN_BUFLEN , "\t-> Got 'failed' polling status (%s): ACME authorization unsuccessful\n" , auth_status_value );
811
826
stir_shaken_set_error (ss , err_buf , STIR_SHAKEN_ERROR_ACME_AUTHZ_UNSUCCESSFUL );
812
827
goto fail ;
813
828
}
814
829
815
830
fprintif (STIR_SHAKEN_LOGLEVEL_MEDIUM , "\t-> Got malformed polling status\n" );
816
831
817
- snprintf (err_buf , STIR_SHAKEN_BUFLEN , "ACME auth status malformed, 'status' field is neither 'valid' nor 'pending' nor 'failed' (status is: '%s')\n" , ks_json_value_string ( auth_status ) );
832
+ snprintf (err_buf , STIR_SHAKEN_BUFLEN , "ACME auth status malformed, 'status' field is neither 'valid' nor 'pending' nor 'failed' (status is: '%s')\n" , auth_status_value );
818
833
stir_shaken_set_error (ss , err_buf , STIR_SHAKEN_ERROR_ACME );
819
834
goto fail ;
820
835
}
@@ -866,6 +881,7 @@ stir_shaken_status_t stir_shaken_acme_perform_authorization(stir_shaken_context_
866
881
{
867
882
ks_json_t * json = NULL , * auth_status = NULL , * auth_arr = NULL ;
868
883
char err_buf [STIR_SHAKEN_ERROR_BUF_LEN ] = { 0 };
884
+ const char * auth_status_value = "" ;
869
885
870
886
871
887
if (!data ) {
@@ -907,8 +923,12 @@ stir_shaken_status_t stir_shaken_acme_perform_authorization(stir_shaken_context_
907
923
fprintif (STIR_SHAKEN_LOGLEVEL_MEDIUM , "-> Processing authorization challenge...\n" );
908
924
909
925
// If status is "valid" authorization is completed and can proceed to cert acquisition
910
- if (strcmp ("valid" , ks_json_value_string (auth_status )) == 0 ) {
911
-
926
+ #if KS_VERSION_NUM >= 20000
927
+ ks_json_value_string (auth_status , & auth_status_value );
928
+ #else
929
+ auth_status_value = ks_json_value_string (auth_status );
930
+ #endif
931
+ if (strcmp ("valid" , auth_status_value ) == 0 ) {
912
932
// Authorization completed
913
933
fprintif (STIR_SHAKEN_LOGLEVEL_MEDIUM , "-> Authorization completed\n" );
914
934
@@ -918,8 +938,8 @@ stir_shaken_status_t stir_shaken_acme_perform_authorization(stir_shaken_context_
918
938
const char * auth_url = NULL ;
919
939
stir_shaken_http_req_t http_req = { 0 };
920
940
921
- if (strcmp ("pending" , ks_json_value_string ( auth_status ) ) != 0 ) {
922
- snprintf (err_buf , STIR_SHAKEN_BUFLEN , "ACME authorization challenge malformed, 'status' field is neither 'valid' nor 'pending' (status is: '%s')" , ks_json_value_string ( auth_status ) );
941
+ if (strcmp ("pending" , auth_status_value ) != 0 ) {
942
+ snprintf (err_buf , STIR_SHAKEN_BUFLEN , "ACME authorization challenge malformed, 'status' field is neither 'valid' nor 'pending' (status is: '%s')" , auth_status_value );
923
943
stir_shaken_set_error (ss , err_buf , STIR_SHAKEN_ERROR_ACME );
924
944
goto fail ;
925
945
}
@@ -951,7 +971,11 @@ stir_shaken_status_t stir_shaken_acme_perform_authorization(stir_shaken_context_
951
971
goto fail ;
952
972
}
953
973
974
+ #if KS_VERSION_NUM >= 20000
975
+ ks_json_value_string (auth_item , & auth_url );
976
+ #else
954
977
auth_url = ks_json_value_string (auth_item );
978
+ #endif
955
979
956
980
/*
957
981
* Performing Step 4 of 6.3.5.2 ACME Based Steps for Application for an STI Certificate [ATIS-1000080].
0 commit comments