mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-01-28 09:06:44 -06:00
Fix ipadb_multires resource handling
* ipadb_get_pwd_policy() initializes struct ipadb_multires *res to NULL. * ipadb_multires_free() supports NULL as no-op. * ipadb_multibase_search() consistently frees and NULLs struct ipadb_multires **res on error. See: https://pagure.io/freeipa/issue/7738 Signed-off-by: Christian Heimes <cheimes@redhat.com> Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
This commit is contained in:
parent
4600e62b6b
commit
836e29591c
@ -634,10 +634,12 @@ krb5_error_code ipadb_multires_init(LDAP *lcontext, struct ipadb_multires **r)
|
|||||||
|
|
||||||
void ipadb_multires_free(struct ipadb_multires *r)
|
void ipadb_multires_free(struct ipadb_multires *r)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < r->count; i++) {
|
if (r != NULL) {
|
||||||
ldap_msgfree(r->res[i]);
|
for (int i = 0; i < r->count; i++) {
|
||||||
|
ldap_msgfree(r->res[i]);
|
||||||
|
}
|
||||||
|
free(r);
|
||||||
}
|
}
|
||||||
free(r);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LDAPMessage *ipadb_multires_next_entry(struct ipadb_multires *r)
|
LDAPMessage *ipadb_multires_next_entry(struct ipadb_multires *r)
|
||||||
@ -670,8 +672,11 @@ krb5_error_code ipadb_multibase_search(struct ipadb_context *ipactx,
|
|||||||
if (ret != 0) return ret;
|
if (ret != 0) return ret;
|
||||||
|
|
||||||
ret = ipadb_check_connection(ipactx);
|
ret = ipadb_check_connection(ipactx);
|
||||||
if (ret != 0)
|
if (ret != 0) {
|
||||||
|
ipadb_multires_free(*res);
|
||||||
|
*res = NULL;
|
||||||
return ipadb_simple_ldap_to_kerr(ret);
|
return ipadb_simple_ldap_to_kerr(ret);
|
||||||
|
}
|
||||||
|
|
||||||
for (int b = 0; basedns[b]; b++) {
|
for (int b = 0; basedns[b]; b++) {
|
||||||
LDAPMessage *r;
|
LDAPMessage *r;
|
||||||
|
@ -141,7 +141,7 @@ krb5_error_code ipadb_get_pwd_policy(krb5_context kcontext, char *name,
|
|||||||
char *esc_name = NULL;
|
char *esc_name = NULL;
|
||||||
char *src_filter = NULL;
|
char *src_filter = NULL;
|
||||||
krb5_error_code kerr;
|
krb5_error_code kerr;
|
||||||
struct ipadb_multires *res;
|
struct ipadb_multires *res = NULL;
|
||||||
LDAPMessage *lentry;
|
LDAPMessage *lentry;
|
||||||
osa_policy_ent_t pentry = NULL;
|
osa_policy_ent_t pentry = NULL;
|
||||||
uint32_t result;
|
uint32_t result;
|
||||||
|
Loading…
Reference in New Issue
Block a user