Use krb5_enomem() more consistently in lib/krb5.
This commit is contained in:
@@ -281,6 +281,7 @@ librfc3961_la_SOURCES = \
|
|||||||
crypto-rand.c \
|
crypto-rand.c \
|
||||||
crypto-stubs.c \
|
crypto-stubs.c \
|
||||||
data.c \
|
data.c \
|
||||||
|
enomem.c \
|
||||||
error_string.c \
|
error_string.c \
|
||||||
keyblock.c \
|
keyblock.c \
|
||||||
n-fold.c \
|
n-fold.c \
|
||||||
|
@@ -303,8 +303,7 @@ make_cred_from_ccred(krb5_context context,
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
nomem:
|
nomem:
|
||||||
ret = ENOMEM;
|
ret = krb5_enomem(context);
|
||||||
krb5_set_error_message(context, ret, N_("malloc: out of memory", "malloc"));
|
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
krb5_free_cred_contents(context, cred);
|
krb5_free_cred_contents(context, cred);
|
||||||
@@ -905,10 +904,8 @@ acc_get_cache_first(krb5_context context, krb5_cc_cursor *cursor)
|
|||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
iter = calloc(1, sizeof(*iter));
|
iter = calloc(1, sizeof(*iter));
|
||||||
if (iter == NULL) {
|
if (iter == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM, "malloc: out of memory");
|
return krb5_enomem(context);
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
|
|
||||||
error = (*init_func)(&iter->context, ccapi_version_3, NULL, NULL);
|
error = (*init_func)(&iter->context, ccapi_version_3, NULL, NULL);
|
||||||
if (error) {
|
if (error) {
|
||||||
@@ -1036,10 +1033,8 @@ acc_get_default_name(krb5_context context, char **str)
|
|||||||
(*name->func->release)(name);
|
(*name->func->release)(name);
|
||||||
(*cc->func->release)(cc);
|
(*cc->func->release)(cc);
|
||||||
|
|
||||||
if (error < 0 || *str == NULL) {
|
if (error < 0 || *str == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
return krb5_enomem(context);
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -81,10 +81,8 @@ acl_parse_format(krb5_context context,
|
|||||||
for(p = format; *p != '\0'; p++) {
|
for(p = format; *p != '\0'; p++) {
|
||||||
tmp = malloc(sizeof(*tmp));
|
tmp = malloc(sizeof(*tmp));
|
||||||
if(tmp == NULL) {
|
if(tmp == NULL) {
|
||||||
krb5_set_error_message(context, ENOMEM,
|
|
||||||
N_("malloc: out of memory", ""));
|
|
||||||
acl_free_list(acl, 0);
|
acl_free_list(acl, 0);
|
||||||
return ENOMEM;
|
return krb5_enomem(context);
|
||||||
}
|
}
|
||||||
if(*p == 's') {
|
if(*p == 's') {
|
||||||
tmp->type = acl_string;
|
tmp->type = acl_string;
|
||||||
|
@@ -1172,11 +1172,8 @@ krb5_parse_address(krb5_context context,
|
|||||||
krb5_address addr;
|
krb5_address addr;
|
||||||
if((*at[i].parse_addr)(context, string, &addr) == 0) {
|
if((*at[i].parse_addr)(context, string, &addr) == 0) {
|
||||||
ALLOC_SEQ(addresses, 1);
|
ALLOC_SEQ(addresses, 1);
|
||||||
if (addresses->val == NULL) {
|
if (addresses->val == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM,
|
return krb5_enomem(context);
|
||||||
N_("malloc: out of memory", ""));
|
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
addresses->val[0] = addr;
|
addresses->val[0] = addr;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -1199,10 +1196,8 @@ krb5_parse_address(krb5_context context,
|
|||||||
|
|
||||||
ALLOC_SEQ(addresses, n);
|
ALLOC_SEQ(addresses, n);
|
||||||
if (addresses->val == NULL) {
|
if (addresses->val == NULL) {
|
||||||
krb5_set_error_message(context, ENOMEM,
|
|
||||||
N_("malloc: out of memory", ""));
|
|
||||||
freeaddrinfo(ai);
|
freeaddrinfo(ai);
|
||||||
return ENOMEM;
|
return krb5_enomem(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
addresses->len = 0;
|
addresses->len = 0;
|
||||||
@@ -1412,7 +1407,7 @@ krb5_copy_addresses(krb5_context context,
|
|||||||
size_t i;
|
size_t i;
|
||||||
ALLOC_SEQ(outaddr, inaddr->len);
|
ALLOC_SEQ(outaddr, inaddr->len);
|
||||||
if(inaddr->len > 0 && outaddr->val == NULL)
|
if(inaddr->len > 0 && outaddr->val == NULL)
|
||||||
return ENOMEM;
|
return krb5_enomem(context);
|
||||||
for(i = 0; i < inaddr->len; i++)
|
for(i = 0; i < inaddr->len; i++)
|
||||||
krb5_copy_address(context, &inaddr->val[i], &outaddr->val[i]);
|
krb5_copy_address(context, &inaddr->val[i], &outaddr->val[i]);
|
||||||
return 0;
|
return 0;
|
||||||
@@ -1441,11 +1436,8 @@ krb5_append_addresses(krb5_context context,
|
|||||||
size_t i;
|
size_t i;
|
||||||
if(source->len > 0) {
|
if(source->len > 0) {
|
||||||
tmp = realloc(dest->val, (dest->len + source->len) * sizeof(*tmp));
|
tmp = realloc(dest->val, (dest->len + source->len) * sizeof(*tmp));
|
||||||
if(tmp == NULL) {
|
if (tmp == NULL)
|
||||||
krb5_set_error_message (context, ENOMEM,
|
return krb5_enomem(context);
|
||||||
N_("malloc: out of memory", ""));
|
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
dest->val = tmp;
|
dest->val = tmp;
|
||||||
for(i = 0; i < source->len; i++) {
|
for(i = 0; i < source->len; i++) {
|
||||||
/* skip duplicates */
|
/* skip duplicates */
|
||||||
@@ -1484,19 +1476,14 @@ krb5_make_addrport (krb5_context context,
|
|||||||
u_char *p;
|
u_char *p;
|
||||||
|
|
||||||
*res = malloc (sizeof(**res));
|
*res = malloc (sizeof(**res));
|
||||||
if (*res == NULL) {
|
if (*res == NULL)
|
||||||
krb5_set_error_message (context, ENOMEM,
|
return krb5_enomem(context);
|
||||||
N_("malloc: out of memory", ""));
|
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
(*res)->addr_type = KRB5_ADDRESS_ADDRPORT;
|
(*res)->addr_type = KRB5_ADDRESS_ADDRPORT;
|
||||||
ret = krb5_data_alloc (&(*res)->address, len);
|
ret = krb5_data_alloc (&(*res)->address, len);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
krb5_set_error_message (context, ret,
|
|
||||||
N_("malloc: out of memory", ""));
|
|
||||||
free (*res);
|
free (*res);
|
||||||
*res = NULL;
|
*res = NULL;
|
||||||
return ret;
|
return krb5_enomem(context);
|
||||||
}
|
}
|
||||||
p = (*res)->address.data;
|
p = (*res)->address.data;
|
||||||
*p++ = 0;
|
*p++ = 0;
|
||||||
|
@@ -55,7 +55,7 @@ _krb5_principalname2krb5_principal (krb5_context context,
|
|||||||
|
|
||||||
p = calloc(1, sizeof(*p));
|
p = calloc(1, sizeof(*p));
|
||||||
if (p == NULL)
|
if (p == NULL)
|
||||||
return ENOMEM;
|
return krb5_enomem(context);
|
||||||
ret = copy_PrincipalName(&from, &p->name);
|
ret = copy_PrincipalName(&from, &p->name);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
free(p);
|
free(p);
|
||||||
@@ -65,7 +65,7 @@ _krb5_principalname2krb5_principal (krb5_context context,
|
|||||||
if (p->realm == NULL) {
|
if (p->realm == NULL) {
|
||||||
free_PrincipalName(&p->name);
|
free_PrincipalName(&p->name);
|
||||||
free(p);
|
free(p);
|
||||||
return ENOMEM;
|
return krb5_enomem(context);
|
||||||
}
|
}
|
||||||
*principal = p;
|
*principal = p;
|
||||||
return 0;
|
return 0;
|
||||||
|
@@ -50,16 +50,13 @@ krb5_auth_con_init(krb5_context context,
|
|||||||
krb5_auth_context p;
|
krb5_auth_context p;
|
||||||
|
|
||||||
ALLOC(p, 1);
|
ALLOC(p, 1);
|
||||||
if(!p) {
|
if (!p)
|
||||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
return krb5_enomem(context);
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
memset(p, 0, sizeof(*p));
|
memset(p, 0, sizeof(*p));
|
||||||
ALLOC(p->authenticator, 1);
|
ALLOC(p->authenticator, 1);
|
||||||
if (!p->authenticator) {
|
if (!p->authenticator) {
|
||||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
|
||||||
free(p);
|
free(p);
|
||||||
return ENOMEM;
|
return krb5_enomem(context);
|
||||||
}
|
}
|
||||||
memset (p->authenticator, 0, sizeof(*p->authenticator));
|
memset (p->authenticator, 0, sizeof(*p->authenticator));
|
||||||
p->flags = KRB5_AUTH_CONTEXT_DO_TIME;
|
p->flags = KRB5_AUTH_CONTEXT_DO_TIME;
|
||||||
@@ -159,7 +156,7 @@ krb5_auth_con_setaddrs(krb5_context context,
|
|||||||
krb5_free_address (context, auth_context->local_address);
|
krb5_free_address (context, auth_context->local_address);
|
||||||
else
|
else
|
||||||
if ((auth_context->local_address = malloc(sizeof(krb5_address))) == NULL)
|
if ((auth_context->local_address = malloc(sizeof(krb5_address))) == NULL)
|
||||||
return ENOMEM;
|
return krb5_enomem(context);
|
||||||
krb5_copy_address(context, local_addr, auth_context->local_address);
|
krb5_copy_address(context, local_addr, auth_context->local_address);
|
||||||
}
|
}
|
||||||
if (remote_addr) {
|
if (remote_addr) {
|
||||||
@@ -167,7 +164,7 @@ krb5_auth_con_setaddrs(krb5_context context,
|
|||||||
krb5_free_address (context, auth_context->remote_address);
|
krb5_free_address (context, auth_context->remote_address);
|
||||||
else
|
else
|
||||||
if ((auth_context->remote_address = malloc(sizeof(krb5_address))) == NULL)
|
if ((auth_context->remote_address = malloc(sizeof(krb5_address))) == NULL)
|
||||||
return ENOMEM;
|
return krb5_enomem(context);
|
||||||
krb5_copy_address(context, remote_addr, auth_context->remote_address);
|
krb5_copy_address(context, remote_addr, auth_context->remote_address);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -264,10 +261,8 @@ krb5_auth_con_getaddrs(krb5_context context,
|
|||||||
if(*local_addr)
|
if(*local_addr)
|
||||||
krb5_free_address (context, *local_addr);
|
krb5_free_address (context, *local_addr);
|
||||||
*local_addr = malloc (sizeof(**local_addr));
|
*local_addr = malloc (sizeof(**local_addr));
|
||||||
if (*local_addr == NULL) {
|
if (*local_addr == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
return krb5_enomem(context);
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
krb5_copy_address(context,
|
krb5_copy_address(context,
|
||||||
auth_context->local_address,
|
auth_context->local_address,
|
||||||
*local_addr);
|
*local_addr);
|
||||||
@@ -276,10 +271,9 @@ krb5_auth_con_getaddrs(krb5_context context,
|
|||||||
krb5_free_address (context, *remote_addr);
|
krb5_free_address (context, *remote_addr);
|
||||||
*remote_addr = malloc (sizeof(**remote_addr));
|
*remote_addr = malloc (sizeof(**remote_addr));
|
||||||
if (*remote_addr == NULL) {
|
if (*remote_addr == NULL) {
|
||||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
|
||||||
krb5_free_address (context, *local_addr);
|
krb5_free_address (context, *local_addr);
|
||||||
*local_addr = NULL;
|
*local_addr = NULL;
|
||||||
return ENOMEM;
|
return krb5_enomem(context);
|
||||||
}
|
}
|
||||||
krb5_copy_address(context,
|
krb5_copy_address(context,
|
||||||
auth_context->remote_address,
|
auth_context->remote_address,
|
||||||
@@ -420,7 +414,7 @@ krb5_auth_con_setenctype(krb5_context context,
|
|||||||
krb5_free_keyblock(context, auth_context->keyblock);
|
krb5_free_keyblock(context, auth_context->keyblock);
|
||||||
ALLOC(auth_context->keyblock, 1);
|
ALLOC(auth_context->keyblock, 1);
|
||||||
if(auth_context->keyblock == NULL)
|
if(auth_context->keyblock == NULL)
|
||||||
return ENOMEM;
|
return krb5_enomem(context);
|
||||||
auth_context->keyblock->keytype = etype;
|
auth_context->keyblock->keytype = etype;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -477,10 +471,8 @@ krb5_auth_con_getauthenticator(krb5_context context,
|
|||||||
krb5_authenticator *authenticator)
|
krb5_authenticator *authenticator)
|
||||||
{
|
{
|
||||||
*authenticator = malloc(sizeof(**authenticator));
|
*authenticator = malloc(sizeof(**authenticator));
|
||||||
if (*authenticator == NULL) {
|
if (*authenticator == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
return krb5_enomem(context);
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
|
|
||||||
copy_Authenticator(auth_context->authenticator,
|
copy_Authenticator(auth_context->authenticator,
|
||||||
*authenticator);
|
*authenticator);
|
||||||
|
@@ -62,8 +62,7 @@ make_etypelist(krb5_context context,
|
|||||||
ALLOC_SEQ(&ad, 1);
|
ALLOC_SEQ(&ad, 1);
|
||||||
if (ad.val == NULL) {
|
if (ad.val == NULL) {
|
||||||
free(buf);
|
free(buf);
|
||||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
return krb5_enomem(context);
|
||||||
return ENOMEM;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ad.val[0].ad_type = KRB5_AUTHDATA_GSS_API_ETYPE_NEGOTIATION;
|
ad.val[0].ad_type = KRB5_AUTHDATA_GSS_API_ETYPE_NEGOTIATION;
|
||||||
@@ -82,16 +81,14 @@ make_etypelist(krb5_context context,
|
|||||||
ALLOC(*auth_data, 1);
|
ALLOC(*auth_data, 1);
|
||||||
if (*auth_data == NULL) {
|
if (*auth_data == NULL) {
|
||||||
free(buf);
|
free(buf);
|
||||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
return krb5_enomem(context);
|
||||||
return ENOMEM;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ALLOC_SEQ(*auth_data, 1);
|
ALLOC_SEQ(*auth_data, 1);
|
||||||
if ((*auth_data)->val == NULL) {
|
if ((*auth_data)->val == NULL) {
|
||||||
free(*auth_data);
|
free(*auth_data);
|
||||||
free(buf);
|
free(buf);
|
||||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
return krb5_enomem(context);
|
||||||
return ENOMEM;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
(*auth_data)->val[0].ad_type = KRB5_AUTHDATA_IF_RELEVANT;
|
(*auth_data)->val[0].ad_type = KRB5_AUTHDATA_IF_RELEVANT;
|
||||||
@@ -136,7 +133,7 @@ _krb5_build_authenticator (krb5_context context,
|
|||||||
&auth_context->local_seqnumber);
|
&auth_context->local_seqnumber);
|
||||||
ALLOC(auth.seq_number, 1);
|
ALLOC(auth.seq_number, 1);
|
||||||
if(auth.seq_number == NULL) {
|
if(auth.seq_number == NULL) {
|
||||||
ret = ENOMEM;
|
ret = krb5_enomem(context);
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
*auth.seq_number = auth_context->local_seqnumber;
|
*auth.seq_number = auth_context->local_seqnumber;
|
||||||
@@ -147,7 +144,7 @@ _krb5_build_authenticator (krb5_context context,
|
|||||||
if (cksum) {
|
if (cksum) {
|
||||||
ALLOC(auth.cksum, 1);
|
ALLOC(auth.cksum, 1);
|
||||||
if (auth.cksum == NULL) {
|
if (auth.cksum == NULL) {
|
||||||
ret = ENOMEM;
|
ret = krb5_enomem(context);
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
ret = copy_Checksum(cksum, auth.cksum);
|
ret = copy_Checksum(cksum, auth.cksum);
|
||||||
|
@@ -383,9 +383,8 @@ krb5_cc_get_full_name(krb5_context context,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (asprintf(str, "%s:%s", type, name) == -1) {
|
if (asprintf(str, "%s:%s", type, name) == -1) {
|
||||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
|
||||||
*str = NULL;
|
*str = NULL;
|
||||||
return ENOMEM;
|
return krb5_enomem(context);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -554,10 +553,8 @@ krb5_cc_set_default_name(krb5_context context, const char *name)
|
|||||||
context->default_cc_name_set = 1;
|
context->default_cc_name_set = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p == NULL) {
|
if (p == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
return krb5_enomem(context);
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = _krb5_expand_path_tokens(context, p, &exp_p);
|
ret = _krb5_expand_path_tokens(context, p, &exp_p);
|
||||||
free(p);
|
free(p);
|
||||||
@@ -606,10 +603,8 @@ krb5_cc_default(krb5_context context,
|
|||||||
{
|
{
|
||||||
const char *p = krb5_cc_default_name(context);
|
const char *p = krb5_cc_default_name(context);
|
||||||
|
|
||||||
if (p == NULL) {
|
if (p == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
return krb5_enomem(context);
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
return krb5_cc_resolve(context, p, id);
|
return krb5_cc_resolve(context, p, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -989,7 +984,7 @@ krb5_cc_get_prefix_ops(krb5_context context, const char *prefix)
|
|||||||
|
|
||||||
p = strdup(prefix);
|
p = strdup(prefix);
|
||||||
if (p == NULL) {
|
if (p == NULL) {
|
||||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
krb5_enomem(context);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
p1 = strchr(p, ':');
|
p1 = strchr(p, ':');
|
||||||
@@ -1053,10 +1048,8 @@ krb5_cc_cache_get_first (krb5_context context,
|
|||||||
}
|
}
|
||||||
|
|
||||||
*cursor = calloc(1, sizeof(**cursor));
|
*cursor = calloc(1, sizeof(**cursor));
|
||||||
if (*cursor == NULL) {
|
if (*cursor == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
return krb5_enomem(context);
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
|
|
||||||
(*cursor)->ops = ops;
|
(*cursor)->ops = ops;
|
||||||
|
|
||||||
@@ -1388,10 +1381,8 @@ KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
|
|||||||
krb5_cccol_cursor_new(krb5_context context, krb5_cccol_cursor *cursor)
|
krb5_cccol_cursor_new(krb5_context context, krb5_cccol_cursor *cursor)
|
||||||
{
|
{
|
||||||
*cursor = calloc(1, sizeof(**cursor));
|
*cursor = calloc(1, sizeof(**cursor));
|
||||||
if (*cursor == NULL) {
|
if (*cursor == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
return krb5_enomem(context);
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
(*cursor)->idx = 0;
|
(*cursor)->idx = 0;
|
||||||
(*cursor)->cursor = NULL;
|
(*cursor)->cursor = NULL;
|
||||||
|
|
||||||
@@ -1577,10 +1568,9 @@ krb5_cc_get_friendly_name(krb5_context context,
|
|||||||
} else {
|
} else {
|
||||||
ret = asprintf(name, "%.*s", (int)data.length, (char *)data.data);
|
ret = asprintf(name, "%.*s", (int)data.length, (char *)data.data);
|
||||||
krb5_data_free(&data);
|
krb5_data_free(&data);
|
||||||
if (ret <= 0) {
|
if (ret <= 0)
|
||||||
ret = ENOMEM;
|
ret = krb5_enomem(context);
|
||||||
krb5_set_error_message(context, ret, N_("malloc: out of memory", ""));
|
else
|
||||||
} else
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -447,21 +447,14 @@ krb5_config_parse_file_multi (krb5_context context,
|
|||||||
int aret;
|
int aret;
|
||||||
|
|
||||||
aret = asprintf(&newfname, "%s%s", home, &fname[1]);
|
aret = asprintf(&newfname, "%s%s", home, &fname[1]);
|
||||||
if (aret == -1 || newfname == NULL) {
|
if (aret == -1 || newfname == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM,
|
return krb5_enomem(context);
|
||||||
N_("malloc: out of memory", ""));
|
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
fname = newfname;
|
fname = newfname;
|
||||||
}
|
}
|
||||||
#else /* KRB5_USE_PATH_TOKENS */
|
#else /* KRB5_USE_PATH_TOKENS */
|
||||||
if (asprintf(&newfname, "%%{USERCONFIG}%s", &fname[1]) < 0 ||
|
if (asprintf(&newfname, "%%{USERCONFIG}%s", &fname[1]) < 0 ||
|
||||||
newfname == NULL)
|
newfname == NULL)
|
||||||
{
|
return krb5_enomem(context);
|
||||||
krb5_set_error_message(context, ENOMEM,
|
|
||||||
N_("malloc: out of memory", ""));
|
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
fname = newfname;
|
fname = newfname;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@@ -579,10 +579,8 @@ parse_reg_root(krb5_context context,
|
|||||||
krb5_error_code code = 0;
|
krb5_error_code code = 0;
|
||||||
|
|
||||||
libdefaults = _krb5_config_get_entry(parent, "libdefaults", krb5_config_list);
|
libdefaults = _krb5_config_get_entry(parent, "libdefaults", krb5_config_list);
|
||||||
if (libdefaults == NULL) {
|
if (libdefaults == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM, "Out of memory while parsing configuration");
|
return krb5_enomem(context);
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
|
|
||||||
code = parse_reg_values(context, key, &libdefaults->u.list);
|
code = parse_reg_values(context, key, &libdefaults->u.list);
|
||||||
if (code)
|
if (code)
|
||||||
|
@@ -69,8 +69,7 @@ set_etypes (krb5_context context,
|
|||||||
etypes = malloc((i+1) * sizeof(*etypes));
|
etypes = malloc((i+1) * sizeof(*etypes));
|
||||||
if (etypes == NULL) {
|
if (etypes == NULL) {
|
||||||
krb5_config_free_strings (etypes_str);
|
krb5_config_free_strings (etypes_str);
|
||||||
krb5_set_error_message (context, ENOMEM, N_("malloc: out of memory", ""));
|
return krb5_enomem(context);
|
||||||
return ENOMEM;
|
|
||||||
}
|
}
|
||||||
for(j = 0, k = 0; j < i; j++) {
|
for(j = 0, k = 0; j < i; j++) {
|
||||||
krb5_enctype e;
|
krb5_enctype e;
|
||||||
@@ -325,11 +324,8 @@ kt_ops_copy(krb5_context context, const krb5_context src_context)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
context->kt_types = malloc(sizeof(context->kt_types[0]) * src_context->num_kt_types);
|
context->kt_types = malloc(sizeof(context->kt_types[0]) * src_context->num_kt_types);
|
||||||
if (context->kt_types == NULL) {
|
if (context->kt_types == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM,
|
return krb5_enomem(context);
|
||||||
N_("malloc: out of memory", ""));
|
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
|
|
||||||
context->num_kt_types = src_context->num_kt_types;
|
context->num_kt_types = src_context->num_kt_types;
|
||||||
memcpy(context->kt_types, src_context->kt_types,
|
memcpy(context->kt_types, src_context->kt_types,
|
||||||
@@ -454,11 +450,8 @@ copy_etypes (krb5_context context,
|
|||||||
i++;
|
i++;
|
||||||
|
|
||||||
*ret_enctypes = malloc(sizeof(ret_enctypes[0]) * i);
|
*ret_enctypes = malloc(sizeof(ret_enctypes[0]) * i);
|
||||||
if (*ret_enctypes == NULL) {
|
if (*ret_enctypes == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM,
|
return krb5_enomem(context);
|
||||||
N_("malloc: out of memory", ""));
|
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
memcpy(*ret_enctypes, enctypes, sizeof(ret_enctypes[0]) * i);
|
memcpy(*ret_enctypes, enctypes, sizeof(ret_enctypes[0]) * i);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -485,16 +478,13 @@ krb5_copy_context(krb5_context context, krb5_context *out)
|
|||||||
*out = NULL;
|
*out = NULL;
|
||||||
|
|
||||||
p = calloc(1, sizeof(*p));
|
p = calloc(1, sizeof(*p));
|
||||||
if (p == NULL) {
|
if (p == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
return krb5_enomem(context);
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
|
|
||||||
p->mutex = malloc(sizeof(HEIMDAL_MUTEX));
|
p->mutex = malloc(sizeof(HEIMDAL_MUTEX));
|
||||||
if (p->mutex == NULL) {
|
if (p->mutex == NULL) {
|
||||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
|
||||||
free(p);
|
free(p);
|
||||||
return ENOMEM;
|
return krb5_enomem(context);
|
||||||
}
|
}
|
||||||
HEIMDAL_MUTEX_init(p->mutex);
|
HEIMDAL_MUTEX_init(p->mutex);
|
||||||
|
|
||||||
@@ -1158,10 +1148,8 @@ krb5_set_extra_addresses(krb5_context context, const krb5_addresses *addresses)
|
|||||||
}
|
}
|
||||||
if(context->extra_addresses == NULL) {
|
if(context->extra_addresses == NULL) {
|
||||||
context->extra_addresses = malloc(sizeof(*context->extra_addresses));
|
context->extra_addresses = malloc(sizeof(*context->extra_addresses));
|
||||||
if(context->extra_addresses == NULL) {
|
if (context->extra_addresses == NULL)
|
||||||
krb5_set_error_message (context, ENOMEM, N_("malloc: out of memory", ""));
|
return krb5_enomem(context);
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return krb5_copy_addresses(context, addresses, context->extra_addresses);
|
return krb5_copy_addresses(context, addresses, context->extra_addresses);
|
||||||
}
|
}
|
||||||
@@ -1240,10 +1228,8 @@ krb5_set_ignore_addresses(krb5_context context, const krb5_addresses *addresses)
|
|||||||
}
|
}
|
||||||
if(context->ignore_addresses == NULL) {
|
if(context->ignore_addresses == NULL) {
|
||||||
context->ignore_addresses = malloc(sizeof(*context->ignore_addresses));
|
context->ignore_addresses = malloc(sizeof(*context->ignore_addresses));
|
||||||
if(context->ignore_addresses == NULL) {
|
if (context->ignore_addresses == NULL)
|
||||||
krb5_set_error_message (context, ENOMEM, N_("malloc: out of memory", ""));
|
return krb5_enomem(context);
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return krb5_copy_addresses(context, addresses, context->ignore_addresses);
|
return krb5_copy_addresses(context, addresses, context->ignore_addresses);
|
||||||
}
|
}
|
||||||
|
@@ -58,19 +58,14 @@ krb5_copy_host_realm(krb5_context context,
|
|||||||
++n;
|
++n;
|
||||||
|
|
||||||
*to = calloc (n, sizeof(**to));
|
*to = calloc (n, sizeof(**to));
|
||||||
if (*to == NULL) {
|
if (*to == NULL)
|
||||||
krb5_set_error_message (context, ENOMEM,
|
return krb5_enomem(context);
|
||||||
N_("malloc: out of memory", ""));
|
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0, p = from; *p != NULL; ++p, ++i) {
|
for (i = 0, p = from; *p != NULL; ++p, ++i) {
|
||||||
(*to)[i] = strdup(*p);
|
(*to)[i] = strdup(*p);
|
||||||
if ((*to)[i] == NULL) {
|
if ((*to)[i] == NULL) {
|
||||||
krb5_free_host_realm (context, *to);
|
krb5_free_host_realm (context, *to);
|
||||||
krb5_set_error_message (context, ENOMEM,
|
return krb5_enomem(context);
|
||||||
N_("malloc: out of memory", ""));
|
|
||||||
return ENOMEM;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@@ -138,13 +138,9 @@ krb5_copy_creds (krb5_context context,
|
|||||||
{
|
{
|
||||||
krb5_creds *c;
|
krb5_creds *c;
|
||||||
|
|
||||||
c = malloc (sizeof (*c));
|
c = calloc(1, sizeof(*c));
|
||||||
if (c == NULL) {
|
if (c == NULL)
|
||||||
krb5_set_error_message (context, ENOMEM,
|
return krb5_enomem(context);
|
||||||
N_("malloc: out of memory", ""));
|
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
memset (c, 0, sizeof(*c));
|
|
||||||
*outcred = c;
|
*outcred = c;
|
||||||
return krb5_copy_creds_contents (context, incred, c);
|
return krb5_copy_creds_contents (context, incred, c);
|
||||||
}
|
}
|
||||||
|
@@ -75,10 +75,8 @@ _krb5_HMAC_MD5_checksum(krb5_context context,
|
|||||||
krb5_error_code ret;
|
krb5_error_code ret;
|
||||||
|
|
||||||
m = EVP_MD_CTX_create();
|
m = EVP_MD_CTX_create();
|
||||||
if (m == NULL) {
|
if (m == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
return krb5_enomem(context);
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
ksign_c.checksum.length = sizeof(ksign_c_data);
|
ksign_c.checksum.length = sizeof(ksign_c_data);
|
||||||
ksign_c.checksum.data = ksign_c_data;
|
ksign_c.checksum.data = ksign_c_data;
|
||||||
ret = _krb5_internal_hmac(context, c, signature, sizeof(signature),
|
ret = _krb5_internal_hmac(context, c, signature, sizeof(signature),
|
||||||
|
@@ -70,10 +70,8 @@ _krb5_des_checksum(krb5_context context,
|
|||||||
krb5_generate_random_block(p, 8);
|
krb5_generate_random_block(p, 8);
|
||||||
|
|
||||||
m = EVP_MD_CTX_create();
|
m = EVP_MD_CTX_create();
|
||||||
if (m == NULL) {
|
if (m == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
return krb5_enomem(context);
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
|
|
||||||
EVP_DigestInit_ex(m, evp_md, NULL);
|
EVP_DigestInit_ex(m, evp_md, NULL);
|
||||||
EVP_DigestUpdate(m, p, 8);
|
EVP_DigestUpdate(m, p, 8);
|
||||||
@@ -103,10 +101,8 @@ _krb5_des_verify(krb5_context context,
|
|||||||
krb5_error_code ret = 0;
|
krb5_error_code ret = 0;
|
||||||
|
|
||||||
m = EVP_MD_CTX_create();
|
m = EVP_MD_CTX_create();
|
||||||
if (m == NULL) {
|
if (m == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
return krb5_enomem(context);
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
|
|
||||||
memset(&ivec, 0, sizeof(ivec));
|
memset(&ivec, 0, sizeof(ivec));
|
||||||
EVP_CipherInit_ex(&ctx->dctx, NULL, NULL, NULL, (void *)&ivec, -1);
|
EVP_CipherInit_ex(&ctx->dctx, NULL, NULL, NULL, (void *)&ivec, -1);
|
||||||
|
@@ -72,10 +72,8 @@ _krb5_evp_encrypt(krb5_context context,
|
|||||||
/* alloca ? */
|
/* alloca ? */
|
||||||
size_t len2 = EVP_CIPHER_CTX_iv_length(c);
|
size_t len2 = EVP_CIPHER_CTX_iv_length(c);
|
||||||
void *loiv = malloc(len2);
|
void *loiv = malloc(len2);
|
||||||
if (loiv == NULL) {
|
if (loiv == NULL)
|
||||||
krb5_clear_error_message(context);
|
return krb5_enomem(context);
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
memset(loiv, 0, len2);
|
memset(loiv, 0, len2);
|
||||||
EVP_CipherInit_ex(c, NULL, NULL, NULL, loiv, -1);
|
EVP_CipherInit_ex(c, NULL, NULL, NULL, loiv, -1);
|
||||||
free(loiv);
|
free(loiv);
|
||||||
|
@@ -61,16 +61,13 @@ _krb5_pk_octetstring2key(krb5_context context,
|
|||||||
keylen = (et->keytype->bits + 7) / 8;
|
keylen = (et->keytype->bits + 7) / 8;
|
||||||
|
|
||||||
keydata = malloc(keylen);
|
keydata = malloc(keylen);
|
||||||
if (keydata == NULL) {
|
if (keydata == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
return krb5_enomem(context);
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
|
|
||||||
m = EVP_MD_CTX_create();
|
m = EVP_MD_CTX_create();
|
||||||
if (m == NULL) {
|
if (m == NULL) {
|
||||||
free(keydata);
|
free(keydata);
|
||||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
return krb5_enomem(context);
|
||||||
return ENOMEM;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
counter = 0;
|
counter = 0;
|
||||||
@@ -248,10 +245,8 @@ _krb5_pk_kdf(krb5_context context,
|
|||||||
keylen = (et->keytype->bits + 7) / 8;
|
keylen = (et->keytype->bits + 7) / 8;
|
||||||
|
|
||||||
keydata = malloc(keylen);
|
keydata = malloc(keylen);
|
||||||
if (keydata == NULL) {
|
if (keydata == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
return krb5_enomem(context);
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = encode_otherinfo(context, ai, client, server,
|
ret = encode_otherinfo(context, ai, client, server,
|
||||||
enctype, as_req, pk_as_rep, ticket, &other);
|
enctype, as_req, pk_as_rep, ticket, &other);
|
||||||
@@ -264,8 +259,7 @@ _krb5_pk_kdf(krb5_context context,
|
|||||||
if (m == NULL) {
|
if (m == NULL) {
|
||||||
free(keydata);
|
free(keydata);
|
||||||
free(other.data);
|
free(other.data);
|
||||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
return krb5_enomem(context);
|
||||||
return ENOMEM;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
offset = 0;
|
offset = 0;
|
||||||
|
@@ -147,10 +147,8 @@ _key_schedule(krb5_context context,
|
|||||||
if (key->schedule != NULL)
|
if (key->schedule != NULL)
|
||||||
return 0;
|
return 0;
|
||||||
ALLOC(key->schedule, 1);
|
ALLOC(key->schedule, 1);
|
||||||
if(key->schedule == NULL) {
|
if (key->schedule == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
return krb5_enomem(context);
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
ret = krb5_data_alloc(key->schedule, kt->schedule_size);
|
ret = krb5_data_alloc(key->schedule, kt->schedule_size);
|
||||||
if(ret) {
|
if(ret) {
|
||||||
free(key->schedule);
|
free(key->schedule);
|
||||||
@@ -325,10 +323,8 @@ get_checksum_key(krb5_context context,
|
|||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
*key = _new_derived_key(crypto, 0xff/* KRB5_KU_RFC1510_VARIANT */);
|
*key = _new_derived_key(crypto, 0xff/* KRB5_KU_RFC1510_VARIANT */);
|
||||||
if(*key == NULL) {
|
if (*key == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
return krb5_enomem(context);
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
ret = krb5_copy_keyblock(context, crypto->key.key, &(*key)->key);
|
ret = krb5_copy_keyblock(context, crypto->key.key, &(*key)->key);
|
||||||
if(ret)
|
if(ret)
|
||||||
return ret;
|
return ret;
|
||||||
@@ -666,10 +662,8 @@ krb5_enctype_to_string(krb5_context context,
|
|||||||
return KRB5_PROG_ETYPE_NOSUPP;
|
return KRB5_PROG_ETYPE_NOSUPP;
|
||||||
}
|
}
|
||||||
*string = strdup(e->name);
|
*string = strdup(e->name);
|
||||||
if(*string == NULL) {
|
if (*string == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
return krb5_enomem(context);
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -836,10 +830,8 @@ encrypt_internal_derived(krb5_context context,
|
|||||||
block_sz = (sz + et->padsize - 1) &~ (et->padsize - 1); /* pad */
|
block_sz = (sz + et->padsize - 1) &~ (et->padsize - 1); /* pad */
|
||||||
total_sz = block_sz + checksum_sz;
|
total_sz = block_sz + checksum_sz;
|
||||||
p = calloc(1, total_sz);
|
p = calloc(1, total_sz);
|
||||||
if(p == NULL) {
|
if (p == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
return krb5_enomem(context);
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
|
|
||||||
q = p;
|
q = p;
|
||||||
krb5_generate_random_block(q, et->confoundersize); /* XXX */
|
krb5_generate_random_block(q, et->confoundersize); /* XXX */
|
||||||
@@ -900,10 +892,8 @@ encrypt_internal(krb5_context context,
|
|||||||
sz = et->confoundersize + checksum_sz + len;
|
sz = et->confoundersize + checksum_sz + len;
|
||||||
block_sz = (sz + et->padsize - 1) &~ (et->padsize - 1); /* pad */
|
block_sz = (sz + et->padsize - 1) &~ (et->padsize - 1); /* pad */
|
||||||
p = calloc(1, block_sz);
|
p = calloc(1, block_sz);
|
||||||
if(p == NULL) {
|
if (p == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
return krb5_enomem(context);
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
|
|
||||||
q = p;
|
q = p;
|
||||||
krb5_generate_random_block(q, et->confoundersize); /* XXX */
|
krb5_generate_random_block(q, et->confoundersize); /* XXX */
|
||||||
@@ -962,10 +952,8 @@ encrypt_internal_special(krb5_context context,
|
|||||||
krb5_error_code ret;
|
krb5_error_code ret;
|
||||||
|
|
||||||
tmp = malloc (sz);
|
tmp = malloc (sz);
|
||||||
if (tmp == NULL) {
|
if (tmp == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
return krb5_enomem(context);
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
p = tmp;
|
p = tmp;
|
||||||
memset (p, 0, cksum_sz);
|
memset (p, 0, cksum_sz);
|
||||||
p += cksum_sz;
|
p += cksum_sz;
|
||||||
@@ -1014,10 +1002,8 @@ decrypt_internal_derived(krb5_context context,
|
|||||||
}
|
}
|
||||||
|
|
||||||
p = malloc(len);
|
p = malloc(len);
|
||||||
if(len != 0 && p == NULL) {
|
if (len != 0 && p == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
return krb5_enomem(context);
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
memcpy(p, data, len);
|
memcpy(p, data, len);
|
||||||
|
|
||||||
len -= checksum_sz;
|
len -= checksum_sz;
|
||||||
@@ -1057,8 +1043,7 @@ decrypt_internal_derived(krb5_context context,
|
|||||||
result->data = realloc(p, l);
|
result->data = realloc(p, l);
|
||||||
if(result->data == NULL && l != 0) {
|
if(result->data == NULL && l != 0) {
|
||||||
free(p);
|
free(p);
|
||||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
return krb5_enomem(context);
|
||||||
return ENOMEM;
|
|
||||||
}
|
}
|
||||||
result->length = l;
|
result->length = l;
|
||||||
return 0;
|
return 0;
|
||||||
@@ -1091,10 +1076,8 @@ decrypt_internal(krb5_context context,
|
|||||||
}
|
}
|
||||||
|
|
||||||
p = malloc(len);
|
p = malloc(len);
|
||||||
if(len != 0 && p == NULL) {
|
if (len != 0 && p == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
return krb5_enomem(context);
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
memcpy(p, data, len);
|
memcpy(p, data, len);
|
||||||
|
|
||||||
ret = _key_schedule(context, &crypto->key);
|
ret = _key_schedule(context, &crypto->key);
|
||||||
@@ -1125,8 +1108,7 @@ decrypt_internal(krb5_context context,
|
|||||||
result->data = realloc(p, l);
|
result->data = realloc(p, l);
|
||||||
if(result->data == NULL && l != 0) {
|
if(result->data == NULL && l != 0) {
|
||||||
free(p);
|
free(p);
|
||||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
return krb5_enomem(context);
|
||||||
return ENOMEM;
|
|
||||||
}
|
}
|
||||||
result->length = l;
|
result->length = l;
|
||||||
return 0;
|
return 0;
|
||||||
@@ -1159,10 +1141,8 @@ decrypt_internal_special(krb5_context context,
|
|||||||
}
|
}
|
||||||
|
|
||||||
p = malloc (len);
|
p = malloc (len);
|
||||||
if (p == NULL) {
|
if (p == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
return krb5_enomem(context);
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
memcpy(p, data, len);
|
memcpy(p, data, len);
|
||||||
|
|
||||||
ret = (*et->encrypt)(context, &crypto->key, p, len, FALSE, usage, ivec);
|
ret = (*et->encrypt)(context, &crypto->key, p, len, FALSE, usage, ivec);
|
||||||
@@ -1175,8 +1155,7 @@ decrypt_internal_special(krb5_context context,
|
|||||||
result->data = realloc(p, sz);
|
result->data = realloc(p, sz);
|
||||||
if(result->data == NULL && sz != 0) {
|
if(result->data == NULL && sz != 0) {
|
||||||
free(p);
|
free(p);
|
||||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
return krb5_enomem(context);
|
||||||
return ENOMEM;
|
|
||||||
}
|
}
|
||||||
result->length = sz;
|
result->length = sz;
|
||||||
return 0;
|
return 0;
|
||||||
@@ -1864,13 +1843,12 @@ _krb5_derive_key(krb5_context context,
|
|||||||
nblocks = (kt->bits + et->blocksize * 8 - 1) / (et->blocksize * 8);
|
nblocks = (kt->bits + et->blocksize * 8 - 1) / (et->blocksize * 8);
|
||||||
k = malloc(nblocks * et->blocksize);
|
k = malloc(nblocks * et->blocksize);
|
||||||
if(k == NULL) {
|
if(k == NULL) {
|
||||||
ret = ENOMEM;
|
ret = krb5_enomem(context);
|
||||||
krb5_set_error_message(context, ret, N_("malloc: out of memory", ""));
|
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
ret = _krb5_n_fold(constant, len, k, et->blocksize);
|
ret = _krb5_n_fold(constant, len, k, et->blocksize);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
krb5_set_error_message(context, ret, N_("malloc: out of memory", ""));
|
krb5_enomem(context);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1888,8 +1866,7 @@ _krb5_derive_key(krb5_context context,
|
|||||||
size_t res_len = (kt->bits + 7) / 8;
|
size_t res_len = (kt->bits + 7) / 8;
|
||||||
|
|
||||||
if(len != 0 && c == NULL) {
|
if(len != 0 && c == NULL) {
|
||||||
ret = ENOMEM;
|
ret = krb5_enomem(context);
|
||||||
krb5_set_error_message(context, ret, N_("malloc: out of memory", ""));
|
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
memcpy(c, constant, len);
|
memcpy(c, constant, len);
|
||||||
@@ -1897,14 +1874,13 @@ _krb5_derive_key(krb5_context context,
|
|||||||
k = malloc(res_len);
|
k = malloc(res_len);
|
||||||
if(res_len != 0 && k == NULL) {
|
if(res_len != 0 && k == NULL) {
|
||||||
free(c);
|
free(c);
|
||||||
ret = ENOMEM;
|
ret = krb5_enomem(context);
|
||||||
krb5_set_error_message(context, ret, N_("malloc: out of memory", ""));
|
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
ret = _krb5_n_fold(c, len, k, res_len);
|
ret = _krb5_n_fold(c, len, k, res_len);
|
||||||
free(c);
|
free(c);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
krb5_set_error_message(context, ret, N_("malloc: out of memory", ""));
|
krb5_enomem(context);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1998,10 +1974,8 @@ _get_derived_key(krb5_context context,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
d = _new_derived_key(crypto, usage);
|
d = _new_derived_key(crypto, usage);
|
||||||
if(d == NULL) {
|
if (d == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
return krb5_enomem(context);
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
krb5_copy_keyblock(context, crypto->key.key, &d->key);
|
krb5_copy_keyblock(context, crypto->key.key, &d->key);
|
||||||
_krb5_put_int(constant, usage, 5);
|
_krb5_put_int(constant, usage, 5);
|
||||||
_krb5_derive_key(context, crypto->et, d, constant, sizeof(constant));
|
_krb5_derive_key(context, crypto->et, d, constant, sizeof(constant));
|
||||||
@@ -2035,10 +2009,8 @@ krb5_crypto_init(krb5_context context,
|
|||||||
{
|
{
|
||||||
krb5_error_code ret;
|
krb5_error_code ret;
|
||||||
ALLOC(*crypto, 1);
|
ALLOC(*crypto, 1);
|
||||||
if(*crypto == NULL) {
|
if (*crypto == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
return krb5_enomem(context);
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
if(etype == (krb5_enctype)ETYPE_NULL)
|
if(etype == (krb5_enctype)ETYPE_NULL)
|
||||||
etype = key->keytype;
|
etype = key->keytype;
|
||||||
(*crypto)->et = _krb5_find_enctype(etype);
|
(*crypto)->et = _krb5_find_enctype(etype);
|
||||||
@@ -2641,10 +2613,8 @@ krb5_keytype_to_enctypes (krb5_context context,
|
|||||||
}
|
}
|
||||||
|
|
||||||
ret = malloc(n * sizeof(*ret));
|
ret = malloc(n * sizeof(*ret));
|
||||||
if (ret == NULL && n != 0) {
|
if (ret == NULL && n != 0)
|
||||||
krb5_set_error_message(context, ENOMEM, "malloc: out of memory");
|
return krb5_enomem(context);
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
n = 0;
|
n = 0;
|
||||||
for (i = _krb5_num_etypes - 1; i >= 0; --i) {
|
for (i = _krb5_num_etypes - 1; i >= 0; --i) {
|
||||||
if (_krb5_etypes[i]->keytype->type == keytype
|
if (_krb5_etypes[i]->keytype->type == keytype
|
||||||
|
@@ -176,10 +176,8 @@ krb5_copy_data(krb5_context context,
|
|||||||
{
|
{
|
||||||
krb5_error_code ret;
|
krb5_error_code ret;
|
||||||
ALLOC(*outdata, 1);
|
ALLOC(*outdata, 1);
|
||||||
if(*outdata == NULL) {
|
if(*outdata == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM, "malloc: out of memory");
|
return krb5_enomem(context);
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
ret = der_copy_octet_string(indata, *outdata);
|
ret = der_copy_octet_string(indata, *outdata);
|
||||||
if(ret) {
|
if(ret) {
|
||||||
krb5_clear_error_message (context);
|
krb5_clear_error_message (context);
|
||||||
|
@@ -84,10 +84,8 @@ krb5_keytype_to_enctypes_default (krb5_context context,
|
|||||||
for (n = 0; context->etypes_des[n]; ++n)
|
for (n = 0; context->etypes_des[n]; ++n)
|
||||||
;
|
;
|
||||||
ret = malloc (n * sizeof(*ret));
|
ret = malloc (n * sizeof(*ret));
|
||||||
if (ret == NULL && n != 0) {
|
if (ret == NULL && n != 0)
|
||||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
return krb5_enomem(context);
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
for (i = 0; i < n; ++i)
|
for (i = 0; i < n; ++i)
|
||||||
ret[i] = context->etypes_des[i];
|
ret[i] = context->etypes_des[i];
|
||||||
*len = n;
|
*len = n;
|
||||||
@@ -140,11 +138,8 @@ krb5_keytype_to_string(krb5_context context,
|
|||||||
return KRB5_PROG_KEYTYPE_NOSUPP;
|
return KRB5_PROG_KEYTYPE_NOSUPP;
|
||||||
}
|
}
|
||||||
*string = strdup(name);
|
*string = strdup(name);
|
||||||
if(*string == NULL) {
|
if (*string == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM,
|
return krb5_enomem(context);
|
||||||
N_("malloc: out of memory", ""));
|
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -201,10 +196,8 @@ krb5_password_key_proc (krb5_context context,
|
|||||||
char buf[BUFSIZ];
|
char buf[BUFSIZ];
|
||||||
|
|
||||||
*key = malloc (sizeof (**key));
|
*key = malloc (sizeof (**key));
|
||||||
if (*key == NULL) {
|
if (*key == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM, "malloc: out of memory");
|
return krb5_enomem(context);
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
if (password == NULL) {
|
if (password == NULL) {
|
||||||
if(UI_UTIL_read_pw_string (buf, sizeof(buf), "Password: ", 0)) {
|
if(UI_UTIL_read_pw_string (buf, sizeof(buf), "Password: ", 0)) {
|
||||||
free (*key);
|
free (*key);
|
||||||
|
@@ -54,8 +54,7 @@ krb5_digest_alloc(krb5_context context, krb5_digest *digest)
|
|||||||
d = calloc(1, sizeof(*d));
|
d = calloc(1, sizeof(*d));
|
||||||
if (d == NULL) {
|
if (d == NULL) {
|
||||||
*digest = NULL;
|
*digest = NULL;
|
||||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
return krb5_enomem(context);
|
||||||
return ENOMEM;
|
|
||||||
}
|
}
|
||||||
*digest = d;
|
*digest = d;
|
||||||
|
|
||||||
@@ -106,8 +105,7 @@ krb5_digest_set_server_cb(krb5_context context,
|
|||||||
free(digest->init.channel);
|
free(digest->init.channel);
|
||||||
digest->init.channel = NULL;
|
digest->init.channel = NULL;
|
||||||
}
|
}
|
||||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
return krb5_enomem(context);
|
||||||
return ENOMEM;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
|
KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
|
||||||
@@ -120,10 +118,8 @@ krb5_digest_set_type(krb5_context context,
|
|||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
digest->init.type = strdup(type);
|
digest->init.type = strdup(type);
|
||||||
if (digest->init.type == NULL) {
|
if (digest->init.type == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
return krb5_enomem(context);
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -137,16 +133,13 @@ krb5_digest_set_hostname(krb5_context context,
|
|||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
digest->init.hostname = malloc(sizeof(*digest->init.hostname));
|
digest->init.hostname = malloc(sizeof(*digest->init.hostname));
|
||||||
if (digest->init.hostname == NULL) {
|
if (digest->init.hostname == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
return krb5_enomem(context);
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
*digest->init.hostname = strdup(hostname);
|
*digest->init.hostname = strdup(hostname);
|
||||||
if (*digest->init.hostname == NULL) {
|
if (*digest->init.hostname == NULL) {
|
||||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
|
||||||
free(digest->init.hostname);
|
free(digest->init.hostname);
|
||||||
digest->init.hostname = NULL;
|
digest->init.hostname = NULL;
|
||||||
return ENOMEM;
|
return krb5_enomem(context);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -168,10 +161,8 @@ krb5_digest_set_server_nonce(krb5_context context,
|
|||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
digest->request.serverNonce = strdup(nonce);
|
digest->request.serverNonce = strdup(nonce);
|
||||||
if (digest->request.serverNonce == NULL) {
|
if (digest->request.serverNonce == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
return krb5_enomem(context);
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -192,10 +183,8 @@ krb5_digest_set_opaque(krb5_context context,
|
|||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
digest->request.opaque = strdup(opaque);
|
digest->request.opaque = strdup(opaque);
|
||||||
if (digest->request.opaque == NULL) {
|
if (digest->request.opaque == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
return krb5_enomem(context);
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -218,16 +207,13 @@ krb5_digest_set_identifier(krb5_context context,
|
|||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
digest->request.identifier = calloc(1, sizeof(*digest->request.identifier));
|
digest->request.identifier = calloc(1, sizeof(*digest->request.identifier));
|
||||||
if (digest->request.identifier == NULL) {
|
if (digest->request.identifier == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
return krb5_enomem(context);
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
*digest->request.identifier = strdup(id);
|
*digest->request.identifier = strdup(id);
|
||||||
if (*digest->request.identifier == NULL) {
|
if (*digest->request.identifier == NULL) {
|
||||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
|
||||||
free(digest->request.identifier);
|
free(digest->request.identifier);
|
||||||
digest->request.identifier = NULL;
|
digest->request.identifier = NULL;
|
||||||
return ENOMEM;
|
return krb5_enomem(context);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -473,16 +459,13 @@ krb5_digest_set_client_nonce(krb5_context context,
|
|||||||
}
|
}
|
||||||
digest->request.clientNonce =
|
digest->request.clientNonce =
|
||||||
calloc(1, sizeof(*digest->request.clientNonce));
|
calloc(1, sizeof(*digest->request.clientNonce));
|
||||||
if (digest->request.clientNonce == NULL) {
|
if (digest->request.clientNonce == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
return krb5_enomem(context);
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
*digest->request.clientNonce = strdup(nonce);
|
*digest->request.clientNonce = strdup(nonce);
|
||||||
if (*digest->request.clientNonce == NULL) {
|
if (*digest->request.clientNonce == NULL) {
|
||||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
|
||||||
free(digest->request.clientNonce);
|
free(digest->request.clientNonce);
|
||||||
digest->request.clientNonce = NULL;
|
digest->request.clientNonce = NULL;
|
||||||
return ENOMEM;
|
return krb5_enomem(context);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -498,10 +481,8 @@ krb5_digest_set_digest(krb5_context context,
|
|||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
digest->request.digest = strdup(dgst);
|
digest->request.digest = strdup(dgst);
|
||||||
if (digest->request.digest == NULL) {
|
if (digest->request.digest == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
return krb5_enomem(context);
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -515,10 +496,8 @@ krb5_digest_set_username(krb5_context context,
|
|||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
digest->request.username = strdup(username);
|
digest->request.username = strdup(username);
|
||||||
if (digest->request.username == NULL) {
|
if (digest->request.username == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
return krb5_enomem(context);
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -532,16 +511,13 @@ krb5_digest_set_authid(krb5_context context,
|
|||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
digest->request.authid = malloc(sizeof(*digest->request.authid));
|
digest->request.authid = malloc(sizeof(*digest->request.authid));
|
||||||
if (digest->request.authid == NULL) {
|
if (digest->request.authid == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
return krb5_enomem(context);
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
*digest->request.authid = strdup(authid);
|
*digest->request.authid = strdup(authid);
|
||||||
if (*digest->request.authid == NULL) {
|
if (*digest->request.authid == NULL) {
|
||||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
|
||||||
free(digest->request.authid);
|
free(digest->request.authid);
|
||||||
digest->request.authid = NULL;
|
digest->request.authid = NULL;
|
||||||
return ENOMEM;
|
return krb5_enomem(context);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -576,16 +552,13 @@ krb5_digest_set_realm(krb5_context context,
|
|||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
digest->request.realm = malloc(sizeof(*digest->request.realm));
|
digest->request.realm = malloc(sizeof(*digest->request.realm));
|
||||||
if (digest->request.realm == NULL) {
|
if (digest->request.realm == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
return krb5_enomem(context);
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
*digest->request.realm = strdup(realm);
|
*digest->request.realm = strdup(realm);
|
||||||
if (*digest->request.realm == NULL) {
|
if (*digest->request.realm == NULL) {
|
||||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
|
||||||
free(digest->request.realm);
|
free(digest->request.realm);
|
||||||
digest->request.realm = NULL;
|
digest->request.realm = NULL;
|
||||||
return ENOMEM;
|
return krb5_enomem(context);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -601,16 +574,13 @@ krb5_digest_set_method(krb5_context context,
|
|||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
digest->request.method = malloc(sizeof(*digest->request.method));
|
digest->request.method = malloc(sizeof(*digest->request.method));
|
||||||
if (digest->request.method == NULL) {
|
if (digest->request.method == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
return krb5_enomem(context);
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
*digest->request.method = strdup(method);
|
*digest->request.method = strdup(method);
|
||||||
if (*digest->request.method == NULL) {
|
if (*digest->request.method == NULL) {
|
||||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
|
||||||
free(digest->request.method);
|
free(digest->request.method);
|
||||||
digest->request.method = NULL;
|
digest->request.method = NULL;
|
||||||
return ENOMEM;
|
return krb5_enomem(context);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -625,16 +595,13 @@ krb5_digest_set_uri(krb5_context context,
|
|||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
digest->request.uri = malloc(sizeof(*digest->request.uri));
|
digest->request.uri = malloc(sizeof(*digest->request.uri));
|
||||||
if (digest->request.uri == NULL) {
|
if (digest->request.uri == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
return krb5_enomem(context);
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
*digest->request.uri = strdup(uri);
|
*digest->request.uri = strdup(uri);
|
||||||
if (*digest->request.uri == NULL) {
|
if (*digest->request.uri == NULL) {
|
||||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
|
||||||
free(digest->request.uri);
|
free(digest->request.uri);
|
||||||
digest->request.uri = NULL;
|
digest->request.uri = NULL;
|
||||||
return ENOMEM;
|
return krb5_enomem(context);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -651,16 +618,13 @@ krb5_digest_set_nonceCount(krb5_context context,
|
|||||||
}
|
}
|
||||||
digest->request.nonceCount =
|
digest->request.nonceCount =
|
||||||
malloc(sizeof(*digest->request.nonceCount));
|
malloc(sizeof(*digest->request.nonceCount));
|
||||||
if (digest->request.nonceCount == NULL) {
|
if (digest->request.nonceCount == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
return krb5_enomem(context);
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
*digest->request.nonceCount = strdup(nonce_count);
|
*digest->request.nonceCount = strdup(nonce_count);
|
||||||
if (*digest->request.nonceCount == NULL) {
|
if (*digest->request.nonceCount == NULL) {
|
||||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
|
||||||
free(digest->request.nonceCount);
|
free(digest->request.nonceCount);
|
||||||
digest->request.nonceCount = NULL;
|
digest->request.nonceCount = NULL;
|
||||||
return ENOMEM;
|
return krb5_enomem(context);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -675,16 +639,13 @@ krb5_digest_set_qop(krb5_context context,
|
|||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
digest->request.qop = malloc(sizeof(*digest->request.qop));
|
digest->request.qop = malloc(sizeof(*digest->request.qop));
|
||||||
if (digest->request.qop == NULL) {
|
if (digest->request.qop == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
return krb5_enomem(context);
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
*digest->request.qop = strdup(qop);
|
*digest->request.qop = strdup(qop);
|
||||||
if (*digest->request.qop == NULL) {
|
if (*digest->request.qop == NULL) {
|
||||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
|
||||||
free(digest->request.qop);
|
free(digest->request.qop);
|
||||||
digest->request.qop = NULL;
|
digest->request.qop = NULL;
|
||||||
return ENOMEM;
|
return krb5_enomem(context);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -695,10 +656,8 @@ krb5_digest_set_responseData(krb5_context context,
|
|||||||
const char *response)
|
const char *response)
|
||||||
{
|
{
|
||||||
digest->request.responseData = strdup(response);
|
digest->request.responseData = strdup(response);
|
||||||
if (digest->request.responseData == NULL) {
|
if (digest->request.responseData == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
return krb5_enomem(context);
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -803,8 +762,7 @@ krb5_digest_get_client_binding(krb5_context context,
|
|||||||
if (*type == NULL || *binding == NULL) {
|
if (*type == NULL || *binding == NULL) {
|
||||||
free(*type);
|
free(*type);
|
||||||
free(*binding);
|
free(*binding);
|
||||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
return krb5_enomem(context);
|
||||||
return ENOMEM;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
*type = NULL;
|
*type = NULL;
|
||||||
@@ -842,10 +800,8 @@ krb5_ntlm_alloc(krb5_context context,
|
|||||||
krb5_ntlm *ntlm)
|
krb5_ntlm *ntlm)
|
||||||
{
|
{
|
||||||
*ntlm = calloc(1, sizeof(**ntlm));
|
*ntlm = calloc(1, sizeof(**ntlm));
|
||||||
if (*ntlm == NULL) {
|
if (*ntlm == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
return krb5_enomem(context);
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -966,10 +922,8 @@ krb5_ntlm_init_get_targetname(krb5_context context,
|
|||||||
char **name)
|
char **name)
|
||||||
{
|
{
|
||||||
*name = strdup(ntlm->initReply.targetname);
|
*name = strdup(ntlm->initReply.targetname);
|
||||||
if (*name == NULL) {
|
if (*name == NULL)
|
||||||
krb5_clear_error_message(context);
|
return krb5_enomem(context);
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1060,10 +1014,8 @@ krb5_ntlm_req_set_username(krb5_context context,
|
|||||||
const char *username)
|
const char *username)
|
||||||
{
|
{
|
||||||
ntlm->request.username = strdup(username);
|
ntlm->request.username = strdup(username);
|
||||||
if (ntlm->request.username == NULL) {
|
if (ntlm->request.username == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
return krb5_enomem(context);
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1073,10 +1025,8 @@ krb5_ntlm_req_set_targetname(krb5_context context,
|
|||||||
const char *targetname)
|
const char *targetname)
|
||||||
{
|
{
|
||||||
ntlm->request.targetname = strdup(targetname);
|
ntlm->request.targetname = strdup(targetname);
|
||||||
if (ntlm->request.targetname == NULL) {
|
if (ntlm->request.targetname == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
return krb5_enomem(context);
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1086,10 +1036,8 @@ krb5_ntlm_req_set_lm(krb5_context context,
|
|||||||
void *hash, size_t len)
|
void *hash, size_t len)
|
||||||
{
|
{
|
||||||
ntlm->request.lm.data = malloc(len);
|
ntlm->request.lm.data = malloc(len);
|
||||||
if (ntlm->request.lm.data == NULL && len != 0) {
|
if (ntlm->request.lm.data == NULL && len != 0)
|
||||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
return krb5_enomem(context);
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
ntlm->request.lm.length = len;
|
ntlm->request.lm.length = len;
|
||||||
memcpy(ntlm->request.lm.data, hash, len);
|
memcpy(ntlm->request.lm.data, hash, len);
|
||||||
return 0;
|
return 0;
|
||||||
@@ -1101,10 +1049,8 @@ krb5_ntlm_req_set_ntlm(krb5_context context,
|
|||||||
void *hash, size_t len)
|
void *hash, size_t len)
|
||||||
{
|
{
|
||||||
ntlm->request.ntlm.data = malloc(len);
|
ntlm->request.ntlm.data = malloc(len);
|
||||||
if (ntlm->request.ntlm.data == NULL && len != 0) {
|
if (ntlm->request.ntlm.data == NULL && len != 0)
|
||||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
return krb5_enomem(context);
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
ntlm->request.ntlm.length = len;
|
ntlm->request.ntlm.length = len;
|
||||||
memcpy(ntlm->request.ntlm.data, hash, len);
|
memcpy(ntlm->request.ntlm.data, hash, len);
|
||||||
return 0;
|
return 0;
|
||||||
@@ -1116,10 +1062,8 @@ krb5_ntlm_req_set_opaque(krb5_context context,
|
|||||||
krb5_data *opaque)
|
krb5_data *opaque)
|
||||||
{
|
{
|
||||||
ntlm->request.opaque.data = malloc(opaque->length);
|
ntlm->request.opaque.data = malloc(opaque->length);
|
||||||
if (ntlm->request.opaque.data == NULL && opaque->length != 0) {
|
if (ntlm->request.opaque.data == NULL && opaque->length != 0)
|
||||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
return krb5_enomem(context);
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
ntlm->request.opaque.length = opaque->length;
|
ntlm->request.opaque.length = opaque->length;
|
||||||
memcpy(ntlm->request.opaque.data, opaque->data, opaque->length);
|
memcpy(ntlm->request.opaque.data, opaque->data, opaque->length);
|
||||||
return 0;
|
return 0;
|
||||||
@@ -1131,15 +1075,11 @@ krb5_ntlm_req_set_session(krb5_context context,
|
|||||||
void *sessionkey, size_t length)
|
void *sessionkey, size_t length)
|
||||||
{
|
{
|
||||||
ntlm->request.sessionkey = calloc(1, sizeof(*ntlm->request.sessionkey));
|
ntlm->request.sessionkey = calloc(1, sizeof(*ntlm->request.sessionkey));
|
||||||
if (ntlm->request.sessionkey == NULL) {
|
if (ntlm->request.sessionkey == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
return krb5_enomem(context);
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
ntlm->request.sessionkey->data = malloc(length);
|
ntlm->request.sessionkey->data = malloc(length);
|
||||||
if (ntlm->request.sessionkey->data == NULL && length != 0) {
|
if (ntlm->request.sessionkey->data == NULL && length != 0)
|
||||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
return krb5_enomem(context);
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
memcpy(ntlm->request.sessionkey->data, sessionkey, length);
|
memcpy(ntlm->request.sessionkey->data, sessionkey, length);
|
||||||
ntlm->request.sessionkey->length = length;
|
ntlm->request.sessionkey->length = length;
|
||||||
return 0;
|
return 0;
|
||||||
|
@@ -39,11 +39,8 @@ copy_hostname(krb5_context context,
|
|||||||
char **new_hostname)
|
char **new_hostname)
|
||||||
{
|
{
|
||||||
*new_hostname = strdup (orig_hostname);
|
*new_hostname = strdup (orig_hostname);
|
||||||
if (*new_hostname == NULL) {
|
if (*new_hostname == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM,
|
return krb5_enomem(context);
|
||||||
N_("malloc: out of memory", ""));
|
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
strlwr (*new_hostname);
|
strlwr (*new_hostname);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -84,13 +81,10 @@ krb5_expand_hostname (krb5_context context,
|
|||||||
if (a->ai_canonname != NULL) {
|
if (a->ai_canonname != NULL) {
|
||||||
*new_hostname = strdup (a->ai_canonname);
|
*new_hostname = strdup (a->ai_canonname);
|
||||||
freeaddrinfo (ai);
|
freeaddrinfo (ai);
|
||||||
if (*new_hostname == NULL) {
|
if (*new_hostname == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM,
|
return krb5_enomem(context);
|
||||||
N_("malloc: out of memory", ""));
|
else
|
||||||
return ENOMEM;
|
|
||||||
} else {
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
freeaddrinfo (ai);
|
freeaddrinfo (ai);
|
||||||
|
@@ -555,8 +555,7 @@ init_fcc (krb5_context context,
|
|||||||
|
|
||||||
sp = krb5_storage_from_fd(fd);
|
sp = krb5_storage_from_fd(fd);
|
||||||
if(sp == NULL) {
|
if(sp == NULL) {
|
||||||
krb5_clear_error_message(context);
|
ret = krb5_enomem(context);
|
||||||
ret = ENOMEM;
|
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
krb5_storage_set_eof_code(sp, KRB5_CC_END);
|
krb5_storage_set_eof_code(sp, KRB5_CC_END);
|
||||||
@@ -722,10 +721,8 @@ fcc_get_first (krb5_context context,
|
|||||||
return krb5_einval(context, 2);
|
return krb5_einval(context, 2);
|
||||||
|
|
||||||
*cursor = malloc(sizeof(struct fcc_cursor));
|
*cursor = malloc(sizeof(struct fcc_cursor));
|
||||||
if (*cursor == NULL) {
|
if (*cursor == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
return krb5_enomem(context);
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
memset(*cursor, 0, sizeof(struct fcc_cursor));
|
memset(*cursor, 0, sizeof(struct fcc_cursor));
|
||||||
|
|
||||||
ret = init_fcc (context, id, &FCC_CURSOR(*cursor)->sp,
|
ret = init_fcc (context, id, &FCC_CURSOR(*cursor)->sp,
|
||||||
@@ -823,7 +820,7 @@ fcc_remove_cred(krb5_context context,
|
|||||||
ret = asprintf(&newname, "FILE:%s.XXXXXX", FILENAME(id));
|
ret = asprintf(&newname, "FILE:%s.XXXXXX", FILENAME(id));
|
||||||
if (ret < 0 || newname == NULL) {
|
if (ret < 0 || newname == NULL) {
|
||||||
krb5_cc_destroy(context, copy);
|
krb5_cc_destroy(context, copy);
|
||||||
return ENOMEM;
|
return krb5_enomem(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
fd = mkstemp(&newname[5]);
|
fd = mkstemp(&newname[5]);
|
||||||
@@ -890,10 +887,8 @@ fcc_get_cache_first(krb5_context context, krb5_cc_cursor *cursor)
|
|||||||
struct fcache_iter *iter;
|
struct fcache_iter *iter;
|
||||||
|
|
||||||
iter = calloc(1, sizeof(*iter));
|
iter = calloc(1, sizeof(*iter));
|
||||||
if (iter == NULL) {
|
if (iter == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
return krb5_enomem(context);
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
iter->first = 1;
|
iter->first = 1;
|
||||||
*cursor = iter;
|
*cursor = iter;
|
||||||
return 0;
|
return 0;
|
||||||
|
@@ -55,10 +55,8 @@ krb5_generate_subkey_extended(krb5_context context,
|
|||||||
krb5_error_code ret;
|
krb5_error_code ret;
|
||||||
|
|
||||||
ALLOC(*subkey, 1);
|
ALLOC(*subkey, 1);
|
||||||
if (*subkey == NULL) {
|
if (*subkey == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM,N_("malloc: out of memory", ""));
|
return krb5_enomem(context);
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (etype == (krb5_enctype)ETYPE_NULL)
|
if (etype == (krb5_enctype)ETYPE_NULL)
|
||||||
etype = key->keytype; /* use session key etype */
|
etype = key->keytype; /* use session key etype */
|
||||||
|
@@ -64,10 +64,8 @@ gethostname_fallback (krb5_context context, krb5_addresses *res)
|
|||||||
}
|
}
|
||||||
res->len = 1;
|
res->len = 1;
|
||||||
res->val = malloc (sizeof(*res->val));
|
res->val = malloc (sizeof(*res->val));
|
||||||
if (res->val == NULL) {
|
if (res->val == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
return krb5_enomem(context);
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
res->val[0].addr_type = hostent->h_addrtype;
|
res->val[0].addr_type = hostent->h_addrtype;
|
||||||
res->val[0].address.data = NULL;
|
res->val[0].address.data = NULL;
|
||||||
res->val[0].address.length = 0;
|
res->val[0].address.length = 0;
|
||||||
@@ -132,8 +130,7 @@ find_all_addresses (krb5_context context, krb5_addresses *res, int flags)
|
|||||||
if (res->val == NULL) {
|
if (res->val == NULL) {
|
||||||
krb5_free_addresses(context, &ignore_addresses);
|
krb5_free_addresses(context, &ignore_addresses);
|
||||||
freeifaddrs(ifa0);
|
freeifaddrs(ifa0);
|
||||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
return krb5_enomem(context);
|
||||||
return ENOMEM;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Now traverse the list. */
|
/* Now traverse the list. */
|
||||||
|
@@ -73,11 +73,8 @@ krb5_get_default_realm(krb5_context context,
|
|||||||
}
|
}
|
||||||
|
|
||||||
res = strdup (context->default_realms[0]);
|
res = strdup (context->default_realms[0]);
|
||||||
if (res == NULL) {
|
if (res == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM,
|
return krb5_enomem(context);
|
||||||
N_("malloc: out of memory", ""));
|
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
*realm = res;
|
*realm = res;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@@ -49,8 +49,7 @@ add_addrs(krb5_context context,
|
|||||||
|
|
||||||
tmp = realloc(addr->val, (addr->len + n) * sizeof(*addr->val));
|
tmp = realloc(addr->val, (addr->len + n) * sizeof(*addr->val));
|
||||||
if (tmp == NULL && (addr->len + n) != 0) {
|
if (tmp == NULL && (addr->len + n) != 0) {
|
||||||
ret = ENOMEM;
|
ret = krb5_enomem(context);
|
||||||
krb5_set_error_message(context, ret, N_("malloc: out of memory", ""));
|
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
addr->val = tmp;
|
addr->val = tmp;
|
||||||
@@ -266,8 +265,7 @@ krb5_get_forwarded_creds (krb5_context context,
|
|||||||
cred.msg_type = krb_cred;
|
cred.msg_type = krb_cred;
|
||||||
ALLOC_SEQ(&cred.tickets, 1);
|
ALLOC_SEQ(&cred.tickets, 1);
|
||||||
if (cred.tickets.val == NULL) {
|
if (cred.tickets.val == NULL) {
|
||||||
ret = ENOMEM;
|
ret = krb5_enomem(context);
|
||||||
krb5_set_error_message(context, ret, N_("malloc: out of memory", ""));
|
|
||||||
goto out2;
|
goto out2;
|
||||||
}
|
}
|
||||||
ret = decode_Ticket(out_creds->ticket.data,
|
ret = decode_Ticket(out_creds->ticket.data,
|
||||||
@@ -279,8 +277,7 @@ krb5_get_forwarded_creds (krb5_context context,
|
|||||||
memset (&enc_krb_cred_part, 0, sizeof(enc_krb_cred_part));
|
memset (&enc_krb_cred_part, 0, sizeof(enc_krb_cred_part));
|
||||||
ALLOC_SEQ(&enc_krb_cred_part.ticket_info, 1);
|
ALLOC_SEQ(&enc_krb_cred_part.ticket_info, 1);
|
||||||
if (enc_krb_cred_part.ticket_info.val == NULL) {
|
if (enc_krb_cred_part.ticket_info.val == NULL) {
|
||||||
ret = ENOMEM;
|
ret = krb5_enomem(context);
|
||||||
krb5_set_error_message(context, ret, N_("malloc: out of memory", ""));
|
|
||||||
goto out4;
|
goto out4;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -292,15 +289,13 @@ krb5_get_forwarded_creds (krb5_context context,
|
|||||||
|
|
||||||
ALLOC(enc_krb_cred_part.timestamp, 1);
|
ALLOC(enc_krb_cred_part.timestamp, 1);
|
||||||
if (enc_krb_cred_part.timestamp == NULL) {
|
if (enc_krb_cred_part.timestamp == NULL) {
|
||||||
ret = ENOMEM;
|
ret = krb5_enomem(context);
|
||||||
krb5_set_error_message(context, ret, N_("malloc: out of memory", ""));
|
|
||||||
goto out4;
|
goto out4;
|
||||||
}
|
}
|
||||||
*enc_krb_cred_part.timestamp = sec;
|
*enc_krb_cred_part.timestamp = sec;
|
||||||
ALLOC(enc_krb_cred_part.usec, 1);
|
ALLOC(enc_krb_cred_part.usec, 1);
|
||||||
if (enc_krb_cred_part.usec == NULL) {
|
if (enc_krb_cred_part.usec == NULL) {
|
||||||
ret = ENOMEM;
|
ret = krb5_enomem(context);
|
||||||
krb5_set_error_message(context, ret, N_("malloc: out of memory", ""));
|
|
||||||
goto out4;
|
goto out4;
|
||||||
}
|
}
|
||||||
*enc_krb_cred_part.usec = usec;
|
*enc_krb_cred_part.usec = usec;
|
||||||
@@ -343,9 +338,7 @@ krb5_get_forwarded_creds (krb5_context context,
|
|||||||
} else {
|
} else {
|
||||||
ALLOC(enc_krb_cred_part.r_address, 1);
|
ALLOC(enc_krb_cred_part.r_address, 1);
|
||||||
if (enc_krb_cred_part.r_address == NULL) {
|
if (enc_krb_cred_part.r_address == NULL) {
|
||||||
ret = ENOMEM;
|
ret = krb5_enomem(context);
|
||||||
krb5_set_error_message(context, ret,
|
|
||||||
N_("malloc: out of memory", ""));
|
|
||||||
goto out4;
|
goto out4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -189,16 +189,13 @@ _krb5_get_host_realm_int (krb5_context context,
|
|||||||
if(p != NULL) {
|
if(p != NULL) {
|
||||||
p++;
|
p++;
|
||||||
*realms = malloc(2 * sizeof(krb5_realm));
|
*realms = malloc(2 * sizeof(krb5_realm));
|
||||||
if (*realms == NULL) {
|
if (*realms == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
return krb5_enomem(context);
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
|
|
||||||
(*realms)[0] = strdup(p);
|
(*realms)[0] = strdup(p);
|
||||||
if((*realms)[0] == NULL) {
|
if((*realms)[0] == NULL) {
|
||||||
free(*realms);
|
free(*realms);
|
||||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
return krb5_enomem(context);
|
||||||
return ENOMEM;
|
|
||||||
}
|
}
|
||||||
strupr((*realms)[0]);
|
strupr((*realms)[0]);
|
||||||
(*realms)[1] = NULL;
|
(*realms)[1] = NULL;
|
||||||
|
@@ -119,10 +119,8 @@ add_padata(krb5_context context,
|
|||||||
netypes++;
|
netypes++;
|
||||||
}
|
}
|
||||||
pa2 = realloc (md->val, (md->len + netypes) * sizeof(*md->val));
|
pa2 = realloc (md->val, (md->len + netypes) * sizeof(*md->val));
|
||||||
if (pa2 == NULL) {
|
if (pa2 == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
return krb5_enomem(context);
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
md->val = pa2;
|
md->val = pa2;
|
||||||
|
|
||||||
for (i = 0; i < netypes; ++i) {
|
for (i = 0; i < netypes; ++i) {
|
||||||
@@ -166,14 +164,12 @@ init_as_req (krb5_context context,
|
|||||||
a->req_body.kdc_options = opts;
|
a->req_body.kdc_options = opts;
|
||||||
a->req_body.cname = malloc(sizeof(*a->req_body.cname));
|
a->req_body.cname = malloc(sizeof(*a->req_body.cname));
|
||||||
if (a->req_body.cname == NULL) {
|
if (a->req_body.cname == NULL) {
|
||||||
ret = ENOMEM;
|
ret = krb5_enomem(context);
|
||||||
krb5_set_error_message(context, ret, N_("malloc: out of memory", ""));
|
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
a->req_body.sname = malloc(sizeof(*a->req_body.sname));
|
a->req_body.sname = malloc(sizeof(*a->req_body.sname));
|
||||||
if (a->req_body.sname == NULL) {
|
if (a->req_body.sname == NULL) {
|
||||||
ret = ENOMEM;
|
ret = krb5_enomem(context);
|
||||||
krb5_set_error_message(context, ret, N_("malloc: out of memory", ""));
|
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
ret = _krb5_principal2principalname (a->req_body.cname, creds->client);
|
ret = _krb5_principal2principalname (a->req_body.cname, creds->client);
|
||||||
@@ -189,8 +185,7 @@ init_as_req (krb5_context context,
|
|||||||
if(creds->times.starttime) {
|
if(creds->times.starttime) {
|
||||||
a->req_body.from = malloc(sizeof(*a->req_body.from));
|
a->req_body.from = malloc(sizeof(*a->req_body.from));
|
||||||
if (a->req_body.from == NULL) {
|
if (a->req_body.from == NULL) {
|
||||||
ret = ENOMEM;
|
ret = krb5_enomem(context);
|
||||||
krb5_set_error_message(context, ret, N_("malloc: out of memory", ""));
|
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
*a->req_body.from = creds->times.starttime;
|
*a->req_body.from = creds->times.starttime;
|
||||||
@@ -202,8 +197,7 @@ init_as_req (krb5_context context,
|
|||||||
if(creds->times.renew_till){
|
if(creds->times.renew_till){
|
||||||
a->req_body.rtime = malloc(sizeof(*a->req_body.rtime));
|
a->req_body.rtime = malloc(sizeof(*a->req_body.rtime));
|
||||||
if (a->req_body.rtime == NULL) {
|
if (a->req_body.rtime == NULL) {
|
||||||
ret = ENOMEM;
|
ret = krb5_enomem(context);
|
||||||
krb5_set_error_message(context, ret, N_("malloc: out of memory", ""));
|
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
*a->req_body.rtime = creds->times.renew_till;
|
*a->req_body.rtime = creds->times.renew_till;
|
||||||
@@ -226,8 +220,7 @@ init_as_req (krb5_context context,
|
|||||||
} else {
|
} else {
|
||||||
a->req_body.addresses = malloc(sizeof(*a->req_body.addresses));
|
a->req_body.addresses = malloc(sizeof(*a->req_body.addresses));
|
||||||
if (a->req_body.addresses == NULL) {
|
if (a->req_body.addresses == NULL) {
|
||||||
ret = ENOMEM;
|
ret = krb5_enomem(context);
|
||||||
krb5_set_error_message(context, ret, N_("malloc: out of memory", ""));
|
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -251,8 +244,7 @@ init_as_req (krb5_context context,
|
|||||||
size_t i;
|
size_t i;
|
||||||
ALLOC(a->padata, 1);
|
ALLOC(a->padata, 1);
|
||||||
if(a->padata == NULL) {
|
if(a->padata == NULL) {
|
||||||
ret = ENOMEM;
|
ret = krb5_enomem(context);
|
||||||
krb5_set_error_message(context, ret, N_("malloc: out of memory", ""));
|
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
a->padata->val = NULL;
|
a->padata->val = NULL;
|
||||||
@@ -290,8 +282,7 @@ init_as_req (krb5_context context,
|
|||||||
else if (*ptypes == KRB5_PADATA_ENC_TIMESTAMP) {
|
else if (*ptypes == KRB5_PADATA_ENC_TIMESTAMP) {
|
||||||
ALLOC(a->padata, 1);
|
ALLOC(a->padata, 1);
|
||||||
if (a->padata == NULL) {
|
if (a->padata == NULL) {
|
||||||
ret = ENOMEM;
|
ret = krb5_enomem(context);
|
||||||
krb5_set_error_message(context, ret, N_("malloc: out of memory", ""));
|
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
a->padata->len = 0;
|
a->padata->len = 0;
|
||||||
|
@@ -60,18 +60,13 @@ krb5_get_init_creds_opt_alloc(krb5_context context,
|
|||||||
|
|
||||||
*opt = NULL;
|
*opt = NULL;
|
||||||
o = calloc(1, sizeof(*o));
|
o = calloc(1, sizeof(*o));
|
||||||
if (o == NULL) {
|
if (o == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM,
|
return krb5_enomem(context);
|
||||||
N_("malloc: out of memory", ""));
|
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
|
|
||||||
o->opt_private = calloc(1, sizeof(*o->opt_private));
|
o->opt_private = calloc(1, sizeof(*o->opt_private));
|
||||||
if (o->opt_private == NULL) {
|
if (o->opt_private == NULL) {
|
||||||
krb5_set_error_message(context, ENOMEM,
|
|
||||||
N_("malloc: out of memory", ""));
|
|
||||||
free(o);
|
free(o);
|
||||||
return ENOMEM;
|
return krb5_enomem(context);
|
||||||
}
|
}
|
||||||
o->opt_private->refcount = 1;
|
o->opt_private->refcount = 1;
|
||||||
*opt = o;
|
*opt = o;
|
||||||
@@ -423,10 +418,8 @@ krb5_get_init_creds_opt_get_error(krb5_context context,
|
|||||||
KRB5_DEPRECATED_FUNCTION("Use X instead")
|
KRB5_DEPRECATED_FUNCTION("Use X instead")
|
||||||
{
|
{
|
||||||
*error = calloc(1, sizeof(**error));
|
*error = calloc(1, sizeof(**error));
|
||||||
if (*error == NULL) {
|
if (*error == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
return krb5_enomem(context);
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@@ -298,11 +298,8 @@ krb5_process_last_request(krb5_context context,
|
|||||||
krb5_last_req_entry **lre;
|
krb5_last_req_entry **lre;
|
||||||
|
|
||||||
lre = calloc(lr->len + 1, sizeof(**lre));
|
lre = calloc(lr->len + 1, sizeof(**lre));
|
||||||
if (lre == NULL) {
|
if (lre == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM,
|
return krb5_enomem(context);
|
||||||
N_("malloc: out of memory", ""));
|
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
for (i = 0; i < lr->len; i++) {
|
for (i = 0; i < lr->len; i++) {
|
||||||
lre[i] = calloc(1, sizeof(*lre[i]));
|
lre[i] = calloc(1, sizeof(*lre[i]));
|
||||||
if (lre[i] == NULL)
|
if (lre[i] == NULL)
|
||||||
@@ -464,8 +461,7 @@ get_init_creds_common(krb5_context context,
|
|||||||
etypes = malloc((options->etype_list_length + 1)
|
etypes = malloc((options->etype_list_length + 1)
|
||||||
* sizeof(krb5_enctype));
|
* sizeof(krb5_enctype));
|
||||||
if (etypes == NULL) {
|
if (etypes == NULL) {
|
||||||
ret = ENOMEM;
|
ret = krb5_enomem(context);
|
||||||
krb5_set_error_message(context, ret, N_("malloc: out of memory", ""));
|
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
memcpy (etypes, options->etype_list,
|
memcpy (etypes, options->etype_list,
|
||||||
@@ -477,8 +473,7 @@ get_init_creds_common(krb5_context context,
|
|||||||
pre_auth_types = malloc((options->preauth_list_length + 1)
|
pre_auth_types = malloc((options->preauth_list_length + 1)
|
||||||
* sizeof(krb5_preauthtype));
|
* sizeof(krb5_preauthtype));
|
||||||
if (pre_auth_types == NULL) {
|
if (pre_auth_types == NULL) {
|
||||||
ret = ENOMEM;
|
ret = krb5_enomem(context);
|
||||||
krb5_set_error_message(context, ret, N_("malloc: out of memory", ""));
|
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
memcpy (pre_auth_types, options->preauth_list,
|
memcpy (pre_auth_types, options->preauth_list,
|
||||||
@@ -650,14 +645,12 @@ init_as_req (krb5_context context,
|
|||||||
a->req_body.kdc_options = opts;
|
a->req_body.kdc_options = opts;
|
||||||
a->req_body.cname = malloc(sizeof(*a->req_body.cname));
|
a->req_body.cname = malloc(sizeof(*a->req_body.cname));
|
||||||
if (a->req_body.cname == NULL) {
|
if (a->req_body.cname == NULL) {
|
||||||
ret = ENOMEM;
|
ret = krb5_enomem(context);
|
||||||
krb5_set_error_message(context, ret, N_("malloc: out of memory", ""));
|
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
a->req_body.sname = malloc(sizeof(*a->req_body.sname));
|
a->req_body.sname = malloc(sizeof(*a->req_body.sname));
|
||||||
if (a->req_body.sname == NULL) {
|
if (a->req_body.sname == NULL) {
|
||||||
ret = ENOMEM;
|
ret = krb5_enomem(context);
|
||||||
krb5_set_error_message(context, ret, N_("malloc: out of memory", ""));
|
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -675,8 +668,7 @@ init_as_req (krb5_context context,
|
|||||||
if(creds->times.starttime) {
|
if(creds->times.starttime) {
|
||||||
a->req_body.from = malloc(sizeof(*a->req_body.from));
|
a->req_body.from = malloc(sizeof(*a->req_body.from));
|
||||||
if (a->req_body.from == NULL) {
|
if (a->req_body.from == NULL) {
|
||||||
ret = ENOMEM;
|
ret = krb5_enomem(context);
|
||||||
krb5_set_error_message(context, ret, N_("malloc: out of memory", ""));
|
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
*a->req_body.from = creds->times.starttime;
|
*a->req_body.from = creds->times.starttime;
|
||||||
@@ -688,8 +680,7 @@ init_as_req (krb5_context context,
|
|||||||
if(creds->times.renew_till){
|
if(creds->times.renew_till){
|
||||||
a->req_body.rtime = malloc(sizeof(*a->req_body.rtime));
|
a->req_body.rtime = malloc(sizeof(*a->req_body.rtime));
|
||||||
if (a->req_body.rtime == NULL) {
|
if (a->req_body.rtime == NULL) {
|
||||||
ret = ENOMEM;
|
ret = krb5_enomem(context);
|
||||||
krb5_set_error_message(context, ret, N_("malloc: out of memory", ""));
|
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
*a->req_body.rtime = creds->times.renew_till;
|
*a->req_body.rtime = creds->times.renew_till;
|
||||||
@@ -712,8 +703,7 @@ init_as_req (krb5_context context,
|
|||||||
} else {
|
} else {
|
||||||
a->req_body.addresses = malloc(sizeof(*a->req_body.addresses));
|
a->req_body.addresses = malloc(sizeof(*a->req_body.addresses));
|
||||||
if (a->req_body.addresses == NULL) {
|
if (a->req_body.addresses == NULL) {
|
||||||
ret = ENOMEM;
|
ret = krb5_enomem(context);
|
||||||
krb5_set_error_message(context, ret, N_("malloc: out of memory", ""));
|
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1180,10 +1170,9 @@ process_pa_data_to_md(krb5_context context,
|
|||||||
krb5_error_code ret;
|
krb5_error_code ret;
|
||||||
|
|
||||||
ALLOC(*out_md, 1);
|
ALLOC(*out_md, 1);
|
||||||
if (*out_md == NULL) {
|
if (*out_md == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
return krb5_enomem(context);
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
(*out_md)->len = 0;
|
(*out_md)->len = 0;
|
||||||
(*out_md)->val = NULL;
|
(*out_md)->val = NULL;
|
||||||
|
|
||||||
@@ -1387,10 +1376,8 @@ krb5_init_creds_init(krb5_context context,
|
|||||||
*rctx = NULL;
|
*rctx = NULL;
|
||||||
|
|
||||||
ctx = calloc(1, sizeof(*ctx));
|
ctx = calloc(1, sizeof(*ctx));
|
||||||
if (ctx == NULL) {
|
if (ctx == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
return krb5_enomem(context);
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = get_init_creds_common(context, client, start_time, options, ctx);
|
ret = get_init_creds_common(context, client, start_time, options, ctx);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
@@ -1488,10 +1475,8 @@ krb5_init_creds_set_password(krb5_context context,
|
|||||||
}
|
}
|
||||||
if (password) {
|
if (password) {
|
||||||
ctx->password = strdup(password);
|
ctx->password = strdup(password);
|
||||||
if (ctx->password == NULL) {
|
if (ctx->password == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
return krb5_enomem(context);
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
ctx->keyseed = (void *) ctx->password;
|
ctx->keyseed = (void *) ctx->password;
|
||||||
} else {
|
} else {
|
||||||
ctx->keyseed = NULL;
|
ctx->keyseed = NULL;
|
||||||
@@ -1559,11 +1544,8 @@ krb5_init_creds_set_keytab(krb5_context context,
|
|||||||
int kvno = 0, found = 0;
|
int kvno = 0, found = 0;
|
||||||
|
|
||||||
a = malloc(sizeof(*a));
|
a = malloc(sizeof(*a));
|
||||||
if (a == NULL) {
|
if (a == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM,
|
return krb5_enomem(context);
|
||||||
N_("malloc: out of memory", ""));
|
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
|
|
||||||
a->principal = ctx->cred.client;
|
a->principal = ctx->cred.client;
|
||||||
a->keytab = keytab;
|
a->keytab = keytab;
|
||||||
@@ -2328,7 +2310,7 @@ krb5_init_creds_get_error(krb5_context context,
|
|||||||
|
|
||||||
ret = copy_KRB_ERROR(&ctx->error, error);
|
ret = copy_KRB_ERROR(&ctx->error, error);
|
||||||
if (ret)
|
if (ret)
|
||||||
krb5_set_error_message(context, ret, N_("malloc: out of memory", ""));
|
krb5_enomem(context);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@@ -553,9 +553,7 @@ kcm_get_first (krb5_context context,
|
|||||||
|
|
||||||
c = calloc(1, sizeof(*c));
|
c = calloc(1, sizeof(*c));
|
||||||
if (c == NULL) {
|
if (c == NULL) {
|
||||||
ret = ENOMEM;
|
ret = krb5_enomem(context);
|
||||||
krb5_set_error_message(context, ret,
|
|
||||||
N_("malloc: out of memory", ""));
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -577,9 +575,7 @@ kcm_get_first (krb5_context context,
|
|||||||
if (ptr == NULL) {
|
if (ptr == NULL) {
|
||||||
free(c->uuids);
|
free(c->uuids);
|
||||||
free(c);
|
free(c);
|
||||||
krb5_set_error_message(context, ENOMEM,
|
return krb5_enomem(context);
|
||||||
N_("malloc: out of memory", ""));
|
|
||||||
return ENOMEM;
|
|
||||||
}
|
}
|
||||||
c->uuids = ptr;
|
c->uuids = ptr;
|
||||||
|
|
||||||
@@ -788,9 +784,7 @@ kcm_get_cache_first(krb5_context context, krb5_cc_cursor *cursor)
|
|||||||
|
|
||||||
c = calloc(1, sizeof(*c));
|
c = calloc(1, sizeof(*c));
|
||||||
if (c == NULL) {
|
if (c == NULL) {
|
||||||
ret = ENOMEM;
|
ret = krb5_enomem(context);
|
||||||
krb5_set_error_message(context, ret,
|
|
||||||
N_("malloc: out of memory", ""));
|
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -819,9 +813,7 @@ kcm_get_cache_first(krb5_context context, krb5_cc_cursor *cursor)
|
|||||||
|
|
||||||
ptr = realloc(c->uuids, sizeof(c->uuids[0]) * (c->length + 1));
|
ptr = realloc(c->uuids, sizeof(c->uuids[0]) * (c->length + 1));
|
||||||
if (ptr == NULL) {
|
if (ptr == NULL) {
|
||||||
ret = ENOMEM;
|
ret = krb5_enomem(context);
|
||||||
krb5_set_error_message(context, ret,
|
|
||||||
N_("malloc: out of memory", ""));
|
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
c->uuids = ptr;
|
c->uuids = ptr;
|
||||||
|
@@ -135,10 +135,8 @@ krb5_copy_keyblock (krb5_context context,
|
|||||||
*to = NULL;
|
*to = NULL;
|
||||||
|
|
||||||
k = calloc (1, sizeof(*k));
|
k = calloc (1, sizeof(*k));
|
||||||
if (k == NULL) {
|
if (k == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM, "malloc: out of memory");
|
return krb5_enomem(context);
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = krb5_copy_keyblock_contents (context, inblock, k);
|
ret = krb5_copy_keyblock_contents (context, inblock, k);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
|
@@ -63,15 +63,14 @@ any_resolve(krb5_context context, const char *name, krb5_keytab id)
|
|||||||
while (strsep_copy(&name, ",", buf, sizeof(buf)) != -1) {
|
while (strsep_copy(&name, ",", buf, sizeof(buf)) != -1) {
|
||||||
a = calloc(1, sizeof(*a));
|
a = calloc(1, sizeof(*a));
|
||||||
if (a == NULL) {
|
if (a == NULL) {
|
||||||
ret = ENOMEM;
|
ret = krb5_enomem(context);
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
if (a0 == NULL) {
|
if (a0 == NULL) {
|
||||||
a0 = a;
|
a0 = a;
|
||||||
a->name = strdup(buf);
|
a->name = strdup(buf);
|
||||||
if (a->name == NULL) {
|
if (a->name == NULL) {
|
||||||
ret = ENOMEM;
|
ret = krb5_enomem(context);
|
||||||
krb5_set_error_message(context, ret, N_("malloc: out of memory", ""));
|
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
@@ -131,10 +130,8 @@ any_start_seq_get(krb5_context context,
|
|||||||
krb5_error_code ret;
|
krb5_error_code ret;
|
||||||
|
|
||||||
c->data = malloc (sizeof(struct any_cursor_extra_data));
|
c->data = malloc (sizeof(struct any_cursor_extra_data));
|
||||||
if(c->data == NULL){
|
if(c->data == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
return krb5_enomem(context);
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
ed = (struct any_cursor_extra_data *)c->data;
|
ed = (struct any_cursor_extra_data *)c->data;
|
||||||
for (ed->a = a; ed->a != NULL; ed->a = ed->a->next) {
|
for (ed->a = a; ed->a != NULL; ed->a = ed->a->next) {
|
||||||
ret = krb5_kt_start_seq_get(context, ed->a->kt, &ed->cursor);
|
ret = krb5_kt_start_seq_get(context, ed->a->kt, &ed->cursor);
|
||||||
|
@@ -59,10 +59,8 @@ krb5_kt_ret_data(krb5_context context,
|
|||||||
return ret;
|
return ret;
|
||||||
data->length = size;
|
data->length = size;
|
||||||
data->data = malloc(size);
|
data->data = malloc(size);
|
||||||
if (data->data == NULL) {
|
if (data->data == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
return krb5_enomem(context);
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
ret = krb5_storage_read(sp, data->data, size);
|
ret = krb5_storage_read(sp, data->data, size);
|
||||||
if(ret != size)
|
if(ret != size)
|
||||||
return (ret < 0)? errno : KRB5_KT_END;
|
return (ret < 0)? errno : KRB5_KT_END;
|
||||||
@@ -80,10 +78,8 @@ krb5_kt_ret_string(krb5_context context,
|
|||||||
if(ret)
|
if(ret)
|
||||||
return ret;
|
return ret;
|
||||||
*data = malloc(size + 1);
|
*data = malloc(size + 1);
|
||||||
if (*data == NULL) {
|
if (*data == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
return krb5_enomem(context);
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
ret = krb5_storage_read(sp, *data, size);
|
ret = krb5_storage_read(sp, *data, size);
|
||||||
(*data)[size] = '\0';
|
(*data)[size] = '\0';
|
||||||
if(ret != size)
|
if(ret != size)
|
||||||
@@ -188,11 +184,8 @@ krb5_kt_ret_principal(krb5_context context,
|
|||||||
int16_t len;
|
int16_t len;
|
||||||
|
|
||||||
ALLOC(p, 1);
|
ALLOC(p, 1);
|
||||||
if(p == NULL) {
|
if(p == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM,
|
return krb5_enomem(context);
|
||||||
N_("malloc: out of memory", ""));
|
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = krb5_ret_int16(sp, &len);
|
ret = krb5_ret_int16(sp, &len);
|
||||||
if(ret) {
|
if(ret) {
|
||||||
@@ -221,8 +214,7 @@ krb5_kt_ret_principal(krb5_context context,
|
|||||||
}
|
}
|
||||||
p->name.name_string.val = calloc(len, sizeof(*p->name.name_string.val));
|
p->name.name_string.val = calloc(len, sizeof(*p->name.name_string.val));
|
||||||
if(p->name.name_string.val == NULL) {
|
if(p->name.name_string.val == NULL) {
|
||||||
ret = ENOMEM;
|
ret = krb5_enomem(context);
|
||||||
krb5_set_error_message(context, ret, N_("malloc: out of memory", ""));
|
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
p->name.name_string.len = len;
|
p->name.name_string.len = len;
|
||||||
@@ -292,15 +284,12 @@ fkt_resolve(krb5_context context, const char *name, krb5_keytab id)
|
|||||||
struct fkt_data *d;
|
struct fkt_data *d;
|
||||||
|
|
||||||
d = malloc(sizeof(*d));
|
d = malloc(sizeof(*d));
|
||||||
if(d == NULL) {
|
if(d == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
return krb5_enomem(context);
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
d->filename = strdup(name);
|
d->filename = strdup(name);
|
||||||
if(d->filename == NULL) {
|
if(d->filename == NULL) {
|
||||||
free(d);
|
free(d);
|
||||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
return krb5_enomem(context);
|
||||||
return ENOMEM;
|
|
||||||
}
|
}
|
||||||
d->flags = 0;
|
d->flags = 0;
|
||||||
id->data = d;
|
id->data = d;
|
||||||
@@ -397,9 +386,7 @@ fkt_start_seq_get_int(krb5_context context,
|
|||||||
if (c->sp == NULL) {
|
if (c->sp == NULL) {
|
||||||
_krb5_xunlock(context, c->fd);
|
_krb5_xunlock(context, c->fd);
|
||||||
close(c->fd);
|
close(c->fd);
|
||||||
krb5_set_error_message(context, ENOMEM,
|
return krb5_enomem(context);
|
||||||
N_("malloc: out of memory", ""));
|
|
||||||
return ENOMEM;
|
|
||||||
}
|
}
|
||||||
krb5_storage_set_eof_code(c->sp, KRB5_KT_END);
|
krb5_storage_set_eof_code(c->sp, KRB5_KT_END);
|
||||||
ret = krb5_ret_int8(c->sp, &pvno);
|
ret = krb5_ret_int8(c->sp, &pvno);
|
||||||
@@ -622,9 +609,7 @@ fkt_add_entry(krb5_context context,
|
|||||||
krb5_storage *emem;
|
krb5_storage *emem;
|
||||||
emem = krb5_storage_emem();
|
emem = krb5_storage_emem();
|
||||||
if(emem == NULL) {
|
if(emem == NULL) {
|
||||||
ret = ENOMEM;
|
ret = krb5_enomem(context);
|
||||||
krb5_set_error_message(context, ret,
|
|
||||||
N_("malloc: out of memory", ""));
|
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
ret = krb5_kt_store_principal(context, emem, entry->principal);
|
ret = krb5_kt_store_principal(context, emem, entry->principal);
|
||||||
|
@@ -89,11 +89,8 @@ get_cell_and_realm (krb5_context context, struct akf_data *d)
|
|||||||
fclose(f);
|
fclose(f);
|
||||||
|
|
||||||
d->cell = strdup (buf);
|
d->cell = strdup (buf);
|
||||||
if (d->cell == NULL) {
|
if (d->cell == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM,
|
return krb5_enomem(context);
|
||||||
N_("malloc: out of memory", ""));
|
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
|
|
||||||
f = fopen (AFS_SERVERMAGICKRBCONF, "r");
|
f = fopen (AFS_SERVERMAGICKRBCONF, "r");
|
||||||
if (f != NULL) {
|
if (f != NULL) {
|
||||||
@@ -117,9 +114,7 @@ get_cell_and_realm (krb5_context context, struct akf_data *d)
|
|||||||
if (d->realm == NULL) {
|
if (d->realm == NULL) {
|
||||||
free (d->cell);
|
free (d->cell);
|
||||||
d->cell = NULL;
|
d->cell = NULL;
|
||||||
krb5_set_error_message(context, ENOMEM,
|
return krb5_enomem(context);
|
||||||
N_("malloc: out of memory", ""));
|
|
||||||
return ENOMEM;
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -134,11 +129,8 @@ akf_resolve(krb5_context context, const char *name, krb5_keytab id)
|
|||||||
int ret;
|
int ret;
|
||||||
struct akf_data *d = malloc(sizeof (struct akf_data));
|
struct akf_data *d = malloc(sizeof (struct akf_data));
|
||||||
|
|
||||||
if (d == NULL) {
|
if (d == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM,
|
return krb5_enomem(context);
|
||||||
N_("malloc: out of memory", ""));
|
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
|
|
||||||
d->num_entries = 0;
|
d->num_entries = 0;
|
||||||
ret = get_cell_and_realm (context, d);
|
ret = get_cell_and_realm (context, d);
|
||||||
@@ -151,9 +143,7 @@ akf_resolve(krb5_context context, const char *name, krb5_keytab id)
|
|||||||
free (d->cell);
|
free (d->cell);
|
||||||
free (d->realm);
|
free (d->realm);
|
||||||
free (d);
|
free (d);
|
||||||
krb5_set_error_message(context, ENOMEM,
|
return krb5_enomem(context);
|
||||||
N_("malloc: out of memory", ""));
|
|
||||||
return ENOMEM;
|
|
||||||
}
|
}
|
||||||
id->data = d;
|
id->data = d;
|
||||||
|
|
||||||
@@ -271,9 +261,7 @@ akf_next_entry(krb5_context context,
|
|||||||
entry->keyblock.keyvalue.data = malloc (8);
|
entry->keyblock.keyvalue.data = malloc (8);
|
||||||
if (entry->keyblock.keyvalue.data == NULL) {
|
if (entry->keyblock.keyvalue.data == NULL) {
|
||||||
krb5_free_principal (context, entry->principal);
|
krb5_free_principal (context, entry->principal);
|
||||||
krb5_set_error_message(context, ENOMEM,
|
ret = krb5_enomem(context);
|
||||||
N_("malloc: out of memory", ""));
|
|
||||||
ret = ENOMEM;
|
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -348,9 +336,7 @@ akf_add_entry(krb5_context context,
|
|||||||
sp = krb5_storage_from_fd(fd);
|
sp = krb5_storage_from_fd(fd);
|
||||||
if(sp == NULL) {
|
if(sp == NULL) {
|
||||||
close(fd);
|
close(fd);
|
||||||
krb5_set_error_message(context, ENOMEM,
|
return krb5_enomem(context);
|
||||||
N_("malloc: out of memory", ""));
|
|
||||||
return ENOMEM;
|
|
||||||
}
|
}
|
||||||
if (created)
|
if (created)
|
||||||
len = 0;
|
len = 0;
|
||||||
|
@@ -73,17 +73,13 @@ mkt_resolve(krb5_context context, const char *name, krb5_keytab id)
|
|||||||
d = calloc(1, sizeof(*d));
|
d = calloc(1, sizeof(*d));
|
||||||
if(d == NULL) {
|
if(d == NULL) {
|
||||||
HEIMDAL_MUTEX_unlock(&mkt_mutex);
|
HEIMDAL_MUTEX_unlock(&mkt_mutex);
|
||||||
krb5_set_error_message(context, ENOMEM,
|
return krb5_enomem(context);
|
||||||
N_("malloc: out of memory", ""));
|
|
||||||
return ENOMEM;
|
|
||||||
}
|
}
|
||||||
d->name = strdup(name);
|
d->name = strdup(name);
|
||||||
if (d->name == NULL) {
|
if (d->name == NULL) {
|
||||||
HEIMDAL_MUTEX_unlock(&mkt_mutex);
|
HEIMDAL_MUTEX_unlock(&mkt_mutex);
|
||||||
free(d);
|
free(d);
|
||||||
krb5_set_error_message(context, ENOMEM,
|
return krb5_enomem(context);
|
||||||
N_("malloc: out of memory", ""));
|
|
||||||
return ENOMEM;
|
|
||||||
}
|
}
|
||||||
d->entries = NULL;
|
d->entries = NULL;
|
||||||
d->num_entries = 0;
|
d->num_entries = 0;
|
||||||
@@ -175,11 +171,8 @@ mkt_add_entry(krb5_context context,
|
|||||||
struct mkt_data *d = id->data;
|
struct mkt_data *d = id->data;
|
||||||
krb5_keytab_entry *tmp;
|
krb5_keytab_entry *tmp;
|
||||||
tmp = realloc(d->entries, (d->num_entries + 1) * sizeof(*d->entries));
|
tmp = realloc(d->entries, (d->num_entries + 1) * sizeof(*d->entries));
|
||||||
if(tmp == NULL) {
|
if (tmp == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM,
|
return krb5_enomem(context);
|
||||||
N_("malloc: out of memory", ""));
|
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
d->entries = tmp;
|
d->entries = tmp;
|
||||||
return krb5_kt_copy_entry_contents(context, entry,
|
return krb5_kt_copy_entry_contents(context, entry,
|
||||||
&d->entries[d->num_entries++]);
|
&d->entries[d->num_entries++]);
|
||||||
|
@@ -101,9 +101,7 @@ srv_find_realm(krb5_context context, krb5_krbhst_info ***res, int *count,
|
|||||||
*res = malloc(num_srv * sizeof(**res));
|
*res = malloc(num_srv * sizeof(**res));
|
||||||
if(*res == NULL) {
|
if(*res == NULL) {
|
||||||
rk_dns_free_data(r);
|
rk_dns_free_data(r);
|
||||||
krb5_set_error_message(context, ENOMEM,
|
return krb5_enomem(context);
|
||||||
N_("malloc: out of memory", ""));
|
|
||||||
return ENOMEM;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
rk_dns_srv_order(r);
|
rk_dns_srv_order(r);
|
||||||
@@ -120,7 +118,7 @@ srv_find_realm(krb5_context context, krb5_krbhst_info ***res, int *count,
|
|||||||
free((*res)[num_srv]);
|
free((*res)[num_srv]);
|
||||||
free(*res);
|
free(*res);
|
||||||
*res = NULL;
|
*res = NULL;
|
||||||
return ENOMEM;
|
return krb5_enomem(context);
|
||||||
}
|
}
|
||||||
(*res)[num_srv++] = hi;
|
(*res)[num_srv++] = hi;
|
||||||
|
|
||||||
@@ -280,11 +278,8 @@ _krb5_krbhost_info_move(krb5_context context,
|
|||||||
size_t hostnamelen = strlen(from->hostname);
|
size_t hostnamelen = strlen(from->hostname);
|
||||||
/* trailing NUL is included in structure */
|
/* trailing NUL is included in structure */
|
||||||
*to = calloc(1, sizeof(**to) + hostnamelen);
|
*to = calloc(1, sizeof(**to) + hostnamelen);
|
||||||
if(*to == NULL) {
|
if (*to == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM,
|
return krb5_enomem(context);
|
||||||
N_("malloc: out of memory", ""));
|
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
|
|
||||||
(*to)->proto = from->proto;
|
(*to)->proto = from->proto;
|
||||||
(*to)->port = from->port;
|
(*to)->port = from->port;
|
||||||
@@ -321,7 +316,7 @@ append_host_string(krb5_context context, struct krb5_krbhst_data *kd,
|
|||||||
|
|
||||||
hi = parse_hostspec(context, kd, host, def_port, port);
|
hi = parse_hostspec(context, kd, host, def_port, port);
|
||||||
if(hi == NULL)
|
if(hi == NULL)
|
||||||
return ENOMEM;
|
return krb5_enomem(context);
|
||||||
|
|
||||||
append_host_hostinfo(kd, hi);
|
append_host_hostinfo(kd, hi);
|
||||||
return 0;
|
return 0;
|
||||||
@@ -1083,7 +1078,7 @@ gethostlist(krb5_context context, const char *realm,
|
|||||||
*hostlist = calloc(nhost + 1, sizeof(**hostlist));
|
*hostlist = calloc(nhost + 1, sizeof(**hostlist));
|
||||||
if(*hostlist == NULL) {
|
if(*hostlist == NULL) {
|
||||||
krb5_krbhst_free(context, handle);
|
krb5_krbhst_free(context, handle);
|
||||||
return ENOMEM;
|
return krb5_enomem(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
krb5_krbhst_reset(context, handle);
|
krb5_krbhst_reset(context, handle);
|
||||||
@@ -1093,7 +1088,7 @@ gethostlist(krb5_context context, const char *realm,
|
|||||||
if(((*hostlist)[nhost++] = strdup(host)) == NULL) {
|
if(((*hostlist)[nhost++] = strdup(host)) == NULL) {
|
||||||
krb5_free_krbhst(context, *hostlist);
|
krb5_free_krbhst(context, *hostlist);
|
||||||
krb5_krbhst_free(context, handle);
|
krb5_krbhst_free(context, handle);
|
||||||
return ENOMEM;
|
return krb5_enomem(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
(*hostlist)[nhost] = NULL;
|
(*hostlist)[nhost] = NULL;
|
||||||
|
@@ -121,17 +121,12 @@ krb5_initlog(krb5_context context,
|
|||||||
krb5_log_facility **fac)
|
krb5_log_facility **fac)
|
||||||
{
|
{
|
||||||
krb5_log_facility *f = calloc(1, sizeof(*f));
|
krb5_log_facility *f = calloc(1, sizeof(*f));
|
||||||
if(f == NULL) {
|
if (f == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM,
|
return krb5_enomem(context);
|
||||||
N_("malloc: out of memory", ""));
|
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
f->program = strdup(program);
|
f->program = strdup(program);
|
||||||
if(f->program == NULL){
|
if(f->program == NULL){
|
||||||
free(f);
|
free(f);
|
||||||
krb5_set_error_message(context, ENOMEM,
|
return krb5_enomem(context);
|
||||||
N_("malloc: out of memory", ""));
|
|
||||||
return ENOMEM;
|
|
||||||
}
|
}
|
||||||
*fac = f;
|
*fac = f;
|
||||||
return 0;
|
return 0;
|
||||||
@@ -147,11 +142,8 @@ krb5_addlog_func(krb5_context context,
|
|||||||
void *data)
|
void *data)
|
||||||
{
|
{
|
||||||
struct facility *fp = log_realloc(fac);
|
struct facility *fp = log_realloc(fac);
|
||||||
if(fp == NULL) {
|
if (fp == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM,
|
return krb5_enomem(context);
|
||||||
N_("malloc: out of memory", ""));
|
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
fp->min = min;
|
fp->min = min;
|
||||||
fp->max = max;
|
fp->max = max;
|
||||||
fp->log_func = log_func;
|
fp->log_func = log_func;
|
||||||
@@ -190,11 +182,8 @@ open_syslog(krb5_context context,
|
|||||||
struct _heimdal_syslog_data *sd = malloc(sizeof(*sd));
|
struct _heimdal_syslog_data *sd = malloc(sizeof(*sd));
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if(sd == NULL) {
|
if (sd == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM,
|
return krb5_enomem(context);
|
||||||
N_("malloc: out of memory", ""));
|
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
i = find_value(sev, syslogvals);
|
i = find_value(sev, syslogvals);
|
||||||
if(i == -1)
|
if(i == -1)
|
||||||
i = LOG_ERR;
|
i = LOG_ERR;
|
||||||
@@ -255,11 +244,8 @@ open_file(krb5_context context, krb5_log_facility *fac, int min, int max,
|
|||||||
const char *filename, const char *mode, FILE *f, int keep_open)
|
const char *filename, const char *mode, FILE *f, int keep_open)
|
||||||
{
|
{
|
||||||
struct file_data *fd = malloc(sizeof(*fd));
|
struct file_data *fd = malloc(sizeof(*fd));
|
||||||
if(fd == NULL) {
|
if (fd == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM,
|
return krb5_enomem(context);
|
||||||
N_("malloc: out of memory", ""));
|
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
fd->filename = filename;
|
fd->filename = filename;
|
||||||
fd->mode = mode;
|
fd->mode = mode;
|
||||||
fd->fd = f;
|
fd->fd = f;
|
||||||
@@ -307,11 +293,8 @@ krb5_addlog_dest(krb5_context context, krb5_log_facility *f, const char *orig)
|
|||||||
FILE *file = NULL;
|
FILE *file = NULL;
|
||||||
int keep_open = 0;
|
int keep_open = 0;
|
||||||
fn = strdup(p + 5);
|
fn = strdup(p + 5);
|
||||||
if(fn == NULL) {
|
if (fn == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM,
|
return krb5_enomem(context);
|
||||||
N_("malloc: out of memory", ""));
|
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
if(p[4] == '='){
|
if(p[4] == '='){
|
||||||
int i = open(fn, O_WRONLY | O_CREAT |
|
int i = open(fn, O_WRONLY | O_CREAT |
|
||||||
O_TRUNC | O_APPEND, 0666);
|
O_TRUNC | O_APPEND, 0666);
|
||||||
|
@@ -509,11 +509,8 @@ static krb5_error_code KRB5_CALLCONV
|
|||||||
mcc_default_name(krb5_context context, char **str)
|
mcc_default_name(krb5_context context, char **str)
|
||||||
{
|
{
|
||||||
*str = strdup("MEMORY:");
|
*str = strdup("MEMORY:");
|
||||||
if (*str == NULL) {
|
if (*str == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM,
|
return krb5_enomem(context);
|
||||||
N_("malloc: out of memory", ""));
|
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -48,42 +48,32 @@ _krb5_s4u2self_to_checksumdata(krb5_context context,
|
|||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
sp = krb5_storage_emem();
|
sp = krb5_storage_emem();
|
||||||
if (sp == NULL) {
|
if (sp == NULL)
|
||||||
krb5_clear_error_message(context);
|
return krb5_enomem(context);
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
krb5_storage_set_flags(sp, KRB5_STORAGE_BYTEORDER_LE);
|
krb5_storage_set_flags(sp, KRB5_STORAGE_BYTEORDER_LE);
|
||||||
ret = krb5_store_int32(sp, self->name.name_type);
|
ret = krb5_store_int32(sp, self->name.name_type);
|
||||||
if (ret)
|
if (ret) {
|
||||||
goto out;
|
krb5_clear_error_message(context);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
for (i = 0; i < self->name.name_string.len; i++) {
|
for (i = 0; i < self->name.name_string.len; i++) {
|
||||||
size = strlen(self->name.name_string.val[i]);
|
size = strlen(self->name.name_string.val[i]);
|
||||||
ssize = krb5_storage_write(sp, self->name.name_string.val[i], size);
|
ssize = krb5_storage_write(sp, self->name.name_string.val[i], size);
|
||||||
if (ssize != (krb5_ssize_t)size) {
|
if (ssize != (krb5_ssize_t)size)
|
||||||
ret = ENOMEM;
|
return krb5_enomem(context);
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
size = strlen(self->realm);
|
size = strlen(self->realm);
|
||||||
ssize = krb5_storage_write(sp, self->realm, size);
|
ssize = krb5_storage_write(sp, self->realm, size);
|
||||||
if (ssize != (krb5_ssize_t)size) {
|
if (ssize != (krb5_ssize_t)size)
|
||||||
ret = ENOMEM;
|
return krb5_enomem(context);
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
size = strlen(self->auth);
|
size = strlen(self->auth);
|
||||||
ssize = krb5_storage_write(sp, self->auth, size);
|
ssize = krb5_storage_write(sp, self->auth, size);
|
||||||
if (ssize != (krb5_ssize_t)size) {
|
if (ssize != (krb5_ssize_t)size)
|
||||||
ret = ENOMEM;
|
return krb5_enomem(context);
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = krb5_storage_to_data(sp, data);
|
ret = krb5_storage_to_data(sp, data);
|
||||||
krb5_storage_free(sp);
|
krb5_storage_free(sp);
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
out:
|
|
||||||
krb5_clear_error_message(context);
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@@ -96,7 +96,7 @@ krb5_c_get_checksum(krb5_context context, const krb5_checksum *cksum,
|
|||||||
if (data) {
|
if (data) {
|
||||||
*data = malloc(sizeof(**data));
|
*data = malloc(sizeof(**data));
|
||||||
if (*data == NULL)
|
if (*data == NULL)
|
||||||
return ENOMEM;
|
return krb5_enomem(context);
|
||||||
|
|
||||||
ret = der_copy_octet_string(&cksum->checksum, *data);
|
ret = der_copy_octet_string(&cksum->checksum, *data);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
@@ -167,7 +167,7 @@ krb5_copy_checksum (krb5_context context,
|
|||||||
{
|
{
|
||||||
*new = malloc(sizeof(**new));
|
*new = malloc(sizeof(**new));
|
||||||
if (*new == NULL)
|
if (*new == NULL)
|
||||||
return ENOMEM;
|
return krb5_enomem(context);
|
||||||
return copy_Checksum(old, *new);
|
return copy_Checksum(old, *new);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -135,10 +135,8 @@ krb5_mk_priv(krb5_context context,
|
|||||||
|
|
||||||
ret = krb5_data_copy(outbuf, buf + buf_size - len, len);
|
ret = krb5_data_copy(outbuf, buf + buf_size - len, len);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
krb5_set_error_message(context, ENOMEM,
|
|
||||||
N_("malloc: out of memory", ""));
|
|
||||||
free(buf);
|
free(buf);
|
||||||
return ENOMEM;
|
return krb5_enomem(context);
|
||||||
}
|
}
|
||||||
free (buf);
|
free (buf);
|
||||||
if (auth_context->flags & KRB5_AUTH_CONTEXT_DO_SEQUENCE)
|
if (auth_context->flags & KRB5_AUTH_CONTEXT_DO_SEQUENCE)
|
||||||
|
@@ -67,9 +67,7 @@ krb5_mk_rep(krb5_context context,
|
|||||||
&body.subkey);
|
&body.subkey);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
free_EncAPRepPart(&body);
|
free_EncAPRepPart(&body);
|
||||||
krb5_set_error_message(context, ENOMEM,
|
return krb5_enomem(context);
|
||||||
N_("malloc: out of memory", ""));
|
|
||||||
return ENOMEM;
|
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
body.subkey = NULL;
|
body.subkey = NULL;
|
||||||
@@ -80,9 +78,8 @@ krb5_mk_rep(krb5_context context,
|
|||||||
&auth_context->local_seqnumber);
|
&auth_context->local_seqnumber);
|
||||||
ALLOC(body.seq_number, 1);
|
ALLOC(body.seq_number, 1);
|
||||||
if (body.seq_number == NULL) {
|
if (body.seq_number == NULL) {
|
||||||
krb5_set_error_message(context, ENOMEM, "malloc: out of memory");
|
|
||||||
free_EncAPRepPart(&body);
|
free_EncAPRepPart(&body);
|
||||||
return ENOMEM;
|
return krb5_enomem(context);
|
||||||
}
|
}
|
||||||
*(body.seq_number) = auth_context->local_seqnumber;
|
*(body.seq_number) = auth_context->local_seqnumber;
|
||||||
} else
|
} else
|
||||||
|
@@ -49,11 +49,8 @@ krb5_padata_add(krb5_context context, METHOD_DATA *md,
|
|||||||
PA_DATA *pa;
|
PA_DATA *pa;
|
||||||
|
|
||||||
pa = realloc (md->val, (md->len + 1) * sizeof(*md->val));
|
pa = realloc (md->val, (md->len + 1) * sizeof(*md->val));
|
||||||
if (pa == NULL) {
|
if (pa == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM,
|
return krb5_enomem(context);
|
||||||
N_("malloc: out of memory", ""));
|
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
md->val = pa;
|
md->val = pa;
|
||||||
|
|
||||||
pa[md->len].padata_type = type;
|
pa[md->len].padata_type = type;
|
||||||
|
@@ -399,9 +399,7 @@ build_auth_pack(krb5_context context,
|
|||||||
|
|
||||||
ALLOC(a->pkAuthenticator.paChecksum, 1);
|
ALLOC(a->pkAuthenticator.paChecksum, 1);
|
||||||
if (a->pkAuthenticator.paChecksum == NULL) {
|
if (a->pkAuthenticator.paChecksum == NULL) {
|
||||||
krb5_set_error_message(context, ENOMEM,
|
return krb5_enomem(context);
|
||||||
N_("malloc: out of memory", ""));
|
|
||||||
return ENOMEM;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = krb5_data_copy(a->pkAuthenticator.paChecksum,
|
ret = krb5_data_copy(a->pkAuthenticator.paChecksum,
|
||||||
@@ -436,11 +434,8 @@ build_auth_pack(krb5_context context,
|
|||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
ctx->u.dh = DH_new();
|
ctx->u.dh = DH_new();
|
||||||
if (ctx->u.dh == NULL) {
|
if (ctx->u.dh == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM,
|
return krb5_enomem(context);
|
||||||
N_("malloc: out of memory", ""));
|
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = select_dh_group(context, ctx->u.dh, dh_min_bits, ctx->m);
|
ret = select_dh_group(context, ctx->u.dh, dh_min_bits, ctx->m);
|
||||||
if (ret)
|
if (ret)
|
||||||
@@ -763,9 +758,7 @@ pk_mk_padata(krb5_context context,
|
|||||||
|
|
||||||
req.trustedCertifiers = calloc(1, sizeof(*req.trustedCertifiers));
|
req.trustedCertifiers = calloc(1, sizeof(*req.trustedCertifiers));
|
||||||
if (req.trustedCertifiers == NULL) {
|
if (req.trustedCertifiers == NULL) {
|
||||||
ret = ENOMEM;
|
ret = krb5_enomem(context);
|
||||||
krb5_set_error_message(context, ret,
|
|
||||||
N_("malloc: out of memory", ""));
|
|
||||||
free_PA_PK_AS_REQ(&req);
|
free_PA_PK_AS_REQ(&req);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
@@ -980,9 +973,7 @@ get_reply_key_win(krb5_context context,
|
|||||||
*key = malloc (sizeof (**key));
|
*key = malloc (sizeof (**key));
|
||||||
if (*key == NULL) {
|
if (*key == NULL) {
|
||||||
free_ReplyKeyPack_Win2k(&key_pack);
|
free_ReplyKeyPack_Win2k(&key_pack);
|
||||||
krb5_set_error_message(context, ENOMEM,
|
return krb5_enomem(context);
|
||||||
N_("malloc: out of memory", ""));
|
|
||||||
return ENOMEM;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = copy_EncryptionKey(&key_pack.replyKey, *key);
|
ret = copy_EncryptionKey(&key_pack.replyKey, *key);
|
||||||
@@ -1045,9 +1036,7 @@ get_reply_key(krb5_context context,
|
|||||||
*key = malloc (sizeof (**key));
|
*key = malloc (sizeof (**key));
|
||||||
if (*key == NULL) {
|
if (*key == NULL) {
|
||||||
free_ReplyKeyPack(&key_pack);
|
free_ReplyKeyPack(&key_pack);
|
||||||
krb5_set_error_message(context, ENOMEM,
|
return krb5_enomem(context);
|
||||||
N_("malloc: out of memory", ""));
|
|
||||||
return ENOMEM;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = copy_EncryptionKey(&key_pack.replyKey, *key);
|
ret = copy_EncryptionKey(&key_pack.replyKey, *key);
|
||||||
@@ -1430,8 +1419,7 @@ pk_rd_pa_reply_dh(krb5_context context,
|
|||||||
|
|
||||||
dh_gen_key = malloc(size);
|
dh_gen_key = malloc(size);
|
||||||
if (dh_gen_key == NULL) {
|
if (dh_gen_key == NULL) {
|
||||||
ret = ENOMEM;
|
ret = krb5_enomem(context);
|
||||||
krb5_set_error_message(context, ret, N_("malloc: out of memory", ""));
|
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1479,9 +1467,7 @@ pk_rd_pa_reply_dh(krb5_context context,
|
|||||||
dh_gen_key = malloc(size);
|
dh_gen_key = malloc(size);
|
||||||
if (dh_gen_key == NULL) {
|
if (dh_gen_key == NULL) {
|
||||||
EC_KEY_free(public);
|
EC_KEY_free(public);
|
||||||
ret = ENOMEM;
|
ret = krb5_enomem(context);
|
||||||
krb5_set_error_message(context, ret,
|
|
||||||
N_("malloc: out of memory", ""));
|
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
dh_gen_keylen = ECDH_compute_key(dh_gen_key, size,
|
dh_gen_keylen = ECDH_compute_key(dh_gen_key, size,
|
||||||
@@ -1509,9 +1495,7 @@ pk_rd_pa_reply_dh(krb5_context context,
|
|||||||
|
|
||||||
*key = malloc (sizeof (**key));
|
*key = malloc (sizeof (**key));
|
||||||
if (*key == NULL) {
|
if (*key == NULL) {
|
||||||
ret = ENOMEM;
|
ret = krb5_enomem(context);
|
||||||
krb5_set_error_message(context, ret,
|
|
||||||
N_("malloc: out of memory", ""));
|
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1863,11 +1847,8 @@ _krb5_pk_load_id(krb5_context context,
|
|||||||
/* load cert */
|
/* load cert */
|
||||||
|
|
||||||
id = calloc(1, sizeof(*id));
|
id = calloc(1, sizeof(*id));
|
||||||
if (id == NULL) {
|
if (id == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM,
|
return krb5_enomem(context);
|
||||||
N_("malloc: out of memory", ""));
|
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (user_id) {
|
if (user_id) {
|
||||||
hx509_lock lock;
|
hx509_lock lock;
|
||||||
@@ -2050,11 +2031,8 @@ _krb5_parse_moduli_line(krb5_context context,
|
|||||||
*m = NULL;
|
*m = NULL;
|
||||||
|
|
||||||
m1 = calloc(1, sizeof(*m1));
|
m1 = calloc(1, sizeof(*m1));
|
||||||
if (m1 == NULL) {
|
if (m1 == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM,
|
return krb5_enomem(context);
|
||||||
N_("malloc: out of memory", ""));
|
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
|
|
||||||
while (isspace((unsigned char)*p))
|
while (isspace((unsigned char)*p))
|
||||||
p++;
|
p++;
|
||||||
@@ -2073,8 +2051,7 @@ _krb5_parse_moduli_line(krb5_context context,
|
|||||||
}
|
}
|
||||||
m1->name = strdup(p1);
|
m1->name = strdup(p1);
|
||||||
if (m1->name == NULL) {
|
if (m1->name == NULL) {
|
||||||
ret = ENOMEM;
|
ret = krb5_enomem(context);
|
||||||
krb5_set_error_message(context, ret, N_("malloc: out of memeory", ""));
|
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2198,11 +2175,8 @@ _krb5_parse_moduli(krb5_context context, const char *file,
|
|||||||
*moduli = NULL;
|
*moduli = NULL;
|
||||||
|
|
||||||
m = calloc(1, sizeof(m[0]) * 3);
|
m = calloc(1, sizeof(m[0]) * 3);
|
||||||
if (m == NULL) {
|
if (m == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM,
|
return krb5_enomem(context);
|
||||||
N_("malloc: out of memory", ""));
|
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
|
|
||||||
strlcpy(buf, default_moduli_rfc3526_MODP_group14, sizeof(buf));
|
strlcpy(buf, default_moduli_rfc3526_MODP_group14, sizeof(buf));
|
||||||
ret = _krb5_parse_moduli_line(context, "builtin", 1, buf, &m[0]);
|
ret = _krb5_parse_moduli_line(context, "builtin", 1, buf, &m[0]);
|
||||||
@@ -2254,9 +2228,7 @@ _krb5_parse_moduli(krb5_context context, const char *file,
|
|||||||
m2 = realloc(m, (n + 2) * sizeof(m[0]));
|
m2 = realloc(m, (n + 2) * sizeof(m[0]));
|
||||||
if (m2 == NULL) {
|
if (m2 == NULL) {
|
||||||
_krb5_free_moduli(m);
|
_krb5_free_moduli(m);
|
||||||
krb5_set_error_message(context, ENOMEM,
|
return krb5_enomem(context);
|
||||||
N_("malloc: out of memory", ""));
|
|
||||||
return ENOMEM;
|
|
||||||
}
|
}
|
||||||
m = m2;
|
m = m2;
|
||||||
|
|
||||||
@@ -2384,11 +2356,8 @@ krb5_get_init_creds_opt_set_pkinit(krb5_context context,
|
|||||||
|
|
||||||
opt->opt_private->pk_init_ctx =
|
opt->opt_private->pk_init_ctx =
|
||||||
calloc(1, sizeof(*opt->opt_private->pk_init_ctx));
|
calloc(1, sizeof(*opt->opt_private->pk_init_ctx));
|
||||||
if (opt->opt_private->pk_init_ctx == NULL) {
|
if (opt->opt_private->pk_init_ctx == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM,
|
return krb5_enomem(context);
|
||||||
N_("malloc: out of memory", ""));
|
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
opt->opt_private->pk_init_ctx->require_binding = 0;
|
opt->opt_private->pk_init_ctx->require_binding = 0;
|
||||||
opt->opt_private->pk_init_ctx->require_eku = 1;
|
opt->opt_private->pk_init_ctx->require_eku = 1;
|
||||||
opt->opt_private->pk_init_ctx->require_krbtgt_otherName = 1;
|
opt->opt_private->pk_init_ctx->require_krbtgt_otherName = 1;
|
||||||
|
@@ -249,9 +249,7 @@ krb5_rd_cred(krb5_context context,
|
|||||||
sizeof(**ret_creds));
|
sizeof(**ret_creds));
|
||||||
|
|
||||||
if (*ret_creds == NULL) {
|
if (*ret_creds == NULL) {
|
||||||
ret = ENOMEM;
|
ret = krb5_enomem(context);
|
||||||
krb5_set_error_message(context, ret,
|
|
||||||
N_("malloc: out of memory", ""));
|
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -261,9 +259,7 @@ krb5_rd_cred(krb5_context context,
|
|||||||
|
|
||||||
creds = calloc(1, sizeof(*creds));
|
creds = calloc(1, sizeof(*creds));
|
||||||
if(creds == NULL) {
|
if(creds == NULL) {
|
||||||
ret = ENOMEM;
|
ret = krb5_enomem(context);
|
||||||
krb5_set_error_message(context, ret,
|
|
||||||
N_("malloc: out of memory", ""));
|
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -75,8 +75,7 @@ krb5_rd_rep(krb5_context context,
|
|||||||
|
|
||||||
*repl = malloc(sizeof(**repl));
|
*repl = malloc(sizeof(**repl));
|
||||||
if (*repl == NULL) {
|
if (*repl == NULL) {
|
||||||
ret = ENOMEM;
|
ret = krb5_enomem(context);
|
||||||
krb5_set_error_message(context, ret, N_("malloc: out of memory", ""));
|
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
ret = decode_EncAPRepPart(data.data, data.length, *repl, &len);
|
ret = decode_EncAPRepPart(data.data, data.length, *repl, &len);
|
||||||
|
@@ -361,8 +361,7 @@ krb5_verify_ap_req2(krb5_context context,
|
|||||||
|
|
||||||
t = calloc(1, sizeof(*t));
|
t = calloc(1, sizeof(*t));
|
||||||
if (t == NULL) {
|
if (t == NULL) {
|
||||||
ret = ENOMEM;
|
ret = krb5_enomem(context);
|
||||||
krb5_clear_error_message (context);
|
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -545,11 +544,8 @@ KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
|
|||||||
krb5_rd_req_in_ctx_alloc(krb5_context context, krb5_rd_req_in_ctx *ctx)
|
krb5_rd_req_in_ctx_alloc(krb5_context context, krb5_rd_req_in_ctx *ctx)
|
||||||
{
|
{
|
||||||
*ctx = calloc(1, sizeof(**ctx));
|
*ctx = calloc(1, sizeof(**ctx));
|
||||||
if (*ctx == NULL) {
|
if (*ctx == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM,
|
return krb5_enomem(context);
|
||||||
N_("malloc: out of memory", ""));
|
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
(*ctx)->check_pac = (context->flags & KRB5_CTX_F_CHECK_PAC) ? 1 : 0;
|
(*ctx)->check_pac = (context->flags & KRB5_CTX_F_CHECK_PAC) ? 1 : 0;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -866,11 +862,8 @@ krb5_rd_req_ctx(krb5_context context,
|
|||||||
*outctx = NULL;
|
*outctx = NULL;
|
||||||
|
|
||||||
o = calloc(1, sizeof(*o));
|
o = calloc(1, sizeof(*o));
|
||||||
if (o == NULL) {
|
if (o == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM,
|
return krb5_enomem(context);
|
||||||
N_("malloc: out of memory", ""));
|
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (*auth_context == NULL) {
|
if (*auth_context == NULL) {
|
||||||
ret = krb5_auth_con_init(context, auth_context);
|
ret = krb5_auth_con_init(context, auth_context);
|
||||||
|
@@ -191,8 +191,7 @@ krb5_rd_safe(krb5_context context,
|
|||||||
outbuf->length = safe.safe_body.user_data.length;
|
outbuf->length = safe.safe_body.user_data.length;
|
||||||
outbuf->data = malloc(outbuf->length);
|
outbuf->data = malloc(outbuf->length);
|
||||||
if (outbuf->data == NULL && outbuf->length != 0) {
|
if (outbuf->data == NULL && outbuf->length != 0) {
|
||||||
ret = ENOMEM;
|
ret = krb5_enomem(context);
|
||||||
krb5_set_error_message(context, ret, N_("malloc: out of memory", ""));
|
|
||||||
krb5_data_zero(outbuf);
|
krb5_data_zero(outbuf);
|
||||||
goto failure;
|
goto failure;
|
||||||
}
|
}
|
||||||
|
@@ -164,9 +164,7 @@ krb5_recvauth_match_version(krb5_context context,
|
|||||||
if (her_appl_version == NULL) {
|
if (her_appl_version == NULL) {
|
||||||
repl = 2;
|
repl = 2;
|
||||||
krb5_net_write (context, p_fd, &repl, 1);
|
krb5_net_write (context, p_fd, &repl, 1);
|
||||||
krb5_set_error_message(context, ENOMEM,
|
return krb5_enomem(context);
|
||||||
N_("malloc: out of memory", ""));
|
|
||||||
return ENOMEM;
|
|
||||||
}
|
}
|
||||||
if (krb5_net_read (context, p_fd, her_appl_version, len) != len
|
if (krb5_net_read (context, p_fd, her_appl_version, len) != len
|
||||||
|| !(*match_appl_version)(match_data, her_appl_version)) {
|
|| !(*match_appl_version)(match_data, her_appl_version)) {
|
||||||
|
@@ -305,11 +305,8 @@ krb5_get_server_rcache(krb5_context context,
|
|||||||
char *tmp = malloc(4 * piece->length + 1);
|
char *tmp = malloc(4 * piece->length + 1);
|
||||||
char *name;
|
char *name;
|
||||||
|
|
||||||
if(tmp == NULL) {
|
if (tmp == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM,
|
return krb5_enomem(context);
|
||||||
N_("malloc: out of memory", ""));
|
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
strvisx(tmp, piece->data, piece->length, VIS_WHITE | VIS_OCTAL);
|
strvisx(tmp, piece->data, piece->length, VIS_WHITE | VIS_OCTAL);
|
||||||
#ifdef HAVE_GETEUID
|
#ifdef HAVE_GETEUID
|
||||||
ret = asprintf(&name, "FILE:rc_%s_%u", tmp, (unsigned)geteuid());
|
ret = asprintf(&name, "FILE:rc_%s_%u", tmp, (unsigned)geteuid());
|
||||||
@@ -317,11 +314,8 @@ krb5_get_server_rcache(krb5_context context,
|
|||||||
ret = asprintf(&name, "FILE:rc_%s", tmp);
|
ret = asprintf(&name, "FILE:rc_%s", tmp);
|
||||||
#endif
|
#endif
|
||||||
free(tmp);
|
free(tmp);
|
||||||
if(ret < 0 || name == NULL) {
|
if (ret < 0 || name == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM,
|
return krb5_enomem(context);
|
||||||
N_("malloc: out of memory", ""));
|
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = krb5_rc_resolve_full(context, &rcache, name);
|
ret = krb5_rc_resolve_full(context, &rcache, name);
|
||||||
free(name);
|
free(name);
|
||||||
|
@@ -63,10 +63,8 @@ AES_string_to_key(krb5_context context,
|
|||||||
|
|
||||||
kd.schedule = NULL;
|
kd.schedule = NULL;
|
||||||
ALLOC(kd.key, 1);
|
ALLOC(kd.key, 1);
|
||||||
if(kd.key == NULL) {
|
if (kd.key == NULL)
|
||||||
krb5_set_error_message (context, ENOMEM, N_("malloc: out of memory", ""));
|
return krb5_enomem(context);
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
kd.key->keytype = enctype;
|
kd.key->keytype = enctype;
|
||||||
ret = krb5_data_alloc(&kd.key->keyvalue, et->keytype->size);
|
ret = krb5_data_alloc(&kd.key->keyvalue, et->keytype->size);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
|
@@ -48,8 +48,7 @@ ARCFOUR_string_to_key(krb5_context context,
|
|||||||
|
|
||||||
m = EVP_MD_CTX_create();
|
m = EVP_MD_CTX_create();
|
||||||
if (m == NULL) {
|
if (m == NULL) {
|
||||||
ret = ENOMEM;
|
ret = krb5_enomem(context);
|
||||||
krb5_set_error_message(context, ret, N_("malloc: out of memory", ""));
|
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -64,9 +63,7 @@ ARCFOUR_string_to_key(krb5_context context,
|
|||||||
|
|
||||||
s = malloc (len * sizeof(s[0]));
|
s = malloc (len * sizeof(s[0]));
|
||||||
if (len != 0 && s == NULL) {
|
if (len != 0 && s == NULL) {
|
||||||
krb5_set_error_message (context, ENOMEM,
|
ret = krb5_enomem(context);
|
||||||
N_("malloc: out of memory", ""));
|
|
||||||
ret = ENOMEM;
|
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -89,7 +86,7 @@ ARCFOUR_string_to_key(krb5_context context,
|
|||||||
key->keytype = enctype;
|
key->keytype = enctype;
|
||||||
ret = krb5_data_alloc (&key->keyvalue, 16);
|
ret = krb5_data_alloc (&key->keyvalue, 16);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
krb5_set_error_message (context, ENOMEM, N_("malloc: out of memory", ""));
|
krb5_enomem(context);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
EVP_DigestFinal_ex (m, key->keyvalue.data, NULL);
|
EVP_DigestFinal_ex (m, key->keyvalue.data, NULL);
|
||||||
|
@@ -191,10 +191,8 @@ krb5_DES_string_to_key(krb5_context context,
|
|||||||
|
|
||||||
len = password.length + salt.saltvalue.length;
|
len = password.length + salt.saltvalue.length;
|
||||||
s = malloc(len);
|
s = malloc(len);
|
||||||
if(len > 0 && s == NULL) {
|
if (len > 0 && s == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
return krb5_enomem(context);
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
memcpy(s, password.data, password.length);
|
memcpy(s, password.data, password.length);
|
||||||
memcpy(s + password.length, salt.saltvalue.data, salt.saltvalue.length);
|
memcpy(s + password.length, salt.saltvalue.data, salt.saltvalue.length);
|
||||||
DES_string_to_key_int(s, len, &tmp);
|
DES_string_to_key_int(s, len, &tmp);
|
||||||
|
@@ -50,10 +50,8 @@ DES3_string_to_key(krb5_context context,
|
|||||||
|
|
||||||
len = password.length + salt.saltvalue.length;
|
len = password.length + salt.saltvalue.length;
|
||||||
str = malloc(len);
|
str = malloc(len);
|
||||||
if(len != 0 && str == NULL) {
|
if (len != 0 && str == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
return krb5_enomem(context);
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
memcpy(str, password.data, password.length);
|
memcpy(str, password.data, password.length);
|
||||||
memcpy(str + password.length, salt.saltvalue.data, salt.saltvalue.length);
|
memcpy(str + password.length, salt.saltvalue.data, salt.saltvalue.length);
|
||||||
{
|
{
|
||||||
@@ -112,10 +110,8 @@ DES3_string_to_key_derived(krb5_context context,
|
|||||||
char *s;
|
char *s;
|
||||||
|
|
||||||
s = malloc(len);
|
s = malloc(len);
|
||||||
if(len != 0 && s == NULL) {
|
if (len != 0 && s == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
return krb5_enomem(context);
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
memcpy(s, password.data, password.length);
|
memcpy(s, password.data, password.length);
|
||||||
memcpy(s + password.length, salt.saltvalue.data, salt.saltvalue.length);
|
memcpy(s + password.length, salt.saltvalue.data, salt.saltvalue.length);
|
||||||
ret = krb5_string_to_key_derived(context,
|
ret = krb5_string_to_key_derived(context,
|
||||||
|
@@ -53,11 +53,8 @@ krb5_salttype_to_string (krb5_context context,
|
|||||||
for (st = e->keytype->string_to_key; st && st->type; st++) {
|
for (st = e->keytype->string_to_key; st && st->type; st++) {
|
||||||
if (st->type == stype) {
|
if (st->type == stype) {
|
||||||
*string = strdup (st->name);
|
*string = strdup (st->name);
|
||||||
if (*string == NULL) {
|
if (*string == NULL)
|
||||||
krb5_set_error_message (context, ENOMEM,
|
return krb5_enomem(context);
|
||||||
N_("malloc: out of memory", ""));
|
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -263,11 +260,8 @@ krb5_string_to_key_derived(krb5_context context,
|
|||||||
keylen = et->keytype->bits / 8;
|
keylen = et->keytype->bits / 8;
|
||||||
|
|
||||||
ALLOC(kd.key, 1);
|
ALLOC(kd.key, 1);
|
||||||
if(kd.key == NULL) {
|
if (kd.key == NULL)
|
||||||
krb5_set_error_message (context, ENOMEM,
|
return krb5_enomem(context);
|
||||||
N_("malloc: out of memory", ""));
|
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
ret = krb5_data_alloc(&kd.key->keyvalue, et->keytype->size);
|
ret = krb5_data_alloc(&kd.key->keyvalue, et->keytype->size);
|
||||||
if(ret) {
|
if(ret) {
|
||||||
free(kd.key);
|
free(kd.key);
|
||||||
@@ -277,13 +271,12 @@ krb5_string_to_key_derived(krb5_context context,
|
|||||||
tmp = malloc (keylen);
|
tmp = malloc (keylen);
|
||||||
if(tmp == NULL) {
|
if(tmp == NULL) {
|
||||||
krb5_free_keyblock(context, kd.key);
|
krb5_free_keyblock(context, kd.key);
|
||||||
krb5_set_error_message (context, ENOMEM, N_("malloc: out of memory", ""));
|
return krb5_enomem(context);
|
||||||
return ENOMEM;
|
|
||||||
}
|
}
|
||||||
ret = _krb5_n_fold(str, len, tmp, keylen);
|
ret = _krb5_n_fold(str, len, tmp, keylen);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
free(tmp);
|
free(tmp);
|
||||||
krb5_set_error_message (context, ENOMEM, N_("malloc: out of memory", ""));
|
krb5_enomem(context);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
kd.schedule = NULL;
|
kd.schedule = NULL;
|
||||||
|
@@ -657,11 +657,8 @@ encode_creds(krb5_context context, krb5_creds *creds, krb5_data *data)
|
|||||||
krb5_storage *sp;
|
krb5_storage *sp;
|
||||||
|
|
||||||
sp = krb5_storage_emem();
|
sp = krb5_storage_emem();
|
||||||
if (sp == NULL) {
|
if (sp == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM,
|
return krb5_enomem(context);
|
||||||
N_("malloc: out of memory", ""));
|
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = krb5_store_creds(sp, creds);
|
ret = krb5_store_creds(sp, creds);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
@@ -687,11 +684,8 @@ decode_creds(krb5_context context, const void *data, size_t length,
|
|||||||
krb5_storage *sp;
|
krb5_storage *sp;
|
||||||
|
|
||||||
sp = krb5_storage_from_readonly_mem(data, length);
|
sp = krb5_storage_from_readonly_mem(data, length);
|
||||||
if (sp == NULL) {
|
if (sp == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM,
|
return krb5_enomem(context);
|
||||||
N_("malloc: out of memory", ""));
|
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = krb5_ret_creds(sp, creds);
|
ret = krb5_ret_creds(sp, creds);
|
||||||
krb5_storage_free(sp);
|
krb5_storage_free(sp);
|
||||||
@@ -881,11 +875,8 @@ scc_get_first (krb5_context context,
|
|||||||
*cursor = NULL;
|
*cursor = NULL;
|
||||||
|
|
||||||
ctx = calloc(1, sizeof(*ctx));
|
ctx = calloc(1, sizeof(*ctx));
|
||||||
if (ctx == NULL) {
|
if (ctx == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM,
|
return krb5_enomem(context);
|
||||||
N_("malloc: out of memory", ""));
|
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = make_database(context, s);
|
ret = make_database(context, s);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
@@ -904,19 +895,15 @@ scc_get_first (krb5_context context,
|
|||||||
ret = asprintf(&name, "credIteration%pPid%d",
|
ret = asprintf(&name, "credIteration%pPid%d",
|
||||||
ctx, (int)getpid());
|
ctx, (int)getpid());
|
||||||
if (ret < 0 || name == NULL) {
|
if (ret < 0 || name == NULL) {
|
||||||
krb5_set_error_message(context, ENOMEM,
|
|
||||||
N_("malloc: out of memory", ""));
|
|
||||||
free(ctx);
|
free(ctx);
|
||||||
return ENOMEM;
|
return krb5_enomem(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = asprintf(&ctx->drop, "DROP TABLE %s", name);
|
ret = asprintf(&ctx->drop, "DROP TABLE %s", name);
|
||||||
if (ret < 0 || ctx->drop == NULL) {
|
if (ret < 0 || ctx->drop == NULL) {
|
||||||
krb5_set_error_message(context, ENOMEM,
|
|
||||||
N_("malloc: out of memory", ""));
|
|
||||||
free(name);
|
free(name);
|
||||||
free(ctx);
|
free(ctx);
|
||||||
return ENOMEM;
|
return krb5_enomem(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = asprintf(&str, "CREATE TEMPORARY TABLE %s "
|
ret = asprintf(&str, "CREATE TEMPORARY TABLE %s "
|
||||||
@@ -926,7 +913,7 @@ scc_get_first (krb5_context context,
|
|||||||
free(ctx->drop);
|
free(ctx->drop);
|
||||||
free(name);
|
free(name);
|
||||||
free(ctx);
|
free(ctx);
|
||||||
return ENOMEM;
|
return krb5_enomem(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = exec_stmt(context, s->db, str, KRB5_CC_IO);
|
ret = exec_stmt(context, s->db, str, KRB5_CC_IO);
|
||||||
@@ -1160,11 +1147,8 @@ scc_get_cache_first(krb5_context context, krb5_cc_cursor *cursor)
|
|||||||
*cursor = NULL;
|
*cursor = NULL;
|
||||||
|
|
||||||
ctx = calloc(1, sizeof(*ctx));
|
ctx = calloc(1, sizeof(*ctx));
|
||||||
if (ctx == NULL) {
|
if (ctx == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM,
|
return krb5_enomem(context);
|
||||||
N_("malloc: out of memory", ""));
|
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = default_db(context, &ctx->db);
|
ret = default_db(context, &ctx->db);
|
||||||
if (ctx->db == NULL) {
|
if (ctx->db == NULL) {
|
||||||
@@ -1175,33 +1159,27 @@ scc_get_cache_first(krb5_context context, krb5_cc_cursor *cursor)
|
|||||||
ret = asprintf(&name, "cacheIteration%pPid%d",
|
ret = asprintf(&name, "cacheIteration%pPid%d",
|
||||||
ctx, (int)getpid());
|
ctx, (int)getpid());
|
||||||
if (ret < 0 || name == NULL) {
|
if (ret < 0 || name == NULL) {
|
||||||
krb5_set_error_message(context, ENOMEM,
|
|
||||||
N_("malloc: out of memory", ""));
|
|
||||||
sqlite3_close(ctx->db);
|
sqlite3_close(ctx->db);
|
||||||
free(ctx);
|
free(ctx);
|
||||||
return ENOMEM;
|
return krb5_enomem(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = asprintf(&ctx->drop, "DROP TABLE %s", name);
|
ret = asprintf(&ctx->drop, "DROP TABLE %s", name);
|
||||||
if (ret < 0 || ctx->drop == NULL) {
|
if (ret < 0 || ctx->drop == NULL) {
|
||||||
krb5_set_error_message(context, ENOMEM,
|
|
||||||
N_("malloc: out of memory", ""));
|
|
||||||
sqlite3_close(ctx->db);
|
sqlite3_close(ctx->db);
|
||||||
free(name);
|
free(name);
|
||||||
free(ctx);
|
free(ctx);
|
||||||
return ENOMEM;
|
return krb5_enomem(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = asprintf(&str, "CREATE TEMPORARY TABLE %s AS SELECT name FROM caches",
|
ret = asprintf(&str, "CREATE TEMPORARY TABLE %s AS SELECT name FROM caches",
|
||||||
name);
|
name);
|
||||||
if (ret < 0 || str == NULL) {
|
if (ret < 0 || str == NULL) {
|
||||||
krb5_set_error_message(context, ENOMEM,
|
|
||||||
N_("malloc: out of memory", ""));
|
|
||||||
sqlite3_close(ctx->db);
|
sqlite3_close(ctx->db);
|
||||||
free(name);
|
free(name);
|
||||||
free(ctx->drop);
|
free(ctx->drop);
|
||||||
free(ctx);
|
free(ctx);
|
||||||
return ENOMEM;
|
return krb5_enomem(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = exec_stmt(context, ctx->db, str, KRB5_CC_IO);
|
ret = exec_stmt(context, ctx->db, str, KRB5_CC_IO);
|
||||||
@@ -1223,7 +1201,7 @@ scc_get_cache_first(krb5_context context, krb5_cc_cursor *cursor)
|
|||||||
free(name);
|
free(name);
|
||||||
free(ctx->drop);
|
free(ctx->drop);
|
||||||
free(ctx);
|
free(ctx);
|
||||||
return ENOMEM;
|
return krb5_enomem(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = prepare_stmt(context, ctx->db, &ctx->stmt, str);
|
ret = prepare_stmt(context, ctx->db, &ctx->stmt, str);
|
||||||
@@ -1372,11 +1350,8 @@ scc_get_default_name(krb5_context context, char **str)
|
|||||||
|
|
||||||
ret = asprintf(str, "SCC:%s", name);
|
ret = asprintf(str, "SCC:%s", name);
|
||||||
free(name);
|
free(name);
|
||||||
if (ret < 0 || *str == NULL) {
|
if (ret < 0 || *str == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM,
|
return krb5_enomem(context);
|
||||||
N_("malloc: out of memory", ""));
|
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -182,6 +182,8 @@ KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
|
|||||||
krb5_sendto_ctx_alloc(krb5_context context, krb5_sendto_ctx *ctx)
|
krb5_sendto_ctx_alloc(krb5_context context, krb5_sendto_ctx *ctx)
|
||||||
{
|
{
|
||||||
*ctx = heim_alloc(sizeof(**ctx), "sendto-context", dealloc_sendto_ctx);
|
*ctx = heim_alloc(sizeof(**ctx), "sendto-context", dealloc_sendto_ctx);
|
||||||
|
if (*ctx == NULL)
|
||||||
|
return krb5_enomem(context);
|
||||||
(*ctx)->hosts = heim_array_create();
|
(*ctx)->hosts = heim_array_create();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@@ -43,17 +43,12 @@ string_to_list (krb5_context context, const char *s, krb5_realm **list)
|
|||||||
{
|
{
|
||||||
|
|
||||||
*list = malloc (2 * sizeof(**list));
|
*list = malloc (2 * sizeof(**list));
|
||||||
if (*list == NULL) {
|
if (*list == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM,
|
return krb5_enomem(context);
|
||||||
N_("malloc: out of memory", ""));
|
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
(*list)[0] = strdup (s);
|
(*list)[0] = strdup (s);
|
||||||
if ((*list)[0] == NULL) {
|
if ((*list)[0] == NULL) {
|
||||||
free (*list);
|
free (*list);
|
||||||
krb5_set_error_message(context, ENOMEM,
|
return krb5_enomem(context);
|
||||||
N_("malloc: out of memory", ""));
|
|
||||||
return ENOMEM;
|
|
||||||
}
|
}
|
||||||
(*list)[1] = NULL;
|
(*list)[1] = NULL;
|
||||||
return 0;
|
return 0;
|
||||||
|
@@ -81,11 +81,8 @@ krb5_copy_ticket(krb5_context context,
|
|||||||
|
|
||||||
*to = NULL;
|
*to = NULL;
|
||||||
tmp = malloc(sizeof(*tmp));
|
tmp = malloc(sizeof(*tmp));
|
||||||
if(tmp == NULL) {
|
if (tmp == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM,
|
return krb5_enomem(context);
|
||||||
N_("malloc: out of memory", ""));
|
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
if((ret = copy_EncTicketPart(&from->ticket, &tmp->ticket))){
|
if((ret = copy_EncTicketPart(&from->ticket, &tmp->ticket))){
|
||||||
free(tmp);
|
free(tmp);
|
||||||
return ret;
|
return ret;
|
||||||
|
@@ -100,11 +100,8 @@ KRB5_LIB_FUNCTION int KRB5_LIB_CALL
|
|||||||
krb5_verify_opt_alloc(krb5_context context, krb5_verify_opt **opt)
|
krb5_verify_opt_alloc(krb5_context context, krb5_verify_opt **opt)
|
||||||
{
|
{
|
||||||
*opt = calloc(1, sizeof(**opt));
|
*opt = calloc(1, sizeof(**opt));
|
||||||
if ((*opt) == NULL) {
|
if ((*opt) == NULL)
|
||||||
krb5_set_error_message(context, ENOMEM,
|
return krb5_enomem(context);
|
||||||
N_("malloc: out of memory", ""));
|
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
krb5_verify_opt_init(*opt);
|
krb5_verify_opt_init(*opt);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user