The function remove_duplicate_group_members might return EOK also in the middle
of function but return parameter was not set with right data.
Processing continued in the function save_group but there was a
dereference of NULL pointer.
(gdb)bt#00x00007fb4ce4a9ac5insave_group(sysdb=sysdb@entry=0x55c9a0efb230,dom=dom@entry=0x55c9a0efb420,grp=grp@entry=0x55c9a0f370f0,real_name=0x55c9a0f47340"nobody@ldap",alias=alias@entry=0x0)atsrc/providers/proxy/proxy_id.c:748#10x00007fb4ce4aa600inget_gr_gid(mem_ctx=mem_ctx@entry=0x55c9a0f38be0,sysdb=sysdb@entry=0x55c9a0efb230,dom=dom@entry=0x55c9a0efb420,gid=99,now=<optimizedout>,ctx=<optimizedout>)atsrc/providers/proxy/proxy_id.c:1160#20x00007fb4ce4ac9e5inget_initgr_groups_process(pwd=0x55c9a0f384a0,pwd=0x55c9a0f384a0,dom=0x55c9a0efb420,sysdb=0x55c9a0efb230,ctx=0x55c9a0f048e0,memctx=0x55c9a0f38be0)atsrc/providers/proxy/proxy_id.c:1553#3get_initgr(i_name=<optimizedout>,dom=0x55c9a0efb420,sysdb=<optimizedout>,ctx=0x55c9a0f048e0,mem_ctx=0x55c9a0f38b70)atsrc/providers/proxy/proxy_id.c:1461#4proxy_account_info(domain=0x55c9a0efb420,be_ctx=<optimizedout>,data=<optimizedout>,ctx=0x55c9a0f048e0,mem_ctx=0x55c9a0f38b70)atsrc/providers/proxy/proxy_id.c:1659#5proxy_account_info_handler_send(mem_ctx=<optimizedout>,id_ctx=0x55c9a0f048e0,data=<optimizedout>,params=0x55c9a0f39790)atsrc/providers/proxy/proxy_id.c:1758#60x000055c99fc67677infile_dp_request(_dp_req=<syntheticpointer>,req=0x55c9a0f39470,request_data=<optimizedout>,dp_flags=1,method=DPM_ACCOUNT_HANDLER,target=DPT_ID,name=<optimizedout>,domainname=0x55c9a0f39190"LDAP",provider=0x55c9a0efe0e0,mem_ctx=<optimizedout>)atsrc/providers/data_provider/dp_request.c:250#7dp_req_send(mem_ctx=0x55c9a0f37b60,provider=provider@entry=0x55c9a0efe0e0,domain=domain@entry=0x55c9a0f39190"LDAP",name=<optimizedout>,target=target@entry=DPT_ID,method=method@entry=DPM_ACCOUNT_HANDLER,dp_flags=dp_flags@entry=1,request_data=0x55c9a0f37c00,_request_name=0x55c9a0f37b60)atsrc/providers/data_provider/dp_request.c:295#80x000055c99fc6a132indp_get_account_info_send(mem_ctx=<optimizedout>,ev=0x55c9a0eddbc0,sbus_req=<optimizedout>,provider=0x55c9a0efe0e0,dp_flags=1,entry_type=<optimizedout>,filter=0x55c9a0f358d0"name=nobody@ldap",domain=0x55c9a0f39190"LDAP",extra=0x55c9a0f354a0"")atsrc/providers/data_provider/dp_target_id.c:528#90x00007fb4da35265bin_sbus_sss_invoke_in_uusss_out_qus_step(ev=0x55c9a0eddbc0,te=<optimizedout>,tv=...,private_data=<optimizedout>)atsrc/sss_iface/sbus_sss_invokers.c:2847#100x00007fb4d9cfb1cfintevent_common_invoke_timer_handler()from/lib64/libtevent.so.0#110x00007fb4d9cfb339intevent_common_loop_timer_delay()from/lib64/libtevent.so.0#120x00007fb4d9cfc2f9inepoll_event_loop_once()from/lib64/libtevent.so.0#130x00007fb4d9cfa7b7instd_event_loop_once()from/lib64/libtevent.so.0#140x00007fb4d9cf5b5din_tevent_loop_once()from/lib64/libtevent.so.0#150x00007fb4d9cf5d8bintevent_common_loop_wait()from/lib64/libtevent.so.0#160x00007fb4d9cfa757instd_event_loop_wait()from/lib64/libtevent.so.0#170x00007fb4dd955ac3inserver_loop(main_ctx=0x55c9a0edf090)atsrc/util/server.c:724#180x000055c99fc59760inmain(argc=8,argv=<optimizedout>)atsrc/providers/data_provider_be.c:747(gdb)l(gdb)bt#00x00007fb4ce4a9ac5insave_group(sysdb=sysdb@entry=0x55c9a0efb230,dom=dom@entry=0x55c9a0efb420,grp=grp@entry=0x55c9a0f370f0,real_name=0x55c9a0f47340"nobody@ldap",alias=alias@entry=0x0)atsrc/providers/proxy/proxy_id.c:748#10x00007fb4ce4aa600inget_gr_gid(mem_ctx=mem_ctx@entry=0x55c9a0f38be0,sysdb=sysdb@entry=0x55c9a0efb230,dom=dom@entry=0x55c9a0efb420,gid=99,now=<optimizedout>,ctx=<optimizedout>)atsrc/providers/proxy/proxy_id.c:1160#20x00007fb4ce4ac9e5inget_initgr_groups_process(pwd=0x55c9a0f384a0,pwd=0x55c9a0f384a0,dom=0x55c9a0efb420,sysdb=0x55c9a0efb230,ctx=0x55c9a0f048e0,memctx=0x55c9a0f38be0)atsrc/providers/proxy/proxy_id.c:1553#3get_initgr(i_name=<optimizedout>,dom=0x55c9a0efb420,sysdb=<optimizedout>,ctx=0x55c9a0f048e0,mem_ctx=0x55c9a0f38b70)atsrc/providers/proxy/proxy_id.c:1461#4proxy_account_info(domain=0x55c9a0efb420,be_ctx=<optimizedout>,data=<optimizedout>,ctx=0x55c9a0f048e0,mem_ctx=0x55c9a0f38b70)atsrc/providers/proxy/proxy_id.c:1659#5proxy_account_info_handler_send(mem_ctx=<optimizedout>,id_ctx=0x55c9a0f048e0,data=<optimizedout>,params=0x55c9a0f39790)atsrc/providers/proxy/proxy_id.c:1758#60x000055c99fc67677infile_dp_request(_dp_req=<syntheticpointer>,req=0x55c9a0f39470,request_data=<optimizedout>,dp_flags=1,method=DPM_ACCOUNT_HANDLER,target=DPT_ID,name=<optimizedout>,domainname=0x55c9a0f39190"LDAP",provider=0x55c9a0efe0e0,mem_ctx=<optimizedout>)atsrc/providers/data_provider/dp_request.c:250#7dp_req_send(mem_ctx=0x55c9a0f37b60,provider=provider@entry=0x55c9a0efe0e0,domain=domain@entry=0x55c9a0f39190"LDAP",name=<optimizedout>,target=target@entry=DPT_ID,method=method@entry=DPM_ACCOUNT_HANDLER,dp_flags=dp_flags@entry=1,request_data=0x55c9a0f37c00,_request_name=0x55c9a0f37b60)atsrc/providers/data_provider/dp_request.c:295#80x000055c99fc6a132indp_get_account_info_send(mem_ctx=<optimizedout>,ev=0x55c9a0eddbc0,sbus_req=<optimizedout>,provider=0x55c9a0efe0e0,dp_flags=1,entry_type=<optimizedout>,filter=0x55c9a0f358d0"name=nobody@ldap",domain=0x55c9a0f39190"LDAP",extra=0x55c9a0f354a0"")atsrc/providers/data_provider/dp_target_id.c:528#90x00007fb4da35265bin_sbus_sss_invoke_in_uusss_out_qus_step(ev=0x55c9a0eddbc0,te=<optimizedout>,tv=...,private_data=<optimizedout>)atsrc/sss_iface/sbus_sss_invokers.c:2847#100x00007fb4d9cfb1cfintevent_common_invoke_timer_handler()from/lib64/libtevent.so.0#110x00007fb4d9cfb339intevent_common_loop_timer_delay()from/lib64/libtevent.so.0#120x00007fb4d9cfc2f9inepoll_event_loop_once()from/lib64/libtevent.so.0#130x00007fb4d9cfa7b7instd_event_loop_once()from/lib64/libtevent.so.0#140x00007fb4d9cf5b5din_tevent_loop_once()from/lib64/libtevent.so.0#150x00007fb4d9cf5d8bintevent_common_loop_wait()from/lib64/libtevent.so.0#160x00007fb4d9cfa757instd_event_loop_wait()from/lib64/libtevent.so.0#170x00007fb4dd955ac3inserver_loop(main_ctx=0x55c9a0edf090)atsrc/util/server.c:724#180x000055c99fc59760inmain(argc=8,argv=<optimizedout>)atsrc/providers/data_provider_be.c:747(gdb)l733ret=remove_duplicate_group_members(tmp_ctx,grp,&ngroup);734if(ret!=EOK){735DEBUG(SSSDBG_CRIT_FAILURE,"Failed to remove duplicate group member s\n");736gotodone;737}738739DEBUG_GR_MEM(SSSDBG_TRACE_LIBS,ngroup);740741ret=sysdb_transaction_start(sysdb);742if(ret!=EOK){743DEBUG(SSSDBG_CRIT_FAILURE,"Failed to start transaction\n");744gotodone;745}746in_transaction=true;747748if(ngroup->gr_mem&&ngroup->gr_mem[0]){749attrs=sysdb_new_attrs(tmp_ctx);750if(!attrs){751DEBUG(SSSDBG_CRIT_FAILURE,"Allocation error?!\n");752ret=ENOMEM;(gdb)pngroup$1=(structgroup*)0x0743DEBUG(SSSDBG_CRIT_FAILURE,"Failed to start transaction\n");744gotodone;745}746in_transaction=true;747748if(ngroup->gr_mem&&ngroup->gr_mem[0]){749attrs=sysdb_new_attrs(tmp_ctx);750if(!attrs){751DEBUG(SSSDBG_CRIT_FAILURE,"Allocation error?!\n");752ret=ENOMEM;(gdb)pngroup$1=(structgroup*)0x0
The function remove_duplicate_group_members might return EOK also in the middle
of function but return parameter was not set with right data.
Processing continued in the function save_group but there was a
dereference of NULL pointer.
Introduced in: https://pagure.io/SSSD/sssd/issue/3931
Crash:
Resolves:
https://pagure.io/SSSD/sssd/issue/XXXX