#2953 ipa winsync ipa_winsync_pre_ad_mod_user_mods_cb should use slapi_mods_init_passin
Closed: Fixed None Opened 11 years ago by rmeggins.

This code in ipa_winsync_pre_ad_mod_user_mods_cb:

    slapi_mods_init_byref(smods, *modstosend);

slapi_mods_init_byref is intended for use when the LDAPMod** list is read-only i.e. to iterate over the set of mods. If the smods will be modified, then slapi_mods_init_byval should be used instead, to make a copy of the passed in list.


sorry, there is no slapi_mods_init_byval - should use slapi_mods_init_passin instead

When you use slapi_mods_init_byref(), you are passing in the LDAPMod{{{}}} by reference, which means the Slapi_Mods does not copy what was passed in, it just holds a pointer to it. If you then call a function that modifies the Slapi_Mods, the code notices that the LDAPMod{{{}}} is a reference, and throws an assertion in debug mode. The modify is handled correctly, so there should not be any danger in this case of overwriting memory or freeing static memory or anything like that. But to be semantically correct, and protect against any future problems, the code should use slapi_mods_init_passin, to tell Slapi_Mods that it now owns the mods, until the passout function is called.

Moving closed RC1 tickets to Beta 3.

Metadata Update from @rmeggins:
- Issue assigned to tbabej
- Issue set to the milestone: FreeIPA 3.0 Beta 3

7 years ago

Login to comment on this ticket.

Metadata