summaryrefslogtreecommitdiffstats
path: root/src/lib/krb5/ccache
diff options
context:
space:
mode:
authorGreg Hudson <ghudson@mit.edu>2014-05-24 12:15:32 -0400
committerGreg Hudson <ghudson@mit.edu>2014-06-05 11:22:50 -0400
commita7b5808b5df9e54ef8a8a7ac24e5faad458ddbce (patch)
treeb98160b39c648d8b1d967fa3b1b885b9232f74d1 /src/lib/krb5/ccache
parent06b91d1e2341601e5bdc70a15737187545d68196 (diff)
downloadkrb5-a7b5808b5df9e54ef8a8a7ac24e5faad458ddbce.tar.gz
krb5-a7b5808b5df9e54ef8a8a7ac24e5faad458ddbce.tar.xz
krb5-a7b5808b5df9e54ef8a8a7ac24e5faad458ddbce.zip
Use k5_setmsg
Replace most calls to krb5_set_error_message with k5_setmsg for brevity. Leave alone plugin sources where we don't include k5-int.h (mostly PKINIT).
Diffstat (limited to 'src/lib/krb5/ccache')
-rw-r--r--src/lib/krb5/ccache/cc_dir.c35
-rw-r--r--src/lib/krb5/ccache/cc_file.c11
-rw-r--r--src/lib/krb5/ccache/cc_keyring.c11
-rw-r--r--src/lib/krb5/ccache/cccursor.c10
4 files changed, 31 insertions, 36 deletions
diff --git a/src/lib/krb5/ccache/cc_dir.c b/src/lib/krb5/ccache/cc_dir.c
index b8231ed7c..d82f33550 100644
--- a/src/lib/krb5/ccache/cc_dir.c
+++ b/src/lib/krb5/ccache/cc_dir.c
@@ -118,16 +118,15 @@ split_path(krb5_context context, const char *path, char **dirname_out,
if (*dirname == '\0') {
ret = KRB5_CC_BADNAME;
- krb5_set_error_message(context, ret,
- _("Subsidiary cache path %s has no parent "
- "directory"), path);
+ k5_setmsg(context, ret,
+ _("Subsidiary cache path %s has no parent directory"), path);
goto error;
}
if (!filename_is_cache(filename)) {
ret = KRB5_CC_BADNAME;
- krb5_set_error_message(context, ret,
- _("Subsidiary cache path %s filename does not "
- "begin with \"tkt\""), path);
+ k5_setmsg(context, ret,
+ _("Subsidiary cache path %s filename does not begin with "
+ "\"tkt\""), path);
goto error;
}
@@ -167,9 +166,8 @@ read_primary_file(krb5_context context, const char *primary_path,
* filename, or isn't a single-component filename. */
if (buf[len - 1] != '\n' || !filename_is_cache(buf) ||
strchr(buf, '/') || strchr(buf, '\\')) {
- krb5_set_error_message(context, KRB5_CC_FORMAT,
- _("%s contains invalid filename"),
- primary_path);
+ k5_setmsg(context, KRB5_CC_FORMAT, _("%s contains invalid filename"),
+ primary_path);
return KRB5_CC_FORMAT;
}
buf[len - 1] = '\0';
@@ -227,15 +225,15 @@ verify_dir(krb5_context context, const char *dirname)
if (stat(dirname, &st) < 0) {
if (errno == ENOENT && mkdir(dirname, S_IRWXU) == 0)
return 0;
- krb5_set_error_message(context, KRB5_FCC_NOFILE,
- _("Credential cache directory %s does not "
- "exist"), dirname);
+ k5_setmsg(context, KRB5_FCC_NOFILE,
+ _("Credential cache directory %s does not exist"),
+ dirname);
return KRB5_FCC_NOFILE;
}
if (!S_ISDIR(st.st_mode)) {
- krb5_set_error_message(context, KRB5_CC_FORMAT,
- _("Credential cache directory %s exists but is"
- "not a directory"), dirname);
+ k5_setmsg(context, KRB5_CC_FORMAT,
+ _("Credential cache directory %s exists but is not a "
+ "directory"), dirname);
return KRB5_CC_FORMAT;
}
return 0;
@@ -398,10 +396,9 @@ dcc_gen_new(krb5_context context, krb5_ccache *cache_out)
if (ret)
return ret;
if (dirname == NULL) {
- krb5_set_error_message(context, KRB5_DCC_CANNOT_CREATE,
- _("Can't create new subsidiary cache because "
- "default cache is not a directory "
- "collection"));
+ k5_setmsg(context, KRB5_DCC_CANNOT_CREATE,
+ _("Can't create new subsidiary cache because default cache "
+ "is not a directory collection"));
return KRB5_DCC_CANNOT_CREATE;
}
ret = k5_path_join(dirname, "tktXXXXXX", &template);
diff --git a/src/lib/krb5/ccache/cc_file.c b/src/lib/krb5/ccache/cc_file.c
index 7b6279d87..3f6443f68 100644
--- a/src/lib/krb5/ccache/cc_file.c
+++ b/src/lib/krb5/ccache/cc_file.c
@@ -569,9 +569,8 @@ open_cache_file(krb5_context context, krb5_ccache id, int mode)
if (f == NO_FILE) {
if (errno == ENOENT) {
ret = KRB5_FCC_NOFILE;
- krb5_set_error_message(context, ret,
- _("Credentials cache file '%s' not found"),
- data->filename);
+ k5_setmsg(context, ret, _("Credentials cache file '%s' not found"),
+ data->filename);
return ret;
} else {
return interpret_errno(context, errno);
@@ -1577,9 +1576,9 @@ interpret_errno(krb5_context context, int errnum)
case ENXIO:
default:
ret = KRB5_CC_IO;
- krb5_set_error_message(context, ret,
- _("Credentials cache I/O operation failed "
- "(%s)"), strerror(errnum));
+ k5_setmsg(context, ret,
+ _("Credentials cache I/O operation failed (%s)"),
+ strerror(errnum));
}
return ret;
}
diff --git a/src/lib/krb5/ccache/cc_keyring.c b/src/lib/krb5/ccache/cc_keyring.c
index 43f33ee50..31be293db 100644
--- a/src/lib/krb5/ccache/cc_keyring.c
+++ b/src/lib/krb5/ccache/cc_keyring.c
@@ -1147,9 +1147,9 @@ krcc_generate_new(krb5_context context, krb5_ccache *id_out)
return ret;
}
if (subsidiary_name != NULL) {
- krb5_set_error_message(context, KRB5_DCC_CANNOT_CREATE,
- _("Can't create new subsidiary cache because "
- "default cache is already a subsdiary"));
+ k5_setmsg(context, KRB5_DCC_CANNOT_CREATE,
+ _("Can't create new subsidiary cache because default cache "
+ "is already a subsidiary"));
ret = KRB5_DCC_CANNOT_CREATE;
goto cleanup;
}
@@ -1216,9 +1216,8 @@ krcc_get_principal(krb5_context context, krb5_ccache id,
if (!data->cache_id || !data->princ_id) {
ret = KRB5_FCC_NOFILE;
- krb5_set_error_message(context, ret,
- _("Credentials cache keyring '%s' not found"),
- data->name);
+ k5_setmsg(context, ret, _("Credentials cache keyring '%s' not found"),
+ data->name);
goto errout;
}
diff --git a/src/lib/krb5/ccache/cccursor.c b/src/lib/krb5/ccache/cccursor.c
index e15611248..021a49ffb 100644
--- a/src/lib/krb5/ccache/cccursor.c
+++ b/src/lib/krb5/ccache/cccursor.c
@@ -208,9 +208,9 @@ krb5_cc_cache_match(krb5_context context, krb5_principal client,
if (cache == NULL) {
ret = krb5_unparse_name(context, client, &name);
if (ret == 0) {
- krb5_set_error_message(context, KRB5_CC_NOTFOUND,
- _("Can't find client principal %s in "
- "cache collection"), name);
+ k5_setmsg(context, KRB5_CC_NOTFOUND,
+ _("Can't find client principal %s in cache collection"),
+ name);
krb5_free_unparsed_name(context, name);
}
ret = KRB5_CC_NOTFOUND;
@@ -249,7 +249,7 @@ krb5_cccol_have_content(krb5_context context)
return 0;
no_entries:
- krb5_set_error_message(context, KRB5_CC_NOTFOUND,
- _("No Kerberos credentials available"));
+ k5_setmsg(context, KRB5_CC_NOTFOUND,
+ _("No Kerberos credentials available"));
return KRB5_CC_NOTFOUND;
}