summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGreg Hudson <ghudson@mit.edu>2014-04-28 12:25:01 -0400
committerGreg Hudson <ghudson@mit.edu>2014-05-07 12:46:27 -0400
commit59c8600dcbee09dd9b4bf68b9b97c6fa95e9f6d2 (patch)
treec5755abf2771c48e9735042c47ac4484ef87d3cc /src
parent939bb6c500aba6359f80bd27ba6269c23168fc16 (diff)
downloadkrb5-59c8600dcbee09dd9b4bf68b9b97c6fa95e9f6d2.tar.gz
krb5-59c8600dcbee09dd9b4bf68b9b97c6fa95e9f6d2.tar.xz
krb5-59c8600dcbee09dd9b4bf68b9b97c6fa95e9f6d2.zip
Add helper to change extended error message code
k5_change_error_message_code allows an extended error message to be used when an error code is remapped.
Diffstat (limited to 'src')
-rw-r--r--src/include/k5-int.h3
-rw-r--r--src/lib/krb5/krb/kerrs.c10
-rw-r--r--src/lib/krb5/libkrb5.exports1
-rw-r--r--src/lib/krb5_32.def3
4 files changed, 17 insertions, 0 deletions
diff --git a/src/include/k5-int.h b/src/include/k5-int.h
index fbb8665c6..096cd14f5 100644
--- a/src/include/k5-int.h
+++ b/src/include/k5-int.h
@@ -2254,6 +2254,9 @@ krb5_error_code krb5int_parse_enctype_list(krb5_context context,
krb5_boolean k5_etypes_contains(const krb5_enctype *list, krb5_enctype etype);
+void k5_change_error_message_code(krb5_context ctx, krb5_error_code oldcode,
+ krb5_error_code newcode);
+
#ifdef DEBUG_ERROR_LOCATIONS
#define krb5_set_error_message(ctx, code, ...) \
krb5_set_error_message_fl(ctx, code, __FILE__, __LINE__, __VA_ARGS__)
diff --git a/src/lib/krb5/krb/kerrs.c b/src/lib/krb5/krb/kerrs.c
index 99db92674..f3e6c946a 100644
--- a/src/lib/krb5/krb/kerrs.c
+++ b/src/lib/krb5/krb/kerrs.c
@@ -180,3 +180,13 @@ k5_restore_ctx_error(krb5_context ctx, struct errinfo *in)
}
return code;
}
+
+/* If ctx contains an extended error message for oldcode, change it to be an
+ * extended error message for newcode. */
+void
+k5_change_error_message_code(krb5_context ctx, krb5_error_code oldcode,
+ krb5_error_code newcode)
+{
+ if (ctx != NULL && ctx->err.msg != NULL && ctx->err.code == oldcode)
+ ctx->err.code = newcode;
+}
diff --git a/src/lib/krb5/libkrb5.exports b/src/lib/krb5/libkrb5.exports
index b03e73af6..06ca9fc54 100644
--- a/src/lib/krb5/libkrb5.exports
+++ b/src/lib/krb5/libkrb5.exports
@@ -107,6 +107,7 @@ initialize_kv5m_error_table
initialize_prof_error_table
k5_build_conf_principals
k5_ccselect_free_context
+k5_change_error_message_code
k5_etypes_contains
k5_expand_path_tokens
k5_expand_path_tokens_extra
diff --git a/src/lib/krb5_32.def b/src/lib/krb5_32.def
index dd0a16ccc..3530ae157 100644
--- a/src/lib/krb5_32.def
+++ b/src/lib/krb5_32.def
@@ -452,3 +452,6 @@ EXPORTS
krb5_responder_pkinit_challenge_free @423
krb5_auth_con_setpermetypes @424 ; PRIVATE GSSAPI
krb5_rd_req_decoded @425 ; PRIVATE GSSAPI
+
+; new in 1.13
+ k5_change_error_message_code @426 ; PRIVATE GSSAPI