1 #pragma ident "%Z%%M% %I% %E% SMI"
6 * Copyright 2006 Massachusetts Institute of Technology.
9 * Export of this software from the United States of America may
10 * require a specific license from the United States Government.
11 * It is the responsibility of any person or organization contemplating
12 * export to obtain such a license before exporting.
14 * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
15 * distribute this software and its documentation for any purpose and
16 * without fee is hereby granted, provided that the above copyright
17 * notice appear in all copies and that both that copyright notice and
18 * this permission notice appear in supporting documentation, and that
19 * the name of M.I.T. not be used in advertising or publicity pertaining
20 * to distribution of the software without specific, written prior
21 * permission. Furthermore if you modify this software you must label
22 * your software as modified software and not distribute it in such a
23 * fashion that it might be confused with the original M.I.T. software.
24 * M.I.T. makes no representations about the suitability of
25 * this software for any purpose. It is provided "as is" without express
26 * or implied warranty.
28 * error-message functions
34 static int error_message_debug
= 0;
35 #ifndef ERROR_MESSAGE_DEBUG
36 #define ERROR_MESSAGE_DEBUG() (error_message_debug != 0)
41 krb5_set_error_message (krb5_context ctx
, krb5_error_code code
,
49 if (ERROR_MESSAGE_DEBUG())
51 "krb5_set_error_message(ctx=%p/err=%p, code=%ld, ...)\n",
52 ctx
, &ctx
->err
, (long) code
);
54 krb5int_vset_error (&ctx
->err
, code
, fmt
, args
);
56 if (ERROR_MESSAGE_DEBUG())
57 fprintf(stderr
, "->%s\n", ctx
->err
.msg
);
63 krb5_vset_error_message (krb5_context ctx
, krb5_error_code code
,
64 const char *fmt
, va_list args
)
67 if (ERROR_MESSAGE_DEBUG())
68 fprintf(stderr
, "krb5_vset_error_message(ctx=%p, code=%ld, ...)\n",
73 krb5int_vset_error (&ctx
->err
, code
, fmt
, args
);
75 if (ERROR_MESSAGE_DEBUG())
76 fprintf(stderr
, "->%s\n", ctx
->err
.msg
);
80 const char * KRB5_CALLCONV
81 krb5_get_error_message (krb5_context ctx
, krb5_error_code code
)
84 if (ERROR_MESSAGE_DEBUG())
85 fprintf(stderr
, "krb5_get_error_message(%p, %ld)\n", ctx
, (long) code
);
88 return error_message(code
);
89 return krb5int_get_error (&ctx
->err
, code
);
93 krb5_free_error_message (krb5_context ctx
, const char *msg
)
96 if (ERROR_MESSAGE_DEBUG())
97 fprintf(stderr
, "krb5_free_error_message(%p, %p)\n", ctx
, msg
);
101 krb5int_free_error (&ctx
->err
, msg
);
105 krb5_clear_error_message (krb5_context ctx
)
108 if (ERROR_MESSAGE_DEBUG())
109 fprintf(stderr
, "krb5_clear_error_message(%p)\n", ctx
);
113 krb5int_clear_error (&ctx
->err
);