Address review comments: keep original gates, add static config gates - #39
Open
pragyagandhi wants to merge 2 commits into
Open
Address review comments: keep original gates, add static config gates#39pragyagandhi wants to merge 2 commits into
pragyagandhi wants to merge 2 commits into
Conversation
added 2 commits
August 12, 2026 05:53
Per review feedback, keep the original #ifdef HAVE_TLS and
#ifdef/#ifndef ENABLE_INSECURE_AUTH_FOR_DEVTEST gates (and their
comments) as-is, and instead rely on static compile-time gates to
enforce the required build configuration.
- lib/libnfs.c:
- handle xprtsec=none outside HAVE_TLS (accepted as a no-op);
- restore original #ifndef ENABLE_INSECURE_AUTH_FOR_DEVTEST guard in
nfs_set_auth_context();
- restore original #ifdef ENABLE_INSECURE_AUTH_FOR_DEVTEST gate and
comment around the insecure AZAUTH path in rpc_connect_program_4_cb().
- lib/socket.c: restore original #ifdef ENABLE_INSECURE_AUTH_FOR_DEVTEST
gate and comment around the insecure AZAUTH path in reconnect_cb().
- include/libnfs-private.h: add static gates (#error) that bail out if
HAVE_TLS is enabled or ENABLE_INSECURE_AUTH_FOR_DEVTEST is disabled.
- CMakeLists.txt: bail out (FATAL_ERROR) at configure time if
ENABLE_INSECURE_AUTH_FOR_DEVTEST is disabled.
With RPC-with-TLS removed, HAVE_TLS is never defined. The code that is compiled when ENABLE_INSECURE_AUTH_FOR_DEVTEST is *disabled* (e.g. the xprtsec check in nfs_set_auth_context) references TLS-only fields, so the library only compiles when ENABLE_INSECURE_AUTH_FOR_DEVTEST is enabled. The upstream CI builds with the default options (no -D flag), which previously left the flag OFF and tripped the static gate / compile. Default the option to ON so the standard build works out of the box; the static gate still bails out if it is explicitly disabled.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to #38 addressing the review comments, plus the changes required to make the
"no GnuTLS / non-TLS only" build actually compile and pass CI.
The GnuTLS / RPC-with-TLS dependency is removed so builds are not blocked on distros
where gnutls is not an allowed package (e.g. Azure Linux). The only supported transport is
non-TLS (
xprtsec=none), and AZAUTH (AzAuthNone) is always sent as the first RPC overthat non-TLS connection.
The two flags
After this change there is exactly one valid build configuration:
HAVE_TLSoff,ENABLE_INSECURE_AUTH_FOR_DEVTESTon.HAVE_TLSENABLE_INSECURE_AUTH_FOR_DEVTESTChanges
find_package(GnuTLS)/-DHAVE_TLS/add_subdirectory(tls)— gnutls is neverfound, linked, or compiled.
ENABLE_INSECURE_AUTH_FOR_DEVTESTdefaults ON; explicitly disabling it trips aFATAL_ERROR(static gate).#errorifHAVE_TLSis enabled or ifENABLE_INSECURE_AUTH_FOR_DEVTESTis disabled.use_azauth/auth_contextmoved out of theHAVE_TLSguard (AZAUTH is a non-TLSfeature).
xprtsec=nonehandled outsideHAVE_TLSas a no-op (tls/mtlsstay guarded).#ifndef ENABLE_INSECURE_AUTH_FOR_DEVTESTguard innfs_set_auth_contextand the#ifdef ENABLE_INSECURE_AUTH_FOR_DEVTESTgate (+comment)in
rpc_connect_program_4_cb(per review).rpc_connect_program_5_0_cbwith#ifdef HAVE_TLS(TLS-only callback thatotherwise fails to compile with TLS off).
#ifdef ENABLE_INSECURE_AUTH_FOR_DEVTESTgate (+comment) on reconnect, andmoved
reconnect_cb_azauthout of theHAVE_TLSguard.Why it is logically correct
The reverted
#ifndef ENABLE_INSECURE_AUTH_FOR_DEVTESTblock innfs_set_auth_contextreferences
wanted_xprtsec, aHAVE_TLS-only field. With TLS removed it would fail tocompile if
INSECUREwere off — it is safe only because the gates guaranteeINSECUREis always on, so that block is always compiled out. Walking the single enforced config
(HAVE_TLS=off, INSECURE=on):#ifdef HAVE_TLSblocks (TLS handshake,5_0_cb,tls/mtlsparse)#ifndef INSECUREblock (referenceswanted_xprtsec)#ifdef INSECUREAZAUTH pathxprtsec=noneparseAny other flag combination fails loudly at build time (static gates) instead of misbehaving
at runtime.
Runtime flow
sequenceDiagram participant C as client participant L as libnfs participant S as Blob NFS server (:2048) C->>L: nfs_set_auth_context(authtype=AzAuthNone) -> use_azauth=TRUE C->>L: nfs_mount() L->>S: TCP connect (non-TLS) L->>S: AZAUTH RPC (AzAuthNone) (always first, over non-TLS) alt server has AzAuth enabled S-->>L: AZAUTH OK L->>S: MOUNT / NFS ops S-->>C: mounted (or MNT3ERR_NOENT if container missing) else server without AzAuth S-->>L: no response / reject L-->>C: "AzAuth not enabled/setup on server" diagnostic endTesting
lddshows no gnutls/p11-kit/nettle/etc).cmake -B build -G Ninja) and-D ENABLE_TESTS=yesboth build cleanly.