diff options
author | Lukas Slebodnik <lslebodn@redhat.com> | 2014-08-26 11:35:23 +0200 |
---|---|---|
committer | Jakub Hrozek <jhrozek@redhat.com> | 2014-08-26 19:12:49 +0200 |
commit | 72db1f3ce67b0634f2843088f1198b3b350b72ab (patch) | |
tree | 15fb20e1981f25cd567da088539fe2c8f46525e5 /src | |
parent | 99f53d551a1db5d8023b4271eb691d554257624c (diff) | |
download | sssd-72db1f3ce67b0634f2843088f1198b3b350b72ab.tar.gz sssd-72db1f3ce67b0634f2843088f1198b3b350b72ab.tar.xz sssd-72db1f3ce67b0634f2843088f1198b3b350b72ab.zip |
SDAP: Fix using of uninitialized variable
When group was posix and id mapping was enabled then variable gid was
used uninitialized.
Valgrind error:
Conditional jump or move depends on uninitialised value(s)
at 0x13F1A1D7: sdap_nested_group_hash_group (sdap_async_nested_groups.c:279)
by 0x13F1DAA1: sdap_nested_group_send (sdap_async_nested_groups.c:718)
by 0x13F1998D: sdap_get_groups_process (sdap_async_groups.c:1847)
by 0x13F0F9CE: sdap_get_generic_ext_done (sdap_async.c:1467)
by 0x13F0EE9F: sdap_process_result (sdap_async.c:357)
by 0x54ABFBE: tevent_common_loop_timer_delay (in /usr/lib64/libtevent.so.0.9.20)
by 0x54ACFC9: ??? (in /usr/lib64/libtevent.so.0.9.20)
by 0x54AB6B6: ??? (in /usr/lib64/libtevent.so.0.9.20)
by 0x54A7F2C: _tevent_loop_once (in /usr/lib64/libtevent.so.0.9.20)
by 0x54A80CA: tevent_common_loop_wait (in /usr/lib64/libtevent.so.0.9.20)
by 0x54AB656: ??? (in /usr/lib64/libtevent.so.0.9.20)
by 0x5283872: server_loop (server.c:587)
Reviewed-by: Pavel Reichl <preichl@redhat.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/providers/ldap/sdap_async_nested_groups.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/providers/ldap/sdap_async_nested_groups.c b/src/providers/ldap/sdap_async_nested_groups.c index 18a811c77..b07616a93 100644 --- a/src/providers/ldap/sdap_async_nested_groups.c +++ b/src/providers/ldap/sdap_async_nested_groups.c @@ -244,6 +244,7 @@ sdap_nested_group_hash_group(struct sdap_nested_group_ctx *group_ctx, int32_t ad_group_type; bool posix_group = true; bool use_id_mapping; + bool can_find_gid; if (group_ctx->opts->schema_type == SDAP_SCHEMA_AD) { ret = sysdb_attrs_get_int32_t(group, SYSDB_GROUP_TYPE, &ad_group_type); @@ -272,15 +273,17 @@ sdap_nested_group_hash_group(struct sdap_nested_group_ctx *group_ctx, group_ctx->domain->name, group_ctx->domain->domain_id); - if (posix_group && !use_id_mapping) { + can_find_gid = posix_group && !use_id_mapping; + if (can_find_gid) { ret = sysdb_attrs_get_uint32_t(group, map[SDAP_AT_GROUP_GID].sys_name, &gid); } - if (!posix_group || ret == ENOENT || (ret == EOK && gid == 0)) { + if (!can_find_gid || ret == ENOENT || (ret == EOK && gid == 0)) { DEBUG(SSSDBG_TRACE_ALL, "The group's gid was %s\n", ret == ENOENT ? "missing" : "zero"); DEBUG(SSSDBG_TRACE_INTERNAL, "Marking group as non-posix and setting GID=0!\n"); + if (ret == ENOENT || !posix_group) { ret = sysdb_attrs_add_uint32(group, map[SDAP_AT_GROUP_GID].sys_name, 0); |