Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ssl): add const to ngx_lua_kong_ssl_x509_copy argument #83

Merged
merged 1 commit into from
Mar 14, 2024

Conversation

fffonion
Copy link
Contributor

@fffonion fffonion commented Mar 7, 2024

Fix a warning that is recently being treated as error on macOS.

/private/var/tmp/_bazel_fffonion/1a165933b7da774c4bb1daeeee6ca097/execroot/kong/external/lua-kong-nginx-module/src/ssl/ngx_lua_kong_ssl.c:370:42: error: incompatible function pointer types passing 'X509 *(X509 *)' (aka 'struct x509_st *(struct x509_st *)') to parameter of type 'sk_X509_copyfunc' (aka 'struct x509_st *(*)(const struct x509_st *)') [-Wincompatible-function-pointer-types]
    new_chain = sk_X509_deep_copy(chain, ngx_lua_kong_ssl_x509_copy,
                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~
/private/var/tmp/_bazel_fffonion/1a165933b7da774c4bb1daeeee6ca097/execroot/kong/bazel-out/darwin_arm64-fastbuild/bin/external/openresty/openresty.ext_build_deps/openssl/include/openssl/x509.h:102:156: note: expanded from macro 'sk_X509_deep_copy'
#define sk_X509_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(X509) *)OPENSSL_sk_deep_copy(ossl_check_const_X509_sk_type(sk), ossl_check_X509_copyfunc_type(copyfunc), ossl_check_X509_freefunc_type(freefunc)))
                                                                                                                                                           ^~~~~~~~
/private/var/tmp/_bazel_fffonion/1a165933b7da774c4bb1daeeee6ca097/execroot/kong/bazel-out/darwin_arm64-fastbuild/bin/external/openresty/openresty.ext_build_deps/openssl/include/openssl/x509.h:78:1: note: passing argument to parameter 'cpy' here
SKM_DEFINE_STACK_OF_INTERNAL(X509, X509, X509)
^
/private/var/tmp/_bazel_fffonion/1a165933b7da774c4bb1daeeee6ca097/execroot/kong/bazel-out/darwin_arm64-fastbuild/bin/external/openresty/openresty.ext_build_deps/openssl/include/openssl/safestack.h:55:107: note: expanded from macro 'SKM_DEFINE_STACK_OF_INTERNAL'
    static ossl_unused ossl_inline OPENSSL_sk_copyfunc ossl_check_##t1##_copyfunc_type(sk_##t1##_copyfunc cpy) \

KAG-4050

@windmgc windmgc requested review from catbro666, chronolaw and oowl March 7, 2024 09:15
@@ -303,7 +303,7 @@ ngx_lua_kong_ssl_set_upstream_ssl(ngx_lua_kong_ssl_ctx_t *ctx, ngx_connection_t


static X509 *
ngx_lua_kong_ssl_x509_copy(X509 *in)
ngx_lua_kong_ssl_x509_copy(const X509 *in)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can not figure out why this change did not break the Mac toolchain before.

@vm-001
Copy link

vm-001 commented Mar 7, 2024

Verified on Mac(M1) with the Bazel build.

@catbro666
Copy link
Contributor

Do we need to compile without ignoring the warnings, as it is possible to miss warnings that are actually errors?

@fffonion
Copy link
Contributor Author

fffonion commented Mar 7, 2024

@catbro666 Yes I think so. We might need the -Werror copt for only openresty target, because some other targets from my tests don't compile with -Werror either🤷 . So that will need to be changed on Kong side and I didn't include it in this PR.

@fffonion fffonion merged commit 71c3232 into master Mar 14, 2024
6 checks passed
@fffonion fffonion deleted the fffonion-patch-1 branch March 14, 2024 07:20
fffonion added a commit that referenced this pull request Jun 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants