URL:
https://github.com/SSSD/sssd/pull/601
Title: #601: sbus: integrate sssd with sbus2
jhrozek commented:
"""
There is a large number of Coverity warnings that need to be fixed:
```
Error: CLANG_WARNING:
sssd-1.16.3/src/providers/data_provider/dp_iface_backend.c:40:9: warning: Value stored to
'domain' is never read
# domain = be_ctx->domain;
# ^ ~~~~~~~~~~~~~~
sssd-1.16.3/src/providers/data_provider/dp_iface_backend.c:40:9: note: Value stored to
'domain' is never read
# domain = be_ctx->domain;
# ^ ~~~~~~~~~~~~~~
# 38|
# 39| if (SBUS_REQ_STRING_IS_EMPTY(domname)) {
# 40|-> domain = be_ctx->domain;
# 41| *_is_online = be_is_offline(be_ctx);
# 42| return EOK;
Error: UNINIT (CWE-457):
sssd-1.16.3/src/providers/data_provider/dp_target_sudo.c:40: var_decl: Declaring variable
"rules" without initializer.
sssd-1.16.3/src/providers/data_provider/dp_target_sudo.c:85: uninit_use: Using
uninitialized value "rules".
# 83| *_dp_flags = dp_flags;
# 84| *_sudo_type = sudo_type;
# 85|-> *_rules = rules;
# 86|
# 87| return EOK;
Error: CLANG_WARNING:
sssd-1.16.3/src/providers/data_provider/dp_target_sudo.c:85:13: warning: Assigned value is
garbage or undefined
# *_rules = rules;
# ^
sssd-1.16.3/src/providers/data_provider/dp_target_sudo.c:125:9: note: Assuming
'req' is not equal to NULL
# if (req == NULL) {
# ^~~~~~~~~~~
sssd-1.16.3/src/providers/data_provider/dp_target_sudo.c:125:5: note: Taking false
branch
# if (req == NULL) {
# ^
sssd-1.16.3/src/providers/data_provider/dp_target_sudo.c:131:9: note: Assuming the
condition is false
# if (state->data == NULL) {
# ^~~~~~~~~~~~~~~~~~~
sssd-1.16.3/src/providers/data_provider/dp_target_sudo.c:131:5: note: Taking false
branch
# if (state->data == NULL) {
# ^
sssd-1.16.3/src/providers/data_provider/dp_target_sudo.c:136:11: note: Calling
'dp_sudo_parse_message'
# ret = dp_sudo_parse_message(state, read_iter, &dp_flags,
# ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sssd-1.16.3/src/providers/data_provider/dp_target_sudo.c:40:5: note: 'rules'
declared without an initial value
# const char **rules;
# ^~~~~~~~~~~~~~~~~~
sssd-1.16.3/src/providers/data_provider/dp_target_sudo.c:44:9: note: Assuming
'ret' is equal to EOK
# if (ret != EOK) {
# ^~~~~~~~~~
sssd-1.16.3/src/providers/data_provider/dp_target_sudo.c:44:5: note: Taking false branch
# if (ret != EOK) {
# ^
sssd-1.16.3/src/providers/data_provider/dp_target_sudo.c:50:9: note: Assuming
'ret' is equal to EOK
# if (ret != EOK) {
# ^~~~~~~~~~
sssd-1.16.3/src/providers/data_provider/dp_target_sudo.c:50:5: note: Taking false branch
# if (ret != EOK) {
# ^
sssd-1.16.3/src/providers/data_provider/dp_target_sudo.c:56:5: note: Control jumps to
'case 6:' at line 57
# switch (sudo_type) {
# ^
sssd-1.16.3/src/providers/data_provider/dp_target_sudo.c:59:9: note: Execution continues
on line 83
# break;
# ^
sssd-1.16.3/src/providers/data_provider/dp_target_sudo.c:85:13: note: Assigned value is
garbage or undefined
# *_rules = rules;
# ^ ~~~~~
# 83| *_dp_flags = dp_flags;
# 84| *_sudo_type = sudo_type;
# 85|-> *_rules = rules;
# 86|
# 87| return EOK;
Error: CLANG_WARNING:
sssd-1.16.3/src/responder/ifp/ifp_groups.c:997:9: warning: Value stored to
'num_users' is never read
# num_users = 0;
# ^ ~
sssd-1.16.3/src/responder/ifp/ifp_groups.c:997:9: note: Value stored to
'num_users' is never read
# num_users = 0;
# ^ ~
# 995| users = NULL;
# 996| groups = NULL;
# 997|-> num_users = 0;
# 998| num_groups = 0;
# 999| ret = EOK;
Error: CLANG_WARNING:
sssd-1.16.3/src/responder/ifp/ifp_groups.c:998:9: warning: Value stored to
'num_groups' is never read
# num_groups = 0;
# ^ ~
sssd-1.16.3/src/responder/ifp/ifp_groups.c:998:9: note: Value stored to
'num_groups' is never read
# num_groups = 0;
# ^ ~
# 996| groups = NULL;
# 997| num_users = 0;
# 998|-> num_groups = 0;
# 999| ret = EOK;
# 1000| goto done;
Error: FORWARD_NULL (CWE-476):
sssd-1.16.3/src/sbus/codegen/sbus_Generator.py:762: assign_null: Assigning:
"type" = "None".
sssd-1.16.3/src/sbus/codegen/sbus_Generator.py:772: property_access: Accessing a property
of null-like value "type".
# 770| )
# 771|
# 772|-> tpl.show("if-use-talloc", type.RequireTalloc)
# 773|
# 774| keys = {"input-signature":
invoker.input.invokerSignature,
Error: UNREACHABLE (CWE-561):
sssd-1.16.3/src/sbus/interface/sbus_introspection.c:252: unreachable: This code cannot be
reached: "return "invalid";".
# 250| }
# 251|
# 252|-> return "invalid";
# 253| }
# 254|
Error: FORWARD_NULL (CWE-476):
sssd-1.16.3/src/sbus/request/sbus_request.c:232: assign_zero: Assigning:
"mainreq" = "NULL".
sssd-1.16.3/src/sbus/request/sbus_request.c:260: var_deref_model: Passing null pointer
"mainreq" to "sbus_requests_finish", which dereferences it.
sssd-1.16.3/src/sbus/request/sbus_request_hash.c:268:5: deref_parm: Directly dereferencing
parameter "item".
# 266| errno_t error)
# 267| {
# 268|-> if (item->is_invalid) {
# 269| return;
# 270| }
Error: FORWARD_NULL (CWE-476):
sssd-1.16.3/src/sbus/router/sbus_router_hash.c:352: var_compare_op: Comparing
"a->object_path" to null implies that "a->object_path" might be
null.
sssd-1.16.3/src/sbus/router/sbus_router_hash.c:356: var_deref_model: Passing null pointer
"a->object_path" to "strcmp", which dereferences it.
# 354| }
# 355|
# 356|-> if (strcmp(a->object_path, b->object_path) != 0) {
# 357| continue;
# 358| }
Error: FORWARD_NULL (CWE-476):
sssd-1.16.3/src/sbus/router/sbus_router_hash.c:348: var_compare_op: Comparing
"b->object_path" to null implies that "b->object_path" might be
null.
sssd-1.16.3/src/sbus/router/sbus_router_hash.c:356: var_deref_model: Passing null pointer
"b->object_path" to "strcmp", which dereferences it.
# 354| }
# 355|
# 356|-> if (strcmp(a->object_path, b->object_path) != 0) {
# 357| continue;
# 358| }
Error: CLANG_WARNING:
sssd-1.16.3/src/sbus/router/sbus_router_hash.c:356:13: warning: Null pointer passed as an
argument to a 'nonnull' parameter
# if (strcmp(a->object_path, b->object_path) != 0) {
# ^
sssd-1.16.3/src/sbus/router/sbus_router_hash.c:427:9: note: Assuming 'tmp_ctx' is
not equal to NULL
# if (tmp_ctx == NULL) {
# ^~~~~~~~~~~~~~~
sssd-1.16.3/src/sbus/router/sbus_router_hash.c:427:5: note: Taking false branch
# if (tmp_ctx == NULL) {
# ^
sssd-1.16.3/src/sbus/router/sbus_router_hash.c:433:9: note: Assuming 'key' is not
equal to NULL
# if (key == NULL) {
# ^~~~~~~~~~~
sssd-1.16.3/src/sbus/router/sbus_router_hash.c:433:5: note: Taking false branch
# if (key == NULL) {
# ^
sssd-1.16.3/src/sbus/router/sbus_router_hash.c:439:9: note: Assuming 'item' is not
equal to NULL
# if (item == NULL) {
# ^~~~~~~~~~~~
sssd-1.16.3/src/sbus/router/sbus_router_hash.c:439:5: note: Taking false branch
# if (item == NULL) {
# ^
sssd-1.16.3/src/sbus/router/sbus_router_hash.c:444:22: note: Value assigned to field
'object_path'
# item->listener = sbus_listener_copy(item, listener);
# ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sssd-1.16.3/src/sbus/router/sbus_router_hash.c:445:9: note: Assuming the condition is
false
# if (item->listener == NULL) {
# ^~~~~~~~~~~~~~~~~~~~~~
sssd-1.16.3/src/sbus/router/sbus_router_hash.c:445:5: note: Taking false branch
# if (item->listener == NULL) {
# ^
sssd-1.16.3/src/sbus/router/sbus_router_hash.c:453:9: note: Assuming 'list' is not
equal to NULL
# if (list != NULL) {
# ^~~~~~~~~~~~
sssd-1.16.3/src/sbus/router/sbus_router_hash.c:453:5: note: Taking true branch
# if (list != NULL) {
# ^
sssd-1.16.3/src/sbus/router/sbus_router_hash.c:456:13: note: Calling
'sbus_listener_list_lookup'
# if (sbus_listener_list_lookup(list, listener) != NULL) {
# ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sssd-1.16.3/src/sbus/router/sbus_router_hash.c:344:13: note: Assuming the condition is
false
# if (memcmp(&a->handler, &b->handler, sizeof(struct sbus_handler))
!= 0) {
# ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sssd-1.16.3/src/sbus/router/sbus_router_hash.c:344:9: note: Taking false branch
# if (memcmp(&a->handler, &b->handler, sizeof(struct sbus_handler))
!= 0) {
# ^
sssd-1.16.3/src/sbus/router/sbus_router_hash.c:348:13: note: Assuming pointer value is
null
# if (a->object_path == NULL && b->object_path != NULL) {
# ^~~~~~~~~~~~~~~~~~~~~~
sssd-1.16.3/src/sbus/router/sbus_router_hash.c:348:13: note: Left side of
'&&' is true
sssd-1.16.3/src/sbus/router/sbus_router_hash.c:348:39: note: Assuming the condition is
false
# if (a->object_path == NULL && b->object_path != NULL) {
# ^~~~~~~~~~~~~~~~~~~~~~
sssd-1.16.3/src/sbus/router/sbus_router_hash.c:348:9: note: Taking false branch
# if (a->object_path == NULL && b->object_path != NULL) {
# ^
sssd-1.16.3/src/sbus/router/sbus_router_hash.c:352:36: note: Left side of
'&&' is false
# if (a->object_path != NULL && b->object_path == NULL) {
# ^
sssd-1.16.3/src/sbus/router/sbus_router_hash.c:356:13: note: Null pointer passed as an
argument to a 'nonnull' parameter
# if (strcmp(a->object_path, b->object_path) != 0) {
# ^ ~~~~~~~~~~~~~~
# 354| }
# 355|
# 356|-> if (strcmp(a->object_path, b->object_path) != 0) {
# 357| continue;
# 358| }
Error: CLANG_WARNING:
sssd-1.16.3/src/sbus/server/sbus_server_match.c:335:9: warning: 1st function call argument
is an uninitialized value
# talloc_free(sbus_rule);
# ^
/usr/include/talloc.h:228:26: note: expanded from macro 'talloc_free'
##define talloc_free(ctx) _talloc_free(ctx, __location__)
# ^
sssd-1.16.3/src/sbus/server/sbus_server_match.c:375:11: note: Calling
'sbus_match_rule_parse'
# ret = sbus_match_rule_parse(NULL, dbus_rule, &sbus_rule);
# ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sssd-1.16.3/src/sbus/server/sbus_server_match.c:308:5: note: 'sbus_rule' declared
without an initial value
# struct sbus_rule *sbus_rule;
# ^~~~~~~~~~~~~~~~~~~~~~~~~~~
sssd-1.16.3/src/sbus/server/sbus_server_match.c:314:9: note: Assuming 'ret' is
equal to EOK
# if (ret != EOK) {
# ^~~~~~~~~~
sssd-1.16.3/src/sbus/server/sbus_server_match.c:314:5: note: Taking false branch
# if (ret != EOK) {
# ^
sssd-1.16.3/src/sbus/server/sbus_server_match.c:318:11: note: Calling
'sbus_match_rule_parse_keys'
# ret = sbus_match_rule_parse_keys(mem_ctx, tokens, &sbus_rule);
# ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sssd-1.16.3/src/sbus/server/sbus_server_match.c:253:9: note: Assuming 'rule' is
equal to NULL
# if (rule == NULL) {
# ^~~~~~~~~~~~
sssd-1.16.3/src/sbus/server/sbus_server_match.c:253:5: note: Taking true branch
# if (rule == NULL) {
# ^
sssd-1.16.3/src/sbus/server/sbus_server_match.c:318:11: note: Returning from
'sbus_match_rule_parse_keys'
# ret = sbus_match_rule_parse_keys(mem_ctx, tokens, &sbus_rule);
# ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sssd-1.16.3/src/sbus/server/sbus_server_match.c:320:5: note: Taking true branch
# if (ret != EOK) {
# ^
sssd-1.16.3/src/sbus/server/sbus_server_match.c:321:9: note: Control jumps to line 334
# goto done;
# ^
sssd-1.16.3/src/sbus/server/sbus_server_match.c:334:5: note: Taking true branch
# if (ret != EOK) {
# ^
sssd-1.16.3/src/sbus/server/sbus_server_match.c:335:9: note: 1st function call argument is
an uninitialized value
# talloc_free(sbus_rule);
# ^ ~~~~~~~~~
/usr/include/talloc.h:228:26: note: expanded from macro 'talloc_free'
##define talloc_free(ctx) _talloc_free(ctx, __location__)
# ^ ~~~
# 333| done:
# 334| if (ret != EOK) {
# 335|-> talloc_free(sbus_rule);
# 336| DEBUG(SSSDBG_OP_FAILURE, "Unable to parse rule [%s] [%d]:
%s\n",
# 337| dbus_rule, ret, sss_strerror(ret));
Error: CLANG_WARNING:
sssd-1.16.3/src/sss_iface/sss_iface_types.c:378:5: warning: Value stored to 'resp'
is never read
# resp = pd->resp_list;
# ^ ~~~~~~~~~~~~~
sssd-1.16.3/src/sss_iface/sss_iface_types.c:378:5: note: Value stored to 'resp' is
never read
# resp = pd->resp_list;
# ^ ~~~~~~~~~~~~~
# 376| }
# 377|
# 378|-> resp = pd->resp_list;
# 379| for (resp = pd->resp_list; resp != NULL; resp = resp->next) {
# 380| dbret = dbus_message_iter_open_container(&array_iter,
DBUS_TYPE_STRUCT,
```
"""
See the full comment at
https://github.com/SSSD/sssd/pull/601#issuecomment-409166916