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