summaryrefslogtreecommitdiffstats
path: root/src/include
diff options
context:
space:
mode:
authorKen Raeburn <raeburn@mit.edu>2006-03-26 20:55:59 +0000
committerKen Raeburn <raeburn@mit.edu>2006-03-26 20:55:59 +0000
commitb5a541c640dfedda7480332f4838e30f0a9e1770 (patch)
treeb5182550f1c3fb475c3b71d15f4944fbcc16c4bb /src/include
parent976289e5db9426efb6aa56cf0c97b89b4e30d1b4 (diff)
downloadkrb5-b5a541c640dfedda7480332f4838e30f0a9e1770.tar.gz
krb5-b5a541c640dfedda7480332f4838e30f0a9e1770.tar.xz
krb5-b5a541c640dfedda7480332f4838e30f0a9e1770.zip
Initial enhanced error message support, similar to what I sent to
krbdev except for some function renaming (krb5_free_error was already in use, so added _message to everything), and the context is allowed to be NULL (in which case we fall back to error_message() and storing no strings) to simplify some code. Low-level routines in the support library, using a private data structure; higher-level routines in libkrb5, using a krb5_context. Added error info strings to the KRB_ERR_GENERIC case in gc_via_tkt.c and the python sample service location plugin. Added code to kinit and kvno to look up and display the strings. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@17776 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/include')
-rw-r--r--src/include/ChangeLog9
-rw-r--r--src/include/k5-err.h23
-rw-r--r--src/include/k5-int.h6
-rw-r--r--src/include/krb5.hin15
4 files changed, 53 insertions, 0 deletions
diff --git a/src/include/ChangeLog b/src/include/ChangeLog
index cf62126c9e..b5c4654a4f 100644
--- a/src/include/ChangeLog
+++ b/src/include/ChangeLog
@@ -1,3 +1,12 @@
+2006-03-26 Ken Raeburn <raeburn@mit.edu>
+
+ * krb5.hin (krb5_set_error_message, krb5_vset_error_message,
+ krb5_get_error_message, krb5_free_error_message,
+ krb5_clear_error_message): Declare.
+ * k5-err.h: New file.
+ * k5-int.h: Include it.
+ (struct _krb5_context): Add new field ERR.
+
2006-03-11 Ken Raeburn <raeburn@mit.edu>
* adm.h, adm_defs.h, adm_proto.h, copyright.h, kdb.h, kdb_dbc.h,
diff --git a/src/include/k5-err.h b/src/include/k5-err.h
new file mode 100644
index 0000000000..0ac20802bb
--- /dev/null
+++ b/src/include/k5-err.h
@@ -0,0 +1,23 @@
+#define _(X) (X)
+#define KRB5_CALLCONV
+struct errinfo {
+ long code;
+ const char *msg;
+ char scratch_buf[1024];
+};
+
+void
+krb5int_set_error (struct errinfo *ep,
+ long code,
+ const char *fmt, ...);
+void
+krb5int_vset_error (struct errinfo *ep, long code,
+ const char *fmt, va_list args);
+char *
+krb5int_get_error (struct errinfo *ep, long code);
+void
+krb5int_free_error (struct errinfo *ep, char *msg);
+void
+krb5int_clear_error (struct errinfo *ep);
+void
+krb5int_set_error_info_callout_fn (const char *(KRB5_CALLCONV *f)(long));
diff --git a/src/include/k5-int.h b/src/include/k5-int.h
index ff8b342057..4b455f9fbe 100644
--- a/src/include/k5-int.h
+++ b/src/include/k5-int.h
@@ -169,6 +169,9 @@ typedef INT64_TYPE krb5_int64;
/* Get mutex support; currently used only for the replay cache. */
#include "k5-thread.h"
+/* Get error info support. */
+#include "k5-err.h"
+
/* krb5/krb5.h includes many other .h files in the krb5 subdirectory.
The ones that it doesn't include, we include below. */
@@ -1067,6 +1070,9 @@ struct _krb5_context {
struct plugin_dir_handle libkrb5_plugins;
struct krb5plugin_service_locate_ftable *vtbl;
void (**locate_fptrs)(void);
+
+ /* error detail info */
+ struct errinfo err;
};
/* could be used in a table to find an etype and initialize a block */
diff --git a/src/include/krb5.hin b/src/include/krb5.hin
index eaaedec8f1..d786e6770c 100644
--- a/src/include/krb5.hin
+++ b/src/include/krb5.hin
@@ -2536,6 +2536,21 @@ typedef krb5_int32 krb5_prompt_type;
krb5_prompt_type* KRB5_CALLCONV krb5_get_prompt_types
(krb5_context context);
+/* Error reporting */
+void
+krb5_set_error_message (krb5_context, krb5_error_code, const char *, ...);
+#ifdef va_start
+void
+krb5_vset_error_message (krb5_context, krb5_error_code, const char *, va_list);
+#endif
+char *
+krb5_get_error_message (krb5_context, krb5_error_code);
+void
+krb5_free_error_message (krb5_context, char *);
+void
+krb5_clear_error_message (krb5_context);
+
+
#if TARGET_OS_MAC
# pragma options align=reset
#endif