__attribute__((__format__(__printf__, 3, 0)))
#endif
;
+void
+krb5int_set_error_fl (struct errinfo *ep, long code,
+ const char *file, int line,
+ const char *fmt, ...)
+#if !defined(__cplusplus) && (__GNUC__ > 2)
+ __attribute__((__format__(__printf__, 5, 6)))
+#endif
+ ;
+void
+krb5int_vset_error_fl (struct errinfo *ep, long code,
+ const char *file, int line,
+ const char *fmt, va_list args)
+#if !defined(__cplusplus) && (__GNUC__ > 2)
+ __attribute__((__format__(__printf__, 5, 0)))
+#endif
+ ;
const char *
krb5int_get_error (struct errinfo *ep, long code);
void
void
krb5int_set_error_info_callout_fn (const char *(KRB5_CALLCONV *f)(long));
+#ifdef DEBUG_ERROR_LOCATIONS
+#define krb5int_set_error(ep, code, ...) \
+ krb5int_set_error_fl(ep, code, __FILE__, __LINE__, __VA_ARGS__)
+#endif
+
#endif /* K5_ERR_H */
const krb5_keyblock *privsvr_key,
krb5_data *data);
+#ifdef DEBUG_ERROR_LOCATIONS
+#define krb5_set_error_message(ctx, code, ...) \
+ krb5_set_error_message_fl(ctx, code, __FILE__, __LINE__, __VA_ARGS__)
+#endif
+
#endif /* _KRB5_INT_H */
#endif
#endif
+#undef krb5_set_error_message
void KRB5_CALLCONV_C
krb5_set_error_message (krb5_context ctx, krb5_error_code code,
const char *fmt, ...)
va_end (args);
}
+void KRB5_CALLCONV_C
+krb5_set_error_message_fl (krb5_context ctx, krb5_error_code code,
+ const char *file, int line, const char *fmt, ...)
+{
+ va_list args;
+ if (ctx == NULL)
+ return;
+ va_start (args, fmt);
+#ifdef DEBUG
+ if (ERROR_MESSAGE_DEBUG())
+ fprintf(stderr,
+ "krb5_set_error_message(ctx=%p/err=%p, code=%ld, ...)\n",
+ ctx, &ctx->err, (long) code);
+#endif
+ krb5int_vset_error_fl (&ctx->err, code, file, line, fmt, args);
+#ifdef DEBUG
+ if (ERROR_MESSAGE_DEBUG())
+ fprintf(stderr, "->%s\n", ctx->err.msg);
+#endif
+ va_end (args);
+}
+
void KRB5_CALLCONV
krb5_vset_error_message (krb5_context ctx, krb5_error_code code,
const char *fmt, va_list args)
krb5_set_default_tgs_enctypes
krb5_set_default_tgs_ktypes
krb5_set_error_message
+krb5_set_error_message_fl
krb5_set_password
krb5_set_password_using_ccache
krb5_set_principal_realm
#define lock() k5_mutex_lock(&krb5int_error_info_support_mutex)
#define unlock() k5_mutex_unlock(&krb5int_error_info_support_mutex)
+#undef krb5int_set_error
void
krb5int_set_error (struct errinfo *ep, long code, const char *fmt, ...)
{
va_list args;
va_start (args, fmt);
- krb5int_vset_error (ep, code, fmt, args);
+ krb5int_vset_error_fl (ep, code, NULL, 0, fmt, args);
+ va_end (args);
+}
+
+void
+krb5int_set_error_fl (struct errinfo *ep, long code,
+ const char *file, int line, const char *fmt, ...)
+{
+ va_list args;
+ va_start (args, fmt);
+ krb5int_vset_error_fl (ep, code, file, line, fmt, args);
va_end (args);
}
void
krb5int_vset_error (struct errinfo *ep, long code,
const char *fmt, va_list args)
+{
+ krb5int_vset_error_fl(ep, code, NULL, 0, fmt, args);
+}
+
+void
+krb5int_vset_error_fl (struct errinfo *ep, long code,
+ const char *file, int line,
+ const char *fmt, va_list args)
{
va_list args2;
- char *str = NULL;
+ char *str = NULL, *str2, *slash;
const char *loc_fmt = NULL;
#ifdef USE_KIM
str = NULL;
}
va_end(args2);
+
+ if (str && line) {
+ /* Try to add file and line suffix. */
+ slash = strrchr(file, '/');
+ if (slash)
+ file = slash + 1;
+ if (asprintf(&str2, "%s (%s: %d)", str, file, line) > 0) {
+ free(str);
+ str = str2;
+ }
+ }
/* If that failed, try using scratch_buf */
if (str == NULL) {
krb5int_mutex_unlock
krb5int_set_error
krb5int_vset_error
+krb5int_set_error_fl
+krb5int_vset_error_fl
krb5int_get_error
krb5int_free_error
krb5int_clear_error