Skip to content

Pr7817 2.9#8466

Closed
alexey-tikhonov wants to merge 17 commits intoSSSD:sssd-2-9from
alexey-tikhonov:pr7817-2.9
Closed

Pr7817 2.9#8466
alexey-tikhonov wants to merge 17 commits intoSSSD:sssd-2-9from
alexey-tikhonov:pr7817-2.9

Conversation

@alexey-tikhonov
Copy link
Member

No description provided.

Reviewed-by: Alexey Tikhonov <atikhono@redhat.com>
Reviewed-by: Sumit Bose <sbose@redhat.com>
Reviewed-by: Alexey Tikhonov <atikhono@redhat.com>
Reviewed-by: Sumit Bose <sbose@redhat.com>
Reviewed-by: Alexey Tikhonov <atikhono@redhat.com>
Reviewed-by: Sumit Bose <sbose@redhat.com>
Resolves: SSSD#5905

Reviewed-by: Alexey Tikhonov <atikhono@redhat.com>
Reviewed-by: Sumit Bose <sbose@redhat.com>
Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the smart card handling logic in p11_child_openssl.c by extracting slot-specific operations into a new do_slot function. This change enables support for processing multiple smart card tokens, an improvement over the previous implementation that only handled the first token found. While the refactoring is a good step forward, I've identified two critical vulnerabilities where strcmp is called with a potentially NULL argument, which could lead to a segmentation fault. These issues must be addressed by adding appropriate NULL checks.

token_name, slot_name, (int) slot_id, (int) module_id,
module_file_name);

if (mode == OP_AUTH && strcmp(token_name, token_name_in) != 0) {

Choose a reason for hiding this comment

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

critical

The strcmp call can cause a segmentation fault if token_name_in is NULL. The token_name_in parameter can be NULL if it's not provided on the command line when invoking p11_child. You should add a NULL check for token_name_in before calling strcmp.

    if (mode == OP_AUTH && token_name_in != NULL && strcmp(token_name, token_name_in) != 0) {

free(mod_name);

DEBUG(SSSDBG_TRACE_ALL, "dll name: [%s].\n", mod_file_name);
if (mode == OP_AUTH && strcmp(mod_file_name, module_name_in) != 0) {

Choose a reason for hiding this comment

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

critical

The strcmp call can cause a segmentation fault if module_name_in is NULL. The module_name_in parameter can be NULL if it's not provided on the command line when invoking p11_child. You should add a NULL check for module_name_in before calling strcmp.

            if (mode == OP_AUTH && module_name_in != NULL && strcmp(mod_file_name, module_name_in) != 0) {

claude and others added 3 commits February 19, 2026 07:49
Use a separate `const char *dot` variable for the strchr() result
on the const input string, keeping the mutable `char *p` for the
later iteration over the output buffer.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Make rid1 and rid2 `const char *` since they only hold strrchr()
results from const input strings and are used for pointer arithmetic.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Make endptr and end_range `const char *` since they only hold
strchr()/strrchr() results from const input strings. Introduce a
separate `numendptr` variable for the strtouint32() output parameter.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
claude and others added 5 commits February 19, 2026 08:48
Make sep `const char *` since it only holds a strchr() result
from a const input string and is used for pointer arithmetic.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Make specdelim and kwdelim `const char *` in parse_sub_filter() and
parse_filter() since they only hold strchr() results from const
input strings and are used for pointer arithmetic.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Make delim in get_type_prefix() and sep in expand_sid() `const char *`
since they only hold strchr()/strrchr() results from const input
strings and are used for pointer arithmetic and reading.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace will_return_always with will_return_uint_always,
will_return_count with will_return_uint_count, and
assert_in_range with assert_uint_in_range.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Use will_return_ptr_always instead of will_return_always in the
will_return_nl_cache_foreach_always wrapper macro since the value
passed is a pointer, not an integer.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
claude and others added 5 commits February 19, 2026 10:44
Use will_return_uint_count instead of will_return_count in the
sss_will_return_always wrapper macro in common_mock.h.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Use will_return_ptr_always instead of will_return_always in
set_entry_parse() since the value passed is a pointer.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace will_return_always with will_return_ptr_always for pointer
arguments and will_return_uint_always for integer arguments.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Make at_sign `const char *` since it only holds a strchr() result
from a const input string and is used for reading.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add explicit dependency so that install-sssdlibLTLIBRARIES waits for
install-pkglibLTLIBRARIES to complete. Without this, make -jN install
can fail because libtool tries to relink sssdlib plugins (e.g.
libsss_simple.la) before their pkglib dependencies (e.g.
libsss_util.la) are installed, causing "cannot find -lsss_util".

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants