mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Unchecked return values in SLAPI plugins
Return values weren't checked in several cases which could have lead to unhandled errors. https://fedorahosted.org/freeipa/ticket/722
This commit is contained in:
@@ -491,9 +491,13 @@ int ldap_pwd_change(char *client_name, char *realm_name, krb5_data pwd, char **e
|
||||
goto done;
|
||||
}
|
||||
|
||||
ber_printf(ctrl, "{tstO}",
|
||||
ret = ber_printf(ctrl, "{tstO}",
|
||||
LDAP_TAG_EXOP_MODIFY_PASSWD_ID, userdn,
|
||||
LDAP_TAG_EXOP_MODIFY_PASSWD_NEW, &newpw);
|
||||
if (ret < 0) {
|
||||
syslog(LOG_ERR, "ber printf failed!");
|
||||
goto done;
|
||||
}
|
||||
|
||||
ret = ber_flatten(ctrl, &control);
|
||||
if (ret < 0) {
|
||||
|
||||
@@ -748,8 +748,8 @@ static int ipamodrdn_post_op(Slapi_PBlock *pb)
|
||||
Slapi_Value *val;
|
||||
const char *strval;
|
||||
|
||||
slapi_attr_first_value(sattr, &val);
|
||||
if (!val) {
|
||||
ret = slapi_attr_first_value(sattr, &val);
|
||||
if (ret == -1 || !val) {
|
||||
LOG_FATAL("Source attr %s is empty\n", cfgentry->sattr);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -815,8 +815,16 @@ static int ipauuid_pre_op(Slapi_PBlock *pb, int modtype)
|
||||
*/
|
||||
Slapi_DN *tmp_dn = slapi_sdn_new_dn_byref(dn);
|
||||
if (tmp_dn) {
|
||||
slapi_search_internal_get_entry(tmp_dn, NULL, &e, getPluginID());
|
||||
ret = slapi_search_internal_get_entry(tmp_dn, NULL, &e, getPluginID());
|
||||
slapi_sdn_free(&tmp_dn);
|
||||
|
||||
if (ret) {
|
||||
LOG_FATAL("slapi_search_internal_get_entry failed!? Err %d\n",
|
||||
ret);
|
||||
ret = LDAP_OPERATIONS_ERROR;
|
||||
goto done;
|
||||
}
|
||||
|
||||
free_entry = true;
|
||||
}
|
||||
|
||||
@@ -967,8 +975,8 @@ static int ipauuid_pre_op(Slapi_PBlock *pb, int modtype)
|
||||
Slapi_Attr *sattr = NULL;
|
||||
int e_numvals = 0;
|
||||
|
||||
slapi_entry_attr_find(e, attr, &sattr);
|
||||
if (sattr) {
|
||||
if ((!slapi_entry_attr_find(e, attr, &sattr)) &&
|
||||
(NULL != sattr)) {
|
||||
slapi_attr_get_numvalues(sattr, &e_numvals);
|
||||
if (numvals >= e_numvals) {
|
||||
generate = true;
|
||||
|
||||
@@ -702,8 +702,8 @@ internal_find_entry_get_attr_val(const Slapi_DN *basedn, int scope,
|
||||
if (entries && entries[0]) { /* found one */
|
||||
if (svs) {
|
||||
Slapi_Attr *attr = NULL;
|
||||
slapi_entry_attr_find(entries[0], attrname, &attr);
|
||||
if (attr) {
|
||||
if (!slapi_entry_attr_find(entries[0], attrname, &attr) &&
|
||||
(NULL != attr)) {
|
||||
/* slapi_attr_get_valueset allocates svs - must be freed later */
|
||||
slapi_attr_get_valueset(attr, svs);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user