mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Fix various issues found by Coverity
This commit is contained in:
parent
2d42737d01
commit
c1b922352f
@ -1525,7 +1525,7 @@ static int set_cross_realm_pw(struct ldapsam_privates *ldap_state,
|
|||||||
krb5_error_code krberr;
|
krb5_error_code krberr;
|
||||||
krb5_context krbctx;
|
krb5_context krbctx;
|
||||||
krb5_principal service_princ;
|
krb5_principal service_princ;
|
||||||
struct keys_container keys;
|
struct keys_container keys = {0, NULL};
|
||||||
char *err_msg;
|
char *err_msg;
|
||||||
struct berval *reqdata = NULL;
|
struct berval *reqdata = NULL;
|
||||||
struct berval *retdata = NULL;
|
struct berval *retdata = NULL;
|
||||||
|
@ -124,13 +124,15 @@ static int ipa_cldap_init_service(Slapi_PBlock *pb,
|
|||||||
slapi_pblock_get(pb, SLAPI_PLUGIN_CONFIG_ENTRY, &e);
|
slapi_pblock_get(pb, SLAPI_PLUGIN_CONFIG_ENTRY, &e);
|
||||||
if (!e) {
|
if (!e) {
|
||||||
LOG_FATAL("Plugin configuration not found!\n");
|
LOG_FATAL("Plugin configuration not found!\n");
|
||||||
return -1;
|
ret = -1;
|
||||||
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx->base_dn = slapi_entry_attr_get_charptr(e, "nsslapd-basedn");
|
ctx->base_dn = slapi_entry_attr_get_charptr(e, "nsslapd-basedn");
|
||||||
if (!ctx->base_dn) {
|
if (!ctx->base_dn) {
|
||||||
LOG_FATAL("Plugin configuration not found!\n");
|
LOG_FATAL("Plugin configuration not found!\n");
|
||||||
return -1;
|
ret = -1;
|
||||||
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* create a stop pipe so the main DS thread can interrupt the poll()
|
/* create a stop pipe so the main DS thread can interrupt the poll()
|
||||||
|
@ -137,10 +137,12 @@ int parse_request_data(struct berval *req_val, struct extdom_req **_req)
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ber_free(ber, 1);
|
ber_free(ber, 1);
|
||||||
|
free(req);
|
||||||
return LDAP_PROTOCOL_ERROR;
|
return LDAP_PROTOCOL_ERROR;
|
||||||
}
|
}
|
||||||
ber_free(ber, 1);
|
ber_free(ber, 1);
|
||||||
if (tag == LBER_ERROR) {
|
if (tag == LBER_ERROR) {
|
||||||
|
free(req);
|
||||||
return LDAP_PROTOCOL_ERROR;
|
return LDAP_PROTOCOL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -284,11 +286,6 @@ static int get_domain_info(struct ipa_extdom_ctx *ctx, const char *domain_name,
|
|||||||
domain_info->flat_name = slapi_entry_attr_get_charptr(e[0],
|
domain_info->flat_name = slapi_entry_attr_get_charptr(e[0],
|
||||||
"ipaNTFlatName");
|
"ipaNTFlatName");
|
||||||
|
|
||||||
/* TODO: read range from LDAP server */
|
|
||||||
/*
|
|
||||||
range.min = 200000;
|
|
||||||
range.max = 400000;
|
|
||||||
*/
|
|
||||||
ret = set_domain_range(ctx, domain_info->sid, &range);
|
ret = set_domain_range(ctx, domain_info->sid, &range);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
goto done;
|
goto done;
|
||||||
@ -313,6 +310,11 @@ done:
|
|||||||
slapi_free_search_results_internal(pb);
|
slapi_free_search_results_internal(pb);
|
||||||
slapi_pblock_destroy(pb);
|
slapi_pblock_destroy(pb);
|
||||||
free(filter);
|
free(filter);
|
||||||
|
|
||||||
|
if (ret != 0) {
|
||||||
|
free_domain_info(domain_info);
|
||||||
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -170,13 +170,15 @@ static int ipa_extdom_init_ctx(Slapi_PBlock *pb, struct ipa_extdom_ctx **_ctx)
|
|||||||
slapi_pblock_get(pb, SLAPI_PLUGIN_CONFIG_ENTRY, &e);
|
slapi_pblock_get(pb, SLAPI_PLUGIN_CONFIG_ENTRY, &e);
|
||||||
if (!e) {
|
if (!e) {
|
||||||
LOG_FATAL("Plugin configuration not found!\n");
|
LOG_FATAL("Plugin configuration not found!\n");
|
||||||
return -1;
|
ret = -1;
|
||||||
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx->base_dn = slapi_entry_attr_get_charptr(e, "nsslapd-basedn");
|
ctx->base_dn = slapi_entry_attr_get_charptr(e, "nsslapd-basedn");
|
||||||
if (!ctx->base_dn) {
|
if (!ctx->base_dn) {
|
||||||
LOG_FATAL("Base DN not found in plugin configuration not found!\n");
|
LOG_FATAL("Base DN not found in plugin configuration not found!\n");
|
||||||
return -1;
|
ret = -1;
|
||||||
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -90,7 +90,8 @@ static int slapi_entry_to_range_info(struct slapi_entry *entry,
|
|||||||
|
|
||||||
range->name = slapi_entry_attr_get_charptr(entry, IPA_CN);
|
range->name = slapi_entry_attr_get_charptr(entry, IPA_CN);
|
||||||
if (range->name == NULL) {
|
if (range->name == NULL) {
|
||||||
return EINVAL;
|
ret = EINVAL;
|
||||||
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
ul_val = slapi_entry_attr_get_ulong(entry, IPA_BASE_ID);
|
ul_val = slapi_entry_attr_get_ulong(entry, IPA_BASE_ID);
|
||||||
|
@ -71,7 +71,10 @@ static const char *fetch_attr(Slapi_Entry *e, const char *attrname,
|
|||||||
|
|
||||||
if (slapi_entry_attr_find(e, attrname, &attr) != 0)
|
if (slapi_entry_attr_find(e, attrname, &attr) != 0)
|
||||||
return default_val;
|
return default_val;
|
||||||
slapi_attr_first_value(attr, &val);
|
|
||||||
|
if (slapi_attr_first_value(attr, &val) == -1)
|
||||||
|
return default_val;
|
||||||
|
|
||||||
return slapi_value_get_string(val);
|
return slapi_value_get_string(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user