From b8e6051ed4a4dacdf6108c3fb79bf013db59ec6c Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Mon, 10 Feb 2025 14:55:37 -0500 Subject: [PATCH 1/2] Change declaration of function map Newer compilers complain if funciton is declared w/o arguments, so we redeclare the xdrptoc_t as xdrfn and give it proper arguments Signed-off-by: Simo Sorce --- rpcgen/gp_xdr.h | 4 ++++ src/client/gpm_common.c | 8 ++++++-- src/gp_rpc_process.c | 8 ++++++-- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/rpcgen/gp_xdr.h b/rpcgen/gp_xdr.h index bbd747d0..e7a476f3 100644 --- a/rpcgen/gp_xdr.h +++ b/rpcgen/gp_xdr.h @@ -5,6 +5,10 @@ #include "gssrpc/rpc.h" +/* Equivalent to xdrptoc_t but with proper arguments so that modern + * compilers do not complain */ +typedef int xdrfn(XDR *, void *); + #define xdr_u_quad_t gp_xdr_uint64_t bool_t gp_xdr_uint64_t(XDR *xdrs, uint64_t *objp); diff --git a/src/client/gpm_common.c b/src/client/gpm_common.c index 22a74ab4..2c0925d0 100644 --- a/src/client/gpm_common.c +++ b/src/client/gpm_common.c @@ -676,6 +676,8 @@ int gpm_make_call(int proc, union gp_rpc_arg *arg, union gp_rpc_res *res) gp_rpc_msg msg; XDR xdr_call_ctx = {0}; XDR xdr_reply_ctx = {0}; + xdrfn *arg_fn; + xdrfn *res_fn; char *send_buffer = NULL; char *recv_buffer = NULL; uint32_t send_length; @@ -726,7 +728,8 @@ int gpm_make_call(int proc, union gp_rpc_arg *arg, union gp_rpc_res *res) } /* encode data */ - xdrok = gpm_xdr_set[proc].arg_fn(&xdr_call_ctx, (char *)arg); + arg_fn = gpm_xdr_set[proc].arg_fn; + xdrok = arg_fn(&xdr_call_ctx, arg); if (!xdrok) { ret = EINVAL; goto done; @@ -765,7 +768,8 @@ int gpm_make_call(int proc, union gp_rpc_arg *arg, union gp_rpc_res *res) } /* decode answer */ - xdrok = gpm_xdr_set[proc].res_fn(&xdr_reply_ctx, (char *)res); + res_fn = gpm_xdr_set[proc].res_fn; + xdrok = res_fn(&xdr_reply_ctx, res); if (!xdrok) { ret = EINVAL; } diff --git a/src/gp_rpc_process.c b/src/gp_rpc_process.c index eaffc55e..1ac7c167 100644 --- a/src/gp_rpc_process.c +++ b/src/gp_rpc_process.c @@ -196,6 +196,7 @@ static int gp_rpc_decode_call(XDR *xdr_call_ctx, gp_rpc_accept_status *acc, gp_rpc_reject_status *rej) { + xdrfn *arg_fn; bool xdrok; int ret; @@ -204,7 +205,8 @@ static int gp_rpc_decode_call(XDR *xdr_call_ctx, return ret; } - xdrok = gp_xdr_set[*proc].arg_fn(xdr_call_ctx, (char *)arg); + arg_fn = gp_xdr_set[*proc].arg_fn; + xdrok = arg_fn(xdr_call_ctx, arg); if (!xdrok) { *acc = GP_RPC_GARBAGE_ARGS; return EINVAL; @@ -283,6 +285,7 @@ static int gp_rpc_encode_reply(XDR *xdr_reply_ctx, gp_rpc_accept_status acc, gp_rpc_reject_status rej) { + xdrfn *res_fn; bool xdrok; int ret; @@ -291,7 +294,8 @@ static int gp_rpc_encode_reply(XDR *xdr_reply_ctx, return ret; } - xdrok = gp_xdr_set[proc].res_fn(xdr_reply_ctx, (char *)res); + res_fn = gp_xdr_set[proc].res_fn; + xdrok = res_fn(xdr_reply_ctx, res); if (!xdrok) { return gp_rpc_encode_reply_header(xdr_reply_ctx, xid, EINVAL, From a184785a5156e67d906c3d601ddabfa5570080d6 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Mon, 10 Feb 2025 14:36:42 -0500 Subject: [PATCH 2/2] Revamp and modernize the CI scripts This is partially copied from the pkcs11-provider CI scripts which instantiate conatiners to bring in more reasonable distro defaults and properly check on multiple compilers Signed-off-by: Simo Sorce --- .github/workflows/ci.yaml | 85 +++++++++++++++++++++++++-------------- 1 file changed, 54 insertions(+), 31 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 73e5e703..2a6cd33a 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -2,34 +2,57 @@ name: CI on: [push, pull_request] jobs: - ubuntu: - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - name: [ubuntu-clang, ubuntu-gcc] - include: - - name: ubuntu-clang - compiler: clang - cflags: -Wall -Wextra -Werror -Wno-cast-align -Wno-unused-parameter -Wno-missing-braces - - name: ubuntu-gcc - compiler: gcc - cflags: -Wall -Wextra -Werror -Wno-unused-parameter -Wno-format-truncation -Wno-restrict - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - name: Install dependencies - run: | - sudo apt-get update - sudo apt-get install -y build-essential autopoint clang gcc docbook-{xsl,xml} libxml2-utils xml-core xsltproc lib{krb5,ini-config,keyutils,popt,selinux1,systemd,verto}-dev lib{nss,socket}-wrapper python3{,-colorama} valgrind krb5-{kdc,admin-server,kdc-ldap} ldap-utils slapd apparmor-utils - - name: Silence AppArmor - run: sudo aa-complain $(which slapd) - - name: Setup - run: | - autoreconf -fiv - ./configure - - name: Build and test - env: - CFLAGS: ${{ matrix.cflags }} - CC: ${{ matrix.compiler }} - run: make -s distcheck DISTCHECK_CONFIGURE_FLAGS="CFLAGS=\"$CFLAGS\" CC=\"$CC\"" + ci: + name: CI + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + name: [fedora, debian] + compiler: [gcc, clang] + include: + - name: fedora + container: fedora:latest + - name: debian + container: debian:sid + container: ${{ matrix.container }} + steps: + - name: Install dependencies + run: | + if [ -f /etc/redhat-release ]; then + dnf -y install --setopt='tsflags=' ${{ matrix.compiler }} \ + make autoconf automake libtool pkgconf-pkg-config \ + gettext-devel openssl-devel popt-devel docbook-style-xsl \ + xml-common libxslt krb5-workstation krb5-devel \ + libini_config-devel nss_wrapper socket_wrapper systemd-devel \ + libselinux-devel libverto-devel python3 python3-colorama \ + krb5-server krb5-server-ldap openldap-servers openldap-clients \ + which valgrind + elif [ -f /etc/debian_version ]; then + apt-get -q update + apt-get -yq install ${{ matrix.compiler }} make autoconf \ + automake autotools-dev libtool pkg-config autopoint libssl-dev \ + docbook-xsl docbook-xml libxml2-utils xml-core xsltproc \ + libkrb5-dev libini-config-dev libkeyutils-dev libpopt-dev \ + libselinux1-dev libsystemd-dev systemd-dev libverto-dev \ + libnss-wrapper libsocket-wrapper python3 python3-colorama \ + krb5-kdc krb5-admin-server krb5-kdc-ldap ldap-utils slapd \ + valgrind + fi + - name: Checkout repository + uses: actions/checkout@v4 + - name: Setup + run: | + autoreconf -fiv + ./configure + - name: Build and test + env: + CC: ${{ matrix.compiler }} + run: make -s distcheck DISTCHECK_CONFIGURE_FLAGS="CC=\"$CC\"" + - uses: actions/upload-artifact@v4 + if: failure() + with: + name: logs ${{ matrix.name }}, ${{ matrix.compiler }} + path: | + config.log + testdir