Fix various issues found by Coverity

This commit is contained in:
Sumit Bose 2012-10-02 11:25:04 +02:00 committed by Martin Kosek
parent 2d42737d01
commit c1b922352f
6 changed files with 22 additions and 12 deletions

View File

@ -1525,7 +1525,7 @@ static int set_cross_realm_pw(struct ldapsam_privates *ldap_state,
krb5_error_code krberr;
krb5_context krbctx;
krb5_principal service_princ;
struct keys_container keys;
struct keys_container keys = {0, NULL};
char *err_msg;
struct berval *reqdata = NULL;
struct berval *retdata = NULL;

View File

@ -124,13 +124,15 @@ static int ipa_cldap_init_service(Slapi_PBlock *pb,
slapi_pblock_get(pb, SLAPI_PLUGIN_CONFIG_ENTRY, &e);
if (!e) {
LOG_FATAL("Plugin configuration not found!\n");
return -1;
ret = -1;
goto done;
}
ctx->base_dn = slapi_entry_attr_get_charptr(e, "nsslapd-basedn");
if (!ctx->base_dn) {
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()

View File

@ -137,10 +137,12 @@ int parse_request_data(struct berval *req_val, struct extdom_req **_req)
break;
default:
ber_free(ber, 1);
free(req);
return LDAP_PROTOCOL_ERROR;
}
ber_free(ber, 1);
if (tag == LBER_ERROR) {
free(req);
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],
"ipaNTFlatName");
/* TODO: read range from LDAP server */
/*
range.min = 200000;
range.max = 400000;
*/
ret = set_domain_range(ctx, domain_info->sid, &range);
if (ret != 0) {
goto done;
@ -313,6 +310,11 @@ done:
slapi_free_search_results_internal(pb);
slapi_pblock_destroy(pb);
free(filter);
if (ret != 0) {
free_domain_info(domain_info);
}
return ret;
}

View File

@ -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);
if (!e) {
LOG_FATAL("Plugin configuration not found!\n");
return -1;
ret = -1;
goto done;
}
ctx->base_dn = slapi_entry_attr_get_charptr(e, "nsslapd-basedn");
if (!ctx->base_dn) {
LOG_FATAL("Base DN not found in plugin configuration not found!\n");
return -1;
ret = -1;
goto done;
}

View File

@ -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);
if (range->name == NULL) {
return EINVAL;
ret = EINVAL;
goto done;
}
ul_val = slapi_entry_attr_get_ulong(entry, IPA_BASE_ID);

View File

@ -71,7 +71,10 @@ static const char *fetch_attr(Slapi_Entry *e, const char *attrname,
if (slapi_entry_attr_find(e, attrname, &attr) != 0)
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);
}