pam: gate PAC indicator code on BUILD_SAMBA#8620
Conversation
There was a problem hiding this comment.
Code Review
This pull request makes the Samba-related PAC handling and idmapping dependencies optional for the PAM responder and its associated tests. It introduces conditional build logic in Makefile.am and preprocessor guards in src/responder/pam/pamsrv_gssapi.c using the BUILD_SAMBA flag. I have no feedback to provide.
sssd-bot
left a comment
There was a problem hiding this comment.
Review done using Claude Code / claude-opus-4-6
Functional Issues
No functional issues found. The BUILD_SAMBA guards in pamsrv_gssapi.c correctly wrap all code that depends on Samba-provided symbols (ad_pac.h, handle_pac, idmap_talloc/idmap_free, exported_from_pac variable), and the Makefile.am changes correctly gate ad_pac_common.c, $(NDR_KRB5PAC_CFLAGS), and $(NDR_KRB5PAC_LIBS) behind BUILD_SAMBA for all three targets (sssd_pam, pam_srv_tests, test_pamsrv_json). The libsss_idmap.la linkage was only gated for sssd_pam (where it was added by commit 1f680ed), while correctly left unconditional for the test targets (where it pre-existed).
Nits & Non-functional Issues
-
Unnecessary MSPAC attribute processing without Samba (
src/responder/pam/pamsrv_gssapi.c:679-693): WhenBUILD_SAMBAis not defined, the MSPAC tag detection code (lines 679–683) still identifies MSPAC attributes and enters thewhile (more != 0)loop (line 697), callinggss_get_name_attribute()to extract PAC data that is then silently discarded (the PAC handling block on line 714 is gated, andis_auth_indicatoris false). This is functionally harmless but wastes GSSAPI calls. Consider gating the MSPAC detection itself:#ifndef BUILD_SAMBA } else { #else } else if (attrs->elements[i].length == (sizeof(MSPAC_TAG) - 1) && strncmp(MSPAC_TAG, attrs->elements[i].value, sizeof(MSPAC_TAG) - 1) == 0) { is_mspac = true; is_auth_indicator = false; } else { #endif
Or more simply, add a
continueafter the MSPAC detection whenBUILD_SAMBAis not defined. -
Indentation inconsistency in
Makefile.am: Within the samesssd_pamtarget,SOURCESadditions insideif BUILD_SAMBAblocks are indented with 4 spaces (e.g.,Makefile.am:1530), butCFLAGSandLDADDadditions are not indented (e.g.,Makefile.am:1537,Makefile.am:1551). The same inconsistency appears in thepam_srv_testsandtest_pamsrv_jsontargets. The BUILD_PASSKEY conditional just above (line 1527) uses indented content, so the indented style appears to be the local convention:# Line 1536-1538: not indented if BUILD_SAMBA sssd_pam_CFLAGS += $(NDR_KRB5PAC_CFLAGS) endif # vs Line 1529-1531: indented (matches BUILD_PASSKEY above) if BUILD_SAMBA sssd_pam_SOURCES += src/providers/ad/ad_pac_common.c endif
-
Unconditional
gssapi_get_apply_sid_listcall (src/responder/pam/pamsrv_gssapi.c:870): The function at line 787 and its call at line 870 are not gated behindBUILD_SAMBA. Without Samba,state->indicators_apply_sidis populated but never consumed (the only consumer at line 716 is inside theBUILD_SAMBAguard). This wastes a small amount of memory and config parsing. Low priority since it compiles and runs correctly in all configurations.
Confirmed Issues from Existing Review Comments
No inline review comments were submitted on this PR.
|
Hi, thank you for the fixes, I have to admit that I didn't thought of the non-Samba use-case when writing the offending patches. I agree with our changes but I wonder if you can add the following changes as well: which removes the related option from the man page and which will error out during startup if the option is used. I think this will make the build without Samba more consistent. bye, |
f7a8c13 to
3f3d92f
Compare
|
@sumit-bose, I've applied the diffs you requested. |
sumit-bose
left a comment
There was a problem hiding this comment.
Hi,
thank you for including the additional patches, I have no further comments, ACK.
bye,
Sumit
Commit 1f680ed added ad_pac_common.c and $(NDR_KRB5PAC_LIBS) to sssd_pam unconditionally. So when building --without-samba, sssd_pam fails to link with undefined references to ndr_pull_init_blob and ndr_pull_PAC_DATA. This change qualifies those additions with `BUILD_SAMBA` so the PAC indicator feature is compiled in only when samba support is enabled. Reviewed-by: Sumit Bose <sbose@redhat.com> Reviewed-by: Tomáš Halman <thalman@redhat.com>
3f3d92f to
4cdea3a
Compare
Commit 1f680ed added ad_pac_common.c and $(NDR_KRB5PAC_LIBS) to sssd_pam unconditionally. So when building --without-samba, sssd_pam fails to link with undefined references to ndr_pull_init_blob and ndr_pull_PAC_DATA.
This change qualifies those additions with
BUILD_SAMBAso the PAC indicator feature is compiled in only when samba support is enabled.