use krb5_set_error_message
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@23280 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -959,14 +959,15 @@ krb5_cc_cache_get_first (krb5_context context,
|
||||
}
|
||||
|
||||
if (ops->get_cache_first == NULL) {
|
||||
krb5_set_error_string(context, "Credential cache type %s doesn't support "
|
||||
"iterations over caches", ops->prefix);
|
||||
krb5_set_error_message(context, KRB5_CC_NOSUPP,
|
||||
"Credential cache type %s doesn't support "
|
||||
"iterations over caches", ops->prefix);
|
||||
return KRB5_CC_NOSUPP;
|
||||
}
|
||||
|
||||
*cursor = calloc(1, sizeof(**cursor));
|
||||
if (*cursor == NULL) {
|
||||
krb5_set_error_string(context, "malloc - out of memory");
|
||||
krb5_set_error_message(context, ENOMEM, "malloc - out of memory");
|
||||
return ENOMEM;
|
||||
}
|
||||
|
||||
|
@@ -323,7 +323,7 @@ krb5_config_parse_file_multi (krb5_context context,
|
||||
ret = krb5_config_parse_debug (&f, res, &lineno, &str);
|
||||
fclose(f.f);
|
||||
if (ret) {
|
||||
krb5_set_error_string (context, "%s:%u: %s", fname, lineno, str);
|
||||
krb5_set_error_message (context, ret, "%s:%u: %s", fname, lineno, str);
|
||||
return ret;
|
||||
}
|
||||
return 0;
|
||||
|
@@ -68,7 +68,7 @@ set_etypes (krb5_context context,
|
||||
etypes = malloc((i+1) * sizeof(*etypes));
|
||||
if (etypes == NULL) {
|
||||
krb5_config_free_strings (etypes_str);
|
||||
krb5_set_error_string (context, "malloc: out of memory");
|
||||
krb5_set_error_message (context, ENOMEM, "malloc: out of memory");
|
||||
return ENOMEM;
|
||||
}
|
||||
for(j = 0, k = 0; j < i; j++) {
|
||||
@@ -553,7 +553,7 @@ default_etypes(krb5_context context, krb5_enctype **etype)
|
||||
ep = realloc(e, (n + 2) * sizeof(*e));
|
||||
if (ep == NULL) {
|
||||
free(e);
|
||||
krb5_set_error_string (context, "malloc: out of memory");
|
||||
krb5_set_error_message (context, ENOMEM, "malloc: out of memory");
|
||||
return ENOMEM;
|
||||
}
|
||||
e = ep;
|
||||
@@ -595,7 +595,7 @@ krb5_set_default_in_tkt_etypes(krb5_context context,
|
||||
++i;
|
||||
ALLOC(p, i);
|
||||
if(!p) {
|
||||
krb5_set_error_string (context, "malloc: out of memory");
|
||||
krb5_set_error_message (context, ENOMEM, "malloc: out of memory");
|
||||
return ENOMEM;
|
||||
}
|
||||
memmove(p, etypes, i * sizeof(krb5_enctype));
|
||||
@@ -624,26 +624,26 @@ krb5_error_code KRB5_LIB_FUNCTION
|
||||
krb5_get_default_in_tkt_etypes(krb5_context context,
|
||||
krb5_enctype **etypes)
|
||||
{
|
||||
krb5_enctype *p;
|
||||
int i;
|
||||
krb5_error_code ret;
|
||||
|
||||
if(context->etypes) {
|
||||
for(i = 0; context->etypes[i]; i++);
|
||||
++i;
|
||||
ALLOC(p, i);
|
||||
if(!p) {
|
||||
krb5_set_error_string (context, "malloc: out of memory");
|
||||
return ENOMEM;
|
||||
krb5_enctype *p;
|
||||
int i;
|
||||
krb5_error_code ret;
|
||||
|
||||
if(context->etypes) {
|
||||
for(i = 0; context->etypes[i]; i++);
|
||||
++i;
|
||||
ALLOC(p, i);
|
||||
if(!p) {
|
||||
krb5_set_error_message (context, ENOMEM, "malloc: out of memory");
|
||||
return ENOMEM;
|
||||
}
|
||||
memmove(p, context->etypes, i * sizeof(krb5_enctype));
|
||||
} else {
|
||||
ret = default_etypes(context, &p);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
memmove(p, context->etypes, i * sizeof(krb5_enctype));
|
||||
} else {
|
||||
ret = default_etypes(context, &p);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
*etypes = p;
|
||||
return 0;
|
||||
*etypes = p;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -777,7 +777,7 @@ krb5_set_extra_addresses(krb5_context context, const krb5_addresses *addresses)
|
||||
if(context->extra_addresses == NULL) {
|
||||
context->extra_addresses = malloc(sizeof(*context->extra_addresses));
|
||||
if(context->extra_addresses == NULL) {
|
||||
krb5_set_error_string (context, "malloc: out of memory");
|
||||
krb5_set_error_message (context, ENOMEM, "malloc: out of memory");
|
||||
return ENOMEM;
|
||||
}
|
||||
}
|
||||
@@ -859,7 +859,7 @@ krb5_set_ignore_addresses(krb5_context context, const krb5_addresses *addresses)
|
||||
if(context->ignore_addresses == NULL) {
|
||||
context->ignore_addresses = malloc(sizeof(*context->ignore_addresses));
|
||||
if(context->ignore_addresses == NULL) {
|
||||
krb5_set_error_string (context, "malloc: out of memory");
|
||||
krb5_set_error_message (context, ENOMEM, "malloc: out of memory");
|
||||
return ENOMEM;
|
||||
}
|
||||
}
|
||||
|
@@ -97,7 +97,7 @@ krb524_convert_creds_kdc(krb5_context context,
|
||||
sp = krb5_storage_from_mem(reply.data, reply.length);
|
||||
if(sp == NULL) {
|
||||
ret = ENOMEM;
|
||||
krb5_set_error_string (context, "malloc: out of memory");
|
||||
krb5_set_error_message (context, ENOMEM, "malloc: out of memory");
|
||||
goto out2;
|
||||
}
|
||||
krb5_ret_int32(sp, &tmp);
|
||||
@@ -132,8 +132,8 @@ krb524_convert_creds_kdc(krb5_context context,
|
||||
goto out;
|
||||
memcpy(v4creds->session, v5_creds->session.keyvalue.data, 8);
|
||||
} else {
|
||||
krb5_set_error_string(context, "converting credentials: %s",
|
||||
krb5_get_err_text(context, ret));
|
||||
krb5_set_error_message (context, ret, "converting credentials: %s",
|
||||
krb5_get_err_text(context, ret));
|
||||
}
|
||||
out:
|
||||
krb5_storage_free(sp);
|
||||
|
@@ -61,7 +61,7 @@ krb5_copy_host_realm(krb5_context context,
|
||||
|
||||
*to = calloc (n, sizeof(**to));
|
||||
if (*to == NULL) {
|
||||
krb5_set_error_string (context, "malloc: out of memory");
|
||||
krb5_set_error_message (context, ENOMEM, "malloc: out of memory");
|
||||
return ENOMEM;
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ krb5_copy_host_realm(krb5_context context,
|
||||
(*to)[i] = strdup(*p);
|
||||
if ((*to)[i] == NULL) {
|
||||
krb5_free_host_realm (context, *to);
|
||||
krb5_set_error_string (context, "malloc: out of memory");
|
||||
krb5_set_error_message (context, ENOMEM, "malloc: out of memory");
|
||||
return ENOMEM;
|
||||
}
|
||||
}
|
||||
|
@@ -38,6 +38,8 @@ RCSID("$Id$");
|
||||
#undef __attribute__
|
||||
#define __attribute__(X)
|
||||
|
||||
#ifndef HEIMDAL_SMALLER
|
||||
|
||||
/* keep this for compatibility with older code */
|
||||
krb5_error_code KRB5_LIB_FUNCTION __attribute__((deprecated))
|
||||
krb5_free_creds_contents (krb5_context context, krb5_creds *c)
|
||||
@@ -45,6 +47,8 @@ krb5_free_creds_contents (krb5_context context, krb5_creds *c)
|
||||
return krb5_free_cred_contents (context, c);
|
||||
}
|
||||
|
||||
#endif /* HEIMDAL_SMALLER */
|
||||
|
||||
/**
|
||||
* Free content of krb5_creds.
|
||||
*
|
||||
@@ -152,7 +156,7 @@ krb5_copy_creds (krb5_context context,
|
||||
|
||||
c = malloc (sizeof (*c));
|
||||
if (c == NULL) {
|
||||
krb5_set_error_string (context, "malloc: out of memory");
|
||||
krb5_set_error_message (context, ENOMEM, "malloc: out of memory");
|
||||
return ENOMEM;
|
||||
}
|
||||
memset (c, 0, sizeof(*c));
|
||||
|
@@ -192,7 +192,7 @@ krb5_copy_data(krb5_context context,
|
||||
krb5_error_code ret;
|
||||
ALLOC(*outdata, 1);
|
||||
if(*outdata == NULL) {
|
||||
krb5_set_error_string(context, "malloc: out of memory");
|
||||
krb5_set_error_message(context, ENOMEM, "malloc: out of memory");
|
||||
return ENOMEM;
|
||||
}
|
||||
ret = der_copy_octet_string(indata, *outdata);
|
||||
|
@@ -42,7 +42,7 @@ copy_hostname(krb5_context context,
|
||||
{
|
||||
*new_hostname = strdup (orig_hostname);
|
||||
if (*new_hostname == NULL) {
|
||||
krb5_set_error_string(context, "malloc: out of memory");
|
||||
krb5_set_error_message(context, ENOMEM, "malloc: out of memory");
|
||||
return ENOMEM;
|
||||
}
|
||||
strlwr (*new_hostname);
|
||||
@@ -76,7 +76,8 @@ krb5_expand_hostname (krb5_context context,
|
||||
*new_hostname = strdup (a->ai_canonname);
|
||||
freeaddrinfo (ai);
|
||||
if (*new_hostname == NULL) {
|
||||
krb5_set_error_string(context, "malloc: out of memory");
|
||||
krb5_set_error_message(context, ENOMEM,
|
||||
"malloc: out of memory");
|
||||
return ENOMEM;
|
||||
} else {
|
||||
return 0;
|
||||
|
@@ -93,12 +93,12 @@ _krb5_xlock(krb5_context context, int fd, krb5_boolean exclusive,
|
||||
ret = 0;
|
||||
break;
|
||||
case EAGAIN:
|
||||
krb5_set_error_string(context, "timed out locking cache file %s",
|
||||
filename);
|
||||
krb5_set_error_message(context, ret, "timed out locking cache file %s",
|
||||
filename);
|
||||
break;
|
||||
default:
|
||||
krb5_set_error_string(context, "error locking cache file %s: %s",
|
||||
filename, strerror(ret));
|
||||
krb5_set_error_message(context, ret, "error locking cache file %s: %s",
|
||||
filename, strerror(ret));
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
@@ -127,8 +127,9 @@ _krb5_xunlock(krb5_context context, int fd)
|
||||
ret = 0;
|
||||
break;
|
||||
default:
|
||||
krb5_set_error_string(context,
|
||||
"Failed to unlock file: %s", strerror(ret));
|
||||
krb5_set_error_message(context, ret,
|
||||
"Failed to unlock file: %s",
|
||||
strerror(ret));
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
@@ -143,7 +144,7 @@ write_storage(krb5_context context, krb5_storage *sp, int fd)
|
||||
|
||||
ret = krb5_storage_to_data(sp, &data);
|
||||
if (ret) {
|
||||
krb5_set_error_string(context, "malloc: out of memory");
|
||||
krb5_set_error_message(context, ret, "malloc: out of memory");
|
||||
return ret;
|
||||
}
|
||||
sret = write(fd, data.data, data.length);
|
||||
@@ -151,7 +152,8 @@ write_storage(krb5_context context, krb5_storage *sp, int fd)
|
||||
krb5_data_free(&data);
|
||||
if (ret) {
|
||||
ret = errno;
|
||||
krb5_set_error_string(context, "Failed to write FILE credential data");
|
||||
krb5_set_error_message(context, ret,
|
||||
"Failed to write FILE credential data");
|
||||
return ret;
|
||||
}
|
||||
return 0;
|
||||
@@ -177,13 +179,15 @@ fcc_resolve(krb5_context context, krb5_ccache *id, const char *res)
|
||||
krb5_fcache *f;
|
||||
f = malloc(sizeof(*f));
|
||||
if(f == NULL) {
|
||||
krb5_set_error_string(context, "malloc: out of memory");
|
||||
krb5_set_error_message(context, KRB5_CC_NOMEM,
|
||||
"malloc: out of memory");
|
||||
return KRB5_CC_NOMEM;
|
||||
}
|
||||
f->filename = strdup(res);
|
||||
if(f->filename == NULL){
|
||||
free(f);
|
||||
krb5_set_error_string(context, "malloc: out of memory");
|
||||
krb5_set_error_message(context, KRB5_CC_NOMEM,
|
||||
"malloc: out of memory");
|
||||
return KRB5_CC_NOMEM;
|
||||
}
|
||||
f->version = 0;
|
||||
@@ -297,19 +301,21 @@ fcc_gen_new(krb5_context context, krb5_ccache *id)
|
||||
|
||||
f = malloc(sizeof(*f));
|
||||
if(f == NULL) {
|
||||
krb5_set_error_string(context, "malloc: out of memory");
|
||||
krb5_set_error_message(context, KRB5_CC_NOMEM,
|
||||
"malloc: out of memory");
|
||||
return KRB5_CC_NOMEM;
|
||||
}
|
||||
asprintf (&file, "%sXXXXXX", KRB5_DEFAULT_CCFILE_ROOT);
|
||||
if(file == NULL) {
|
||||
free(f);
|
||||
krb5_set_error_string(context, "malloc: out of memory");
|
||||
krb5_set_error_message(context, KRB5_CC_NOMEM,
|
||||
"malloc: out of memory");
|
||||
return KRB5_CC_NOMEM;
|
||||
}
|
||||
fd = mkstemp(file);
|
||||
if(fd < 0) {
|
||||
int ret = errno;
|
||||
krb5_set_error_string(context, "mkstemp %s", file);
|
||||
krb5_set_error_message(context, ret, "mkstemp %s", file);
|
||||
free(f);
|
||||
free(file);
|
||||
return ret;
|
||||
@@ -362,8 +368,8 @@ fcc_open(krb5_context context,
|
||||
fd = open(filename, flags, mode);
|
||||
if(fd < 0) {
|
||||
ret = errno;
|
||||
krb5_set_error_string(context, "open(%s): %s", filename,
|
||||
strerror(ret));
|
||||
krb5_set_error_message(context, ret, "open(%s): %s", filename,
|
||||
strerror(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -423,8 +429,8 @@ fcc_initialize(krb5_context context,
|
||||
if (close(fd) < 0)
|
||||
if (ret == 0) {
|
||||
ret = errno;
|
||||
krb5_set_error_string (context, "close %s: %s",
|
||||
FILENAME(id), strerror(ret));
|
||||
krb5_set_error_message (context, ret, "close %s: %s",
|
||||
FILENAME(id), strerror(ret));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@@ -477,8 +483,8 @@ fcc_store_cred(krb5_context context,
|
||||
if (close(fd) < 0) {
|
||||
if (ret == 0) {
|
||||
ret = errno;
|
||||
krb5_set_error_string (context, "close %s: %s",
|
||||
FILENAME(id), strerror(ret));
|
||||
krb5_set_error_message (context, ret, "close %s: %s",
|
||||
FILENAME(id), strerror(ret));
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
@@ -509,25 +515,27 @@ init_fcc (krb5_context context,
|
||||
ret = krb5_ret_int8(sp, &pvno);
|
||||
if(ret != 0) {
|
||||
if(ret == KRB5_CC_END) {
|
||||
krb5_set_error_string(context, "Empty credential cache file: %s",
|
||||
FILENAME(id));
|
||||
ret = ENOENT;
|
||||
krb5_set_error_message(context, ret,
|
||||
"Empty credential cache file: %s",
|
||||
FILENAME(id));
|
||||
} else
|
||||
krb5_set_error_string(context, "Error reading pvno in "
|
||||
"cache file: %s", FILENAME(id));
|
||||
krb5_set_error_message(context, ret, "Error reading pvno in "
|
||||
"cache file: %s", FILENAME(id));
|
||||
goto out;
|
||||
}
|
||||
if(pvno != 5) {
|
||||
krb5_set_error_string(context, "Bad version number in credential "
|
||||
"cache file: %s", FILENAME(id));
|
||||
ret = KRB5_CCACHE_BADVNO;
|
||||
krb5_set_error_message(context, ret, "Bad version number in "
|
||||
"credential cache file: %s",
|
||||
FILENAME(id));
|
||||
goto out;
|
||||
}
|
||||
ret = krb5_ret_int8(sp, &tag); /* should not be host byte order */
|
||||
if(ret != 0) {
|
||||
krb5_set_error_string(context, "Error reading tag in "
|
||||
"cache file: %s", FILENAME(id));
|
||||
ret = KRB5_CC_FORMAT;
|
||||
krb5_set_error_message(context, ret, "Error reading tag in "
|
||||
"cache file: %s", FILENAME(id));
|
||||
goto out;
|
||||
}
|
||||
FCACHE(id)->version = tag;
|
||||
@@ -539,8 +547,9 @@ init_fcc (krb5_context context,
|
||||
ret = krb5_ret_int16 (sp, &length);
|
||||
if(ret) {
|
||||
ret = KRB5_CC_FORMAT;
|
||||
krb5_set_error_string(context, "Error reading tag length in "
|
||||
"cache file: %s", FILENAME(id));
|
||||
krb5_set_error_message(context, ret,
|
||||
"Error reading tag length in "
|
||||
"cache file: %s", FILENAME(id));
|
||||
goto out;
|
||||
}
|
||||
while(length > 0) {
|
||||
@@ -550,32 +559,32 @@ init_fcc (krb5_context context,
|
||||
|
||||
ret = krb5_ret_int16 (sp, &dtag);
|
||||
if(ret) {
|
||||
krb5_set_error_string(context, "Error reading dtag in "
|
||||
"cache file: %s", FILENAME(id));
|
||||
ret = KRB5_CC_FORMAT;
|
||||
krb5_set_error_message(context, ret, "Error reading dtag in "
|
||||
"cache file: %s", FILENAME(id));
|
||||
goto out;
|
||||
}
|
||||
ret = krb5_ret_int16 (sp, &data_len);
|
||||
if(ret) {
|
||||
krb5_set_error_string(context, "Error reading dlength in "
|
||||
"cache file: %s", FILENAME(id));
|
||||
ret = KRB5_CC_FORMAT;
|
||||
krb5_set_error_message(context, ret, "Error reading dlength in "
|
||||
"cache file: %s", FILENAME(id));
|
||||
goto out;
|
||||
}
|
||||
switch (dtag) {
|
||||
case FCC_TAG_DELTATIME :
|
||||
ret = krb5_ret_int32 (sp, &context->kdc_sec_offset);
|
||||
if(ret) {
|
||||
krb5_set_error_string(context, "Error reading kdc_sec in "
|
||||
"cache file: %s", FILENAME(id));
|
||||
ret = KRB5_CC_FORMAT;
|
||||
krb5_set_error_message(context, ret, "Error reading kdc_sec in "
|
||||
"cache file: %s", FILENAME(id));
|
||||
goto out;
|
||||
}
|
||||
ret = krb5_ret_int32 (sp, &context->kdc_usec_offset);
|
||||
if(ret) {
|
||||
krb5_set_error_string(context, "Error reading kdc_usec in "
|
||||
"cache file: %s", FILENAME(id));
|
||||
ret = KRB5_CC_FORMAT;
|
||||
krb5_set_error_message(context, ret, "Error reading kdc_usec in "
|
||||
"cache file: %s", FILENAME(id));
|
||||
goto out;
|
||||
}
|
||||
break;
|
||||
@@ -583,10 +592,11 @@ init_fcc (krb5_context context,
|
||||
for (i = 0; i < data_len; ++i) {
|
||||
ret = krb5_ret_int8 (sp, &dummy);
|
||||
if(ret) {
|
||||
krb5_set_error_string(context, "Error reading unknown "
|
||||
"tag in cache file: %s",
|
||||
FILENAME(id));
|
||||
ret = KRB5_CC_FORMAT;
|
||||
krb5_set_error_message(context, ret,
|
||||
"Error reading unknown "
|
||||
"tag in cache file: %s",
|
||||
FILENAME(id));
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
@@ -602,9 +612,9 @@ init_fcc (krb5_context context,
|
||||
break;
|
||||
default :
|
||||
ret = KRB5_CCACHE_BADVNO;
|
||||
krb5_set_error_string(context, "Unknown version number (%d) in "
|
||||
"credential cache file: %s",
|
||||
(int)tag, FILENAME(id));
|
||||
krb5_set_error_message(context, ret, "Unknown version number (%d) in "
|
||||
"credential cache file: %s",
|
||||
(int)tag, FILENAME(id));
|
||||
goto out;
|
||||
}
|
||||
*ret_sp = sp;
|
||||
@@ -655,7 +665,7 @@ fcc_get_first (krb5_context context,
|
||||
|
||||
*cursor = malloc(sizeof(struct fcc_cursor));
|
||||
if (*cursor == NULL) {
|
||||
krb5_set_error_string (context, "malloc: out of memory");
|
||||
krb5_set_error_message(context, ENOMEM, "malloc: out of memory");
|
||||
return ENOMEM;
|
||||
}
|
||||
memset(*cursor, 0, sizeof(struct fcc_cursor));
|
||||
@@ -775,7 +785,7 @@ fcc_get_cache_first(krb5_context context, krb5_cc_cursor *cursor)
|
||||
|
||||
iter = calloc(1, sizeof(*iter));
|
||||
if (iter == NULL) {
|
||||
krb5_set_error_string(context, "malloc - out of memory");
|
||||
krb5_set_error_message(context, ENOMEM, "malloc - out of memory");
|
||||
return ENOMEM;
|
||||
}
|
||||
iter->first = 1;
|
||||
@@ -828,10 +838,10 @@ fcc_move(krb5_context context, krb5_ccache from, krb5_ccache to)
|
||||
ret = rename(FILENAME(from), FILENAME(to));
|
||||
if (ret && errno != EXDEV) {
|
||||
ret = errno;
|
||||
krb5_set_error_string(context,
|
||||
"Rename of file from %s to %s failed: %s",
|
||||
FILENAME(from), FILENAME(to),
|
||||
strerror(ret));
|
||||
krb5_set_error_message(context, ret,
|
||||
"Rename of file from %s to %s failed: %s",
|
||||
FILENAME(from), FILENAME(to),
|
||||
strerror(ret));
|
||||
return ret;
|
||||
} else if (ret && errno == EXDEV) {
|
||||
/* make a copy and delete the orignal */
|
||||
@@ -854,17 +864,17 @@ fcc_move(krb5_context context, krb5_ccache from, krb5_ccache to)
|
||||
sz2 = write(fd2, buf, sz1);
|
||||
if (sz1 != sz2) {
|
||||
ret = EIO;
|
||||
krb5_set_error_string(context,
|
||||
"Failed to write data from one file "
|
||||
"credential cache to the other");
|
||||
krb5_set_error_message(context, ret,
|
||||
"Failed to write data from one file "
|
||||
"credential cache to the other");
|
||||
goto out2;
|
||||
}
|
||||
}
|
||||
if (sz1 < 0) {
|
||||
ret = EIO;
|
||||
krb5_set_error_string(context,
|
||||
"Failed to read data from one file "
|
||||
"credential cache to the other");
|
||||
krb5_set_error_message(context, ret,
|
||||
"Failed to read data from one file "
|
||||
"credential cache to the other");
|
||||
goto out2;
|
||||
}
|
||||
out2:
|
||||
|
@@ -53,7 +53,7 @@ krb5_generate_subkey_extended(krb5_context context,
|
||||
|
||||
ALLOC(*subkey, 1);
|
||||
if (*subkey == NULL) {
|
||||
krb5_set_error_string(context, "malloc: out of memory");
|
||||
krb5_set_error_message(context, ENOMEM, "malloc: out of memory");
|
||||
return ENOMEM;
|
||||
}
|
||||
|
||||
|
@@ -54,20 +54,20 @@ gethostname_fallback (krb5_context context, krb5_addresses *res)
|
||||
|
||||
if (gethostname (hostname, sizeof(hostname))) {
|
||||
ret = errno;
|
||||
krb5_set_error_string (context, "gethostname: %s", strerror(ret));
|
||||
krb5_set_error_message(context, ret, "gethostname: %s", strerror(ret));
|
||||
return ret;
|
||||
}
|
||||
hostent = roken_gethostbyname (hostname);
|
||||
if (hostent == NULL) {
|
||||
ret = errno;
|
||||
krb5_set_error_string (context, "gethostbyname %s: %s",
|
||||
hostname, strerror(ret));
|
||||
krb5_set_error_message (context, ret, "gethostbyname %s: %s",
|
||||
hostname, strerror(ret));
|
||||
return ret;
|
||||
}
|
||||
res->len = 1;
|
||||
res->val = malloc (sizeof(*res->val));
|
||||
if (res->val == NULL) {
|
||||
krb5_set_error_string(context, "malloc: out of memory");
|
||||
krb5_set_error_message(context, ENOMEM, "malloc: out of memory");
|
||||
return ENOMEM;
|
||||
}
|
||||
res->val[0].addr_type = hostent->h_addrtype;
|
||||
@@ -108,7 +108,7 @@ find_all_addresses (krb5_context context, krb5_addresses *res, int flags)
|
||||
|
||||
if (getifaddrs(&ifa0) == -1) {
|
||||
ret = errno;
|
||||
krb5_set_error_string(context, "getifaddrs: %s", strerror(ret));
|
||||
krb5_set_error_message(context, ret, "getifaddrs: %s", strerror(ret));
|
||||
return (ret);
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@ find_all_addresses (krb5_context context, krb5_addresses *res, int flags)
|
||||
|
||||
if (num == 0) {
|
||||
freeifaddrs(ifa0);
|
||||
krb5_set_error_string(context, "no addresses found");
|
||||
krb5_set_error_message(context, ENXIO, "no addresses found");
|
||||
return (ENXIO);
|
||||
}
|
||||
|
||||
@@ -136,8 +136,8 @@ find_all_addresses (krb5_context context, krb5_addresses *res, int flags)
|
||||
if (res->val == NULL) {
|
||||
krb5_free_addresses(context, &ignore_addresses);
|
||||
freeifaddrs(ifa0);
|
||||
krb5_set_error_string (context, "malloc: out of memory");
|
||||
return (ENOMEM);
|
||||
krb5_set_error_message (context, ENOMEM, "malloc: out of memory");
|
||||
return ENOMEM;
|
||||
}
|
||||
|
||||
/* Now traverse the list. */
|
||||
|
@@ -99,7 +99,7 @@ set_auth_data (krb5_context context,
|
||||
ALLOC(req_body->enc_authorization_data, 1);
|
||||
if (req_body->enc_authorization_data == NULL) {
|
||||
free (buf);
|
||||
krb5_set_error_string(context, "malloc: out of memory");
|
||||
krb5_set_error_message(context, ENOMEM, "malloc: out of memory");
|
||||
return ENOMEM;
|
||||
}
|
||||
ret = krb5_crypto_init(context, key, 0, &crypto);
|
||||
@@ -153,7 +153,7 @@ init_tgs_req (krb5_context context,
|
||||
ALLOC_SEQ(&t->req_body.etype, 1);
|
||||
if(t->req_body.etype.val == NULL) {
|
||||
ret = ENOMEM;
|
||||
krb5_set_error_string(context, "malloc: out of memory");
|
||||
krb5_set_error_message(context, ret, "malloc: out of memory");
|
||||
goto fail;
|
||||
}
|
||||
t->req_body.etype.val[0] = in_creds->session.keytype;
|
||||
@@ -173,7 +173,7 @@ init_tgs_req (krb5_context context,
|
||||
ALLOC(t->req_body.sname, 1);
|
||||
if (t->req_body.sname == NULL) {
|
||||
ret = ENOMEM;
|
||||
krb5_set_error_string(context, "malloc: out of memory");
|
||||
krb5_set_error_message(context, ret, "malloc: out of memory");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
@@ -189,7 +189,7 @@ init_tgs_req (krb5_context context,
|
||||
ALLOC(t->req_body.till, 1);
|
||||
if(t->req_body.till == NULL){
|
||||
ret = ENOMEM;
|
||||
krb5_set_error_string(context, "malloc: out of memory");
|
||||
krb5_set_error_message(context, ret, "malloc: out of memory");
|
||||
goto fail;
|
||||
}
|
||||
*t->req_body.till = in_creds->times.endtime;
|
||||
@@ -199,13 +199,13 @@ init_tgs_req (krb5_context context,
|
||||
ALLOC(t->req_body.additional_tickets, 1);
|
||||
if (t->req_body.additional_tickets == NULL) {
|
||||
ret = ENOMEM;
|
||||
krb5_set_error_string(context, "malloc: out of memory");
|
||||
krb5_set_error_message(context, ret, "malloc: out of memory");
|
||||
goto fail;
|
||||
}
|
||||
ALLOC_SEQ(t->req_body.additional_tickets, 1);
|
||||
if (t->req_body.additional_tickets->val == NULL) {
|
||||
ret = ENOMEM;
|
||||
krb5_set_error_string(context, "malloc: out of memory");
|
||||
krb5_set_error_message(context, ret, "malloc: out of memory");
|
||||
goto fail;
|
||||
}
|
||||
ret = copy_Ticket(second_ticket, t->req_body.additional_tickets->val);
|
||||
@@ -215,13 +215,13 @@ init_tgs_req (krb5_context context,
|
||||
ALLOC(t->padata, 1);
|
||||
if (t->padata == NULL) {
|
||||
ret = ENOMEM;
|
||||
krb5_set_error_string(context, "malloc: out of memory");
|
||||
krb5_set_error_message(context, ret, "malloc: out of memory");
|
||||
goto fail;
|
||||
}
|
||||
ALLOC_SEQ(t->padata, 1 + padata->len);
|
||||
if (t->padata->val == NULL) {
|
||||
ret = ENOMEM;
|
||||
krb5_set_error_string(context, "malloc: out of memory");
|
||||
krb5_set_error_message(context, ret, "malloc: out of memory");
|
||||
goto fail;
|
||||
}
|
||||
{
|
||||
@@ -229,7 +229,7 @@ init_tgs_req (krb5_context context,
|
||||
for (i = 0; i < padata->len; i++) {
|
||||
ret = copy_PA_DATA(&padata->val[i], &t->padata->val[i + 1]);
|
||||
if (ret) {
|
||||
krb5_set_error_string(context, "malloc: out of memory");
|
||||
krb5_set_error_message(context, ret, "malloc: out of memory");
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
@@ -638,7 +638,7 @@ krb5_get_kdc_cred(krb5_context context,
|
||||
|
||||
*out_creds = calloc(1, sizeof(**out_creds));
|
||||
if(*out_creds == NULL) {
|
||||
krb5_set_error_string(context, "malloc: out of memory");
|
||||
krb5_set_error_message(context, ENOMEM, "malloc: out of memory");
|
||||
return ENOMEM;
|
||||
}
|
||||
ret = _krb5_get_krbtgt (context,
|
||||
@@ -657,8 +657,8 @@ krb5_get_kdc_cred(krb5_context context,
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void
|
||||
not_found(krb5_context context, krb5_const_principal p)
|
||||
static int
|
||||
not_found(krb5_context context, krb5_const_principal p, krb5_error_code code)
|
||||
{
|
||||
krb5_error_code ret;
|
||||
char *str;
|
||||
@@ -666,10 +666,11 @@ not_found(krb5_context context, krb5_const_principal p)
|
||||
ret = krb5_unparse_name(context, p, &str);
|
||||
if(ret) {
|
||||
krb5_clear_error_string(context);
|
||||
return;
|
||||
return code;
|
||||
}
|
||||
krb5_set_error_string(context, "Matching credential (%s) not found", str);
|
||||
krb5_set_error_message(context, code, "Matching credential (%s) not found", str);
|
||||
free(str);
|
||||
return code;
|
||||
}
|
||||
|
||||
static krb5_error_code
|
||||
@@ -696,8 +697,7 @@ find_cred(krb5_context context,
|
||||
}
|
||||
tgts++;
|
||||
}
|
||||
not_found(context, server);
|
||||
return KRB5_CC_NOTFOUND;
|
||||
return not_found(context, server, KRB5_CC_NOTFOUND);
|
||||
}
|
||||
|
||||
static krb5_error_code
|
||||
@@ -710,7 +710,7 @@ add_cred(krb5_context context, krb5_creds const *tkt, krb5_creds ***tgts)
|
||||
for(i = 0; tmp && tmp[i]; i++); /* XXX */
|
||||
tmp = realloc(tmp, (i+2)*sizeof(*tmp));
|
||||
if(tmp == NULL) {
|
||||
krb5_set_error_string(context, "malloc: out of memory");
|
||||
krb5_set_error_message(context, ENOMEM, "malloc: out of memory");
|
||||
return ENOMEM;
|
||||
}
|
||||
*tgts = tmp;
|
||||
@@ -780,8 +780,8 @@ get_cred_kdc_capath(krb5_context context,
|
||||
if(ret == 0){
|
||||
*out_creds = calloc(1, sizeof(**out_creds));
|
||||
if(*out_creds == NULL) {
|
||||
krb5_set_error_string(context, "malloc: out of memory");
|
||||
ret = ENOMEM;
|
||||
krb5_set_error_message(context, ret, "malloc: out of memory");
|
||||
} else {
|
||||
ret = get_cred_kdc_address(context, ccache, flags, NULL,
|
||||
in_creds, &tgts,
|
||||
@@ -799,10 +799,9 @@ get_cred_kdc_capath(krb5_context context,
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
if(krb5_realm_compare(context, in_creds->client, in_creds->server)) {
|
||||
not_found(context, in_creds->server);
|
||||
return KRB5_CC_NOTFOUND;
|
||||
}
|
||||
if(krb5_realm_compare(context, in_creds->client, in_creds->server))
|
||||
return not_found(context, in_creds->server, KRB5_CC_NOTFOUND);
|
||||
|
||||
/* XXX this can loop forever */
|
||||
while(1){
|
||||
heim_general_string tgt_inst;
|
||||
@@ -843,8 +842,8 @@ get_cred_kdc_capath(krb5_context context,
|
||||
krb5_free_principal(context, tmp_creds.client);
|
||||
*out_creds = calloc(1, sizeof(**out_creds));
|
||||
if(*out_creds == NULL) {
|
||||
krb5_set_error_string(context, "malloc: out of memory");
|
||||
ret = ENOMEM;
|
||||
krb5_set_error_message(context, ret, "malloc: out of memory");
|
||||
} else {
|
||||
ret = get_cred_kdc_address (context, ccache, flags, NULL,
|
||||
in_creds, tgt, impersonate_principal,
|
||||
@@ -943,8 +942,8 @@ get_cred_kdc_referral(krb5_context context,
|
||||
if (ticket.server->name.name_string.len != 2 &&
|
||||
strcmp(ticket.server->name.name_string.val[0], KRB5_TGS_NAME) != 0)
|
||||
{
|
||||
krb5_set_error_string(context,
|
||||
"Got back an non krbtgt ticket referrals");
|
||||
krb5_set_error_message(context, KRB5KRB_AP_ERR_NOT_US,
|
||||
"Got back an non krbtgt ticket referrals");
|
||||
krb5_free_cred_contents(context, &ticket);
|
||||
return KRB5KRB_AP_ERR_NOT_US;
|
||||
}
|
||||
@@ -963,10 +962,10 @@ get_cred_kdc_referral(krb5_context context,
|
||||
&mcreds,
|
||||
*tickets))
|
||||
{
|
||||
krb5_set_error_string(context,
|
||||
"Referral from %s loops back to realm %s",
|
||||
tgt.server->realm,
|
||||
referral_realm);
|
||||
krb5_set_error_message(context, KRB5_GET_IN_TKT_LOOP,
|
||||
"Referral from %s loops back to realm %s",
|
||||
tgt.server->realm,
|
||||
referral_realm);
|
||||
krb5_free_cred_contents(context, &ticket);
|
||||
return KRB5_GET_IN_TKT_LOOP;
|
||||
}
|
||||
@@ -1080,7 +1079,7 @@ krb5_get_credentials_with_flags(krb5_context context,
|
||||
*out_creds = NULL;
|
||||
res_creds = calloc(1, sizeof(*res_creds));
|
||||
if (res_creds == NULL) {
|
||||
krb5_set_error_string(context, "malloc: out of memory");
|
||||
krb5_set_error_message(context, ENOMEM, "malloc: out of memory");
|
||||
return ENOMEM;
|
||||
}
|
||||
|
||||
@@ -1122,10 +1121,9 @@ krb5_get_credentials_with_flags(krb5_context context,
|
||||
return ret;
|
||||
}
|
||||
free(res_creds);
|
||||
if(options & KRB5_GC_CACHED) {
|
||||
not_found(context, in_creds->server);
|
||||
return KRB5_CC_NOTFOUND;
|
||||
}
|
||||
if(options & KRB5_GC_CACHED)
|
||||
return not_found(context, in_creds->server, KRB5_CC_NOTFOUND);
|
||||
|
||||
if(options & KRB5_GC_USER_USER)
|
||||
flags.b.enc_tkt_in_skey = 1;
|
||||
if (flags.b.enc_tkt_in_skey)
|
||||
@@ -1170,7 +1168,7 @@ krb5_get_creds_opt_alloc(krb5_context context, krb5_get_creds_opt *opt)
|
||||
{
|
||||
*opt = calloc(1, sizeof(**opt));
|
||||
if (*opt == NULL) {
|
||||
krb5_set_error_string(context, "malloc: out of memory");
|
||||
krb5_set_error_message(context, ENOMEM, "malloc: out of memory");
|
||||
return ENOMEM;
|
||||
}
|
||||
return 0;
|
||||
@@ -1234,14 +1232,14 @@ krb5_get_creds_opt_set_ticket(krb5_context context,
|
||||
|
||||
opt->ticket = malloc(sizeof(*ticket));
|
||||
if (opt->ticket == NULL) {
|
||||
krb5_set_error_string(context, "malloc: out of memory");
|
||||
krb5_set_error_message(context, ENOMEM, "malloc: out of memory");
|
||||
return ENOMEM;
|
||||
}
|
||||
ret = copy_Ticket(ticket, opt->ticket);
|
||||
if (ret) {
|
||||
free(opt->ticket);
|
||||
opt->ticket = NULL;
|
||||
krb5_set_error_string(context, "malloc: out of memory");
|
||||
krb5_set_error_message(context, ret, "malloc: out of memory");
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
@@ -1279,7 +1277,7 @@ krb5_get_creds(krb5_context context,
|
||||
res_creds = calloc(1, sizeof(*res_creds));
|
||||
if (res_creds == NULL) {
|
||||
krb5_free_principal(context, in_creds.client);
|
||||
krb5_set_error_string(context, "malloc: out of memory");
|
||||
krb5_set_error_message(context, ENOMEM, "malloc: out of memory");
|
||||
return ENOMEM;
|
||||
}
|
||||
|
||||
@@ -1326,9 +1324,8 @@ krb5_get_creds(krb5_context context,
|
||||
}
|
||||
free(res_creds);
|
||||
if(options & KRB5_GC_CACHED) {
|
||||
not_found(context, in_creds.server);
|
||||
krb5_free_principal(context, in_creds.client);
|
||||
return KRB5_CC_NOTFOUND;
|
||||
return not_found(context, in_creds.server, KRB5_CC_NOTFOUND);
|
||||
}
|
||||
if(options & KRB5_GC_USER_USER) {
|
||||
flags.b.enc_tkt_in_skey = 1;
|
||||
|
@@ -85,8 +85,8 @@ _krb5_get_default_principal_local (krb5_context context,
|
||||
user = getlogin();
|
||||
}
|
||||
if(user == NULL) {
|
||||
krb5_set_error_string(context,
|
||||
"unable to figure out current principal");
|
||||
krb5_set_error_message(context, ENOTTY,
|
||||
"unable to figure out current principal");
|
||||
return ENOTTY; /* XXX */
|
||||
}
|
||||
ret = krb5_make_principal(context, princ, NULL, user, NULL);
|
||||
|
@@ -76,7 +76,7 @@ krb5_get_default_realm(krb5_context context,
|
||||
|
||||
res = strdup (context->default_realms[0]);
|
||||
if (res == NULL) {
|
||||
krb5_set_error_string(context, "malloc: out of memory");
|
||||
krb5_set_error_message(context, ENOMEM, "malloc: out of memory");
|
||||
return ENOMEM;
|
||||
}
|
||||
*realm = res;
|
||||
|
@@ -147,7 +147,7 @@ write_v4_cc(krb5_context context, const char *tkfile,
|
||||
|
||||
ret = get_krb4_cc_name(tkfile, &path);
|
||||
if (ret) {
|
||||
krb5_set_error_string(context,
|
||||
krb5_set_error_message(context, ret,
|
||||
"krb5_krb_tf_setup: failed getting "
|
||||
"the krb4 credentials cache name");
|
||||
return ret;
|
||||
@@ -156,7 +156,7 @@ write_v4_cc(krb5_context context, const char *tkfile,
|
||||
fd = open(path, O_WRONLY|O_CREAT, 0600);
|
||||
if (fd < 0) {
|
||||
ret = errno;
|
||||
krb5_set_error_string(context,
|
||||
krb5_set_error_message(context, ret,
|
||||
"krb5_krb_tf_setup: error opening file %s",
|
||||
path);
|
||||
free(path);
|
||||
@@ -164,7 +164,7 @@ write_v4_cc(krb5_context context, const char *tkfile,
|
||||
}
|
||||
|
||||
if (fstat(fd, &sb) != 0 || !S_ISREG(sb.st_mode)) {
|
||||
krb5_set_error_string(context,
|
||||
krb5_set_error_message(context, ret,
|
||||
"krb5_krb_tf_setup: tktfile %s is not a file",
|
||||
path);
|
||||
free(path);
|
||||
@@ -179,9 +179,9 @@ write_v4_cc(krb5_context context, const char *tkfile,
|
||||
break;
|
||||
}
|
||||
if (i == KRB5_TF_LCK_RETRY_COUNT) {
|
||||
krb5_set_error_string(context,
|
||||
"krb5_krb_tf_setup: failed to lock %s",
|
||||
path);
|
||||
krb5_set_error_message(context, KRB5_FCC_PERM,
|
||||
"krb5_krb_tf_setup: failed to lock %s",
|
||||
path);
|
||||
free(path);
|
||||
close(fd);
|
||||
return KRB5_FCC_PERM;
|
||||
@@ -191,9 +191,9 @@ write_v4_cc(krb5_context context, const char *tkfile,
|
||||
ret = ftruncate(fd, 0);
|
||||
if (ret < 0) {
|
||||
flock(fd, LOCK_UN);
|
||||
krb5_set_error_string(context,
|
||||
"krb5_krb_tf_setup: failed to truncate %s",
|
||||
path);
|
||||
krb5_set_error_message(context, KRB5_FCC_PERM,
|
||||
"krb5_krb_tf_setup: failed to truncate %s",
|
||||
path);
|
||||
free(path);
|
||||
close(fd);
|
||||
return KRB5_FCC_PERM;
|
||||
@@ -291,7 +291,7 @@ _krb5_krb_dest_tkt(krb5_context context, const char *tkfile)
|
||||
|
||||
ret = get_krb4_cc_name(tkfile, &path);
|
||||
if (ret) {
|
||||
krb5_set_error_string(context,
|
||||
krb5_set_error_message(context, ret,
|
||||
"krb5_krb_tf_setup: failed getting "
|
||||
"the krb4 credentials cache name");
|
||||
return ret;
|
||||
@@ -299,7 +299,7 @@ _krb5_krb_dest_tkt(krb5_context context, const char *tkfile)
|
||||
|
||||
if (unlink(path) < 0) {
|
||||
ret = errno;
|
||||
krb5_set_error_string(context,
|
||||
krb5_set_error_message(context, ret,
|
||||
"krb5_krb_dest_tkt failed removing the cache "
|
||||
"with error %s", strerror(ret));
|
||||
}
|
||||
@@ -421,7 +421,7 @@ _krb5_krb_create_ticket(krb5_context context,
|
||||
|
||||
sp = krb5_storage_emem();
|
||||
if (sp == NULL) {
|
||||
krb5_set_error_string(context, "malloc: out of memory");
|
||||
krb5_set_error_message(context, ENOMEM, "malloc: out of memory");
|
||||
return ENOMEM;
|
||||
}
|
||||
krb5_storage_set_byteorder(sp, KRB5_STORAGE_BYTEORDER_BE);
|
||||
@@ -448,7 +448,7 @@ _krb5_krb_create_ticket(krb5_context context,
|
||||
error:
|
||||
krb5_storage_free(sp);
|
||||
if (ret)
|
||||
krb5_set_error_string(context, "Failed to encode kerberos 4 ticket");
|
||||
krb5_set_error_message(context, ret, "Failed to encode kerberos 4 ticket");
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -477,7 +477,7 @@ _krb5_krb_create_ciph(krb5_context context,
|
||||
|
||||
sp = krb5_storage_emem();
|
||||
if (sp == NULL) {
|
||||
krb5_set_error_string(context, "malloc: out of memory");
|
||||
krb5_set_error_message(context, ENOMEM, "malloc: out of memory");
|
||||
return ENOMEM;
|
||||
}
|
||||
krb5_storage_set_byteorder(sp, KRB5_STORAGE_BYTEORDER_BE);
|
||||
@@ -507,7 +507,7 @@ _krb5_krb_create_ciph(krb5_context context,
|
||||
error:
|
||||
krb5_storage_free(sp);
|
||||
if (ret)
|
||||
krb5_set_error_string(context, "Failed to encode kerberos 4 ticket");
|
||||
krb5_set_error_message(context, ret, "Failed to encode kerberos 4 ticket");
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -535,7 +535,7 @@ _krb5_krb_create_auth_reply(krb5_context context,
|
||||
|
||||
sp = krb5_storage_emem();
|
||||
if (sp == NULL) {
|
||||
krb5_set_error_string(context, "malloc: out of memory");
|
||||
krb5_set_error_message(context, ENOMEM, "malloc: out of memory");
|
||||
return ENOMEM;
|
||||
}
|
||||
krb5_storage_set_byteorder(sp, KRB5_STORAGE_BYTEORDER_BE);
|
||||
@@ -559,7 +559,7 @@ _krb5_krb_create_auth_reply(krb5_context context,
|
||||
error:
|
||||
krb5_storage_free(sp);
|
||||
if (ret)
|
||||
krb5_set_error_string(context, "Failed to encode kerberos 4 ticket");
|
||||
krb5_set_error_message(context, ret, "Failed to encode kerberos 4 ticket");
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -590,7 +590,7 @@ _krb5_krb_cr_err_reply(krb5_context context,
|
||||
|
||||
sp = krb5_storage_emem();
|
||||
if (sp == NULL) {
|
||||
krb5_set_error_string(context, "malloc: out of memory");
|
||||
krb5_set_error_message(context, ENOMEM, "malloc: out of memory");
|
||||
return ENOMEM;
|
||||
}
|
||||
krb5_storage_set_byteorder(sp, KRB5_STORAGE_BYTEORDER_BE);
|
||||
@@ -610,7 +610,7 @@ _krb5_krb_cr_err_reply(krb5_context context,
|
||||
error:
|
||||
krb5_storage_free(sp);
|
||||
if (ret)
|
||||
krb5_set_error_string(context, "Failed to encode kerberos 4 error");
|
||||
krb5_set_error_message(context, ret, "Failed to encode kerberos 4 error");
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -661,7 +661,7 @@ _krb5_krb_decomp_ticket(krb5_context context,
|
||||
sp = krb5_storage_from_data(&ticket);
|
||||
if (sp == NULL) {
|
||||
krb5_data_free(&ticket);
|
||||
krb5_set_error_string(context, "alloc: out of memory");
|
||||
krb5_set_error_message(context, ENOMEM, "alloc: out of memory");
|
||||
return ENOMEM;
|
||||
}
|
||||
|
||||
@@ -720,7 +720,7 @@ _krb5_krb_decomp_ticket(krb5_context context,
|
||||
*sinstance = NULL;
|
||||
}
|
||||
_krb5_krb_free_auth_data(context, ad);
|
||||
krb5_set_error_string(context, "Failed to decode v4 ticket");
|
||||
krb5_set_error_message(context, ret, "Failed to decode v4 ticket");
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@@ -769,7 +769,7 @@ _krb5_krb_rd_req(krb5_context context,
|
||||
|
||||
sp = krb5_storage_from_data(authent);
|
||||
if (sp == NULL) {
|
||||
krb5_set_error_string(context, "alloc: out of memory");
|
||||
krb5_set_error_message(context, ENOMEM, "alloc: out of memory");
|
||||
return ENOMEM;
|
||||
}
|
||||
|
||||
@@ -777,19 +777,19 @@ _krb5_krb_rd_req(krb5_context context,
|
||||
|
||||
ret = krb5_ret_int8(sp, &pvno);
|
||||
if (ret) {
|
||||
krb5_set_error_string(context, "Failed reading v4 pvno");
|
||||
krb5_set_error_message(context, ret, "Failed reading v4 pvno");
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (pvno != KRB_PROT_VERSION) {
|
||||
ret = KRB4ET_RD_AP_VERSION;
|
||||
krb5_set_error_string(context, "Failed v4 pvno not 4");
|
||||
krb5_set_error_message(context, ret, "Failed v4 pvno not 4");
|
||||
goto error;
|
||||
}
|
||||
|
||||
ret = krb5_ret_int8(sp, &type);
|
||||
if (ret) {
|
||||
krb5_set_error_string(context, "Failed readin v4 type");
|
||||
krb5_set_error_message(context, ret, "Failed readin v4 type");
|
||||
goto error;
|
||||
}
|
||||
|
||||
@@ -798,7 +798,7 @@ _krb5_krb_rd_req(krb5_context context,
|
||||
|
||||
if(type != AUTH_MSG_APPL_REQUEST && type != AUTH_MSG_APPL_REQUEST_MUTUAL) {
|
||||
ret = KRB4ET_RD_AP_MSG_TYPE;
|
||||
krb5_set_error_string(context, "Not a valid v4 request type");
|
||||
krb5_set_error_message(context, ret, "Not a valid v4 request type");
|
||||
goto error;
|
||||
}
|
||||
|
||||
@@ -811,7 +811,7 @@ _krb5_krb_rd_req(krb5_context context,
|
||||
size = krb5_storage_read(sp, ticket.data, ticket.length);
|
||||
if (size != ticket.length) {
|
||||
ret = KRB4ET_INTK_PROT;
|
||||
krb5_set_error_string(context, "Failed reading v4 ticket");
|
||||
krb5_set_error_message(context, ret, "Failed reading v4 ticket");
|
||||
goto error;
|
||||
}
|
||||
|
||||
@@ -826,7 +826,7 @@ _krb5_krb_rd_req(krb5_context context,
|
||||
size = krb5_storage_read(sp, eaut.data, eaut.length);
|
||||
if (size != eaut.length) {
|
||||
ret = KRB4ET_INTK_PROT;
|
||||
krb5_set_error_string(context, "Failed reading v4 authenticator");
|
||||
krb5_set_error_message(context, ret, "Failed reading v4 authenticator");
|
||||
goto error;
|
||||
}
|
||||
|
||||
@@ -840,7 +840,7 @@ _krb5_krb_rd_req(krb5_context context,
|
||||
sp = krb5_storage_from_data(&aut);
|
||||
if (sp == NULL) {
|
||||
ret = ENOMEM;
|
||||
krb5_set_error_string(context, "alloc: out of memory");
|
||||
krb5_set_error_message(context, ret, "alloc: out of memory");
|
||||
goto error;
|
||||
}
|
||||
|
||||
@@ -860,14 +860,14 @@ _krb5_krb_rd_req(krb5_context context,
|
||||
if (strcmp(ad->pname, r_name) != 0 ||
|
||||
strcmp(ad->pinst, r_instance) != 0 ||
|
||||
strcmp(ad->prealm, r_realm) != 0) {
|
||||
krb5_set_error_string(context, "v4 principal mismatch");
|
||||
ret = KRB4ET_RD_AP_INCON;
|
||||
krb5_set_error_message(context, ret, "v4 principal mismatch");
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (from_addr && ad->address && from_addr != ad->address) {
|
||||
krb5_set_error_string(context, "v4 bad address in ticket");
|
||||
ret = KRB4ET_RD_AP_BADD;
|
||||
krb5_set_error_message(context, ret, "v4 bad address in ticket");
|
||||
goto error;
|
||||
}
|
||||
|
||||
@@ -875,7 +875,7 @@ _krb5_krb_rd_req(krb5_context context,
|
||||
delta_t = abs((int)(tv.tv_sec - r_time_sec));
|
||||
if (delta_t > CLOCK_SKEW) {
|
||||
ret = KRB4ET_RD_AP_TIME;
|
||||
krb5_set_error_string(context, "v4 clock skew");
|
||||
krb5_set_error_message(context, ret, "v4 clock skew");
|
||||
goto error;
|
||||
}
|
||||
|
||||
@@ -885,13 +885,13 @@ _krb5_krb_rd_req(krb5_context context,
|
||||
|
||||
if ((tkt_age < 0) && (-tkt_age > CLOCK_SKEW)) {
|
||||
ret = KRB4ET_RD_AP_NYV;
|
||||
krb5_set_error_string(context, "v4 clock skew for expiration");
|
||||
krb5_set_error_message(context, ret, "v4 clock skew for expiration");
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (tv.tv_sec > _krb5_krb_life_to_time(ad->time_sec, ad->life)) {
|
||||
ret = KRB4ET_RD_AP_EXP;
|
||||
krb5_set_error_string(context, "v4 ticket expired");
|
||||
krb5_set_error_message(context, ret, "v4 ticket expired");
|
||||
goto error;
|
||||
}
|
||||
|
||||
|
@@ -92,8 +92,8 @@ krb5_verify_init_creds(krb5_context context,
|
||||
|
||||
if (gethostname (local_hostname, sizeof(local_hostname)) < 0) {
|
||||
ret = errno;
|
||||
krb5_set_error_string (context, "gethostname: %s",
|
||||
strerror(ret));
|
||||
krb5_set_error_message (context, ret, "gethostname: %s",
|
||||
strerror(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@@ -103,7 +103,7 @@ krb5_verify_opt_alloc(krb5_context context, krb5_verify_opt **opt)
|
||||
{
|
||||
*opt = calloc(1, sizeof(**opt));
|
||||
if ((*opt) == NULL) {
|
||||
krb5_set_error_string(context, "malloc: out of memory");
|
||||
krb5_set_error_message(context, ENOMEM, "malloc: out of memory");
|
||||
return ENOMEM;
|
||||
}
|
||||
krb5_verify_opt_init(*opt);
|
||||
|
@@ -49,7 +49,7 @@ krb5_write_message (krb5_context context,
|
||||
if (krb5_net_write (context, p_fd, buf, 4) != 4
|
||||
|| krb5_net_write (context, p_fd, data->data, len) != len) {
|
||||
ret = errno;
|
||||
krb5_set_error_string (context, "write: %s", strerror(ret));
|
||||
krb5_set_error_message (context, ret, "write: %s", strerror(ret));
|
||||
return ret;
|
||||
}
|
||||
return 0;
|
||||
|
Reference in New Issue
Block a user