xref: /minix3/crypto/external/bsd/heimdal/dist/lib/krb5/warn.c (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc /*	$NetBSD: warn.c,v 1.1.1.2 2014/04/24 12:45:51 pettai Exp $	*/
2ebfedea0SLionel Sambuc 
3ebfedea0SLionel Sambuc /*
4ebfedea0SLionel Sambuc  * Copyright (c) 1997 - 2001 Kungliga Tekniska Högskolan
5ebfedea0SLionel Sambuc  * (Royal Institute of Technology, Stockholm, Sweden).
6ebfedea0SLionel Sambuc  * All rights reserved.
7ebfedea0SLionel Sambuc  *
8ebfedea0SLionel Sambuc  * Redistribution and use in source and binary forms, with or without
9ebfedea0SLionel Sambuc  * modification, are permitted provided that the following conditions
10ebfedea0SLionel Sambuc  * are met:
11ebfedea0SLionel Sambuc  *
12ebfedea0SLionel Sambuc  * 1. Redistributions of source code must retain the above copyright
13ebfedea0SLionel Sambuc  *    notice, this list of conditions and the following disclaimer.
14ebfedea0SLionel Sambuc  *
15ebfedea0SLionel Sambuc  * 2. Redistributions in binary form must reproduce the above copyright
16ebfedea0SLionel Sambuc  *    notice, this list of conditions and the following disclaimer in the
17ebfedea0SLionel Sambuc  *    documentation and/or other materials provided with the distribution.
18ebfedea0SLionel Sambuc  *
19ebfedea0SLionel Sambuc  * 3. Neither the name of the Institute nor the names of its contributors
20ebfedea0SLionel Sambuc  *    may be used to endorse or promote products derived from this software
21ebfedea0SLionel Sambuc  *    without specific prior written permission.
22ebfedea0SLionel Sambuc  *
23ebfedea0SLionel Sambuc  * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
24ebfedea0SLionel Sambuc  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25ebfedea0SLionel Sambuc  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26ebfedea0SLionel Sambuc  * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
27ebfedea0SLionel Sambuc  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28ebfedea0SLionel Sambuc  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29ebfedea0SLionel Sambuc  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30ebfedea0SLionel Sambuc  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31ebfedea0SLionel Sambuc  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32ebfedea0SLionel Sambuc  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33ebfedea0SLionel Sambuc  * SUCH DAMAGE.
34ebfedea0SLionel Sambuc  */
35ebfedea0SLionel Sambuc 
36ebfedea0SLionel Sambuc #include "krb5_locl.h"
37ebfedea0SLionel Sambuc #include <err.h>
38ebfedea0SLionel Sambuc 
39ebfedea0SLionel Sambuc static krb5_error_code _warnerr(krb5_context context, int do_errtext,
40ebfedea0SLionel Sambuc 	 krb5_error_code code, int level, const char *fmt, va_list ap)
41ebfedea0SLionel Sambuc 	__attribute__((__format__(__printf__, 5, 0)));
42ebfedea0SLionel Sambuc 
43ebfedea0SLionel Sambuc static krb5_error_code
_warnerr(krb5_context context,int do_errtext,krb5_error_code code,int level,const char * fmt,va_list ap)44ebfedea0SLionel Sambuc _warnerr(krb5_context context, int do_errtext,
45ebfedea0SLionel Sambuc 	 krb5_error_code code, int level, const char *fmt, va_list ap)
46ebfedea0SLionel Sambuc {
47ebfedea0SLionel Sambuc     char xfmt[7] = "";
48ebfedea0SLionel Sambuc     const char *args[2], **arg;
49ebfedea0SLionel Sambuc     char *msg = NULL;
50ebfedea0SLionel Sambuc     const char *err_str = NULL;
51ebfedea0SLionel Sambuc     krb5_error_code ret;
52ebfedea0SLionel Sambuc 
53ebfedea0SLionel Sambuc     args[0] = args[1] = NULL;
54ebfedea0SLionel Sambuc     arg = args;
55ebfedea0SLionel Sambuc     if(fmt){
56ebfedea0SLionel Sambuc 	strlcat(xfmt, "%s", sizeof(xfmt));
57ebfedea0SLionel Sambuc 	if(do_errtext)
58ebfedea0SLionel Sambuc 	    strlcat(xfmt, ": ", sizeof(xfmt));
59ebfedea0SLionel Sambuc 	ret = vasprintf(&msg, fmt, ap);
60ebfedea0SLionel Sambuc 	if(ret < 0 || msg == NULL)
61ebfedea0SLionel Sambuc 	    return ENOMEM;
62ebfedea0SLionel Sambuc 	*arg++ = msg;
63ebfedea0SLionel Sambuc     }
64ebfedea0SLionel Sambuc     if(context && do_errtext){
65ebfedea0SLionel Sambuc 	strlcat(xfmt, "%s", sizeof(xfmt));
66ebfedea0SLionel Sambuc 
67ebfedea0SLionel Sambuc 	err_str = krb5_get_error_message(context, code);
68ebfedea0SLionel Sambuc 	if (err_str != NULL) {
69ebfedea0SLionel Sambuc 	    *arg = err_str;
70ebfedea0SLionel Sambuc 	} else {
71ebfedea0SLionel Sambuc 	    *arg= "<unknown error>";
72ebfedea0SLionel Sambuc 	}
73ebfedea0SLionel Sambuc     }
74ebfedea0SLionel Sambuc 
75ebfedea0SLionel Sambuc     if(context && context->warn_dest)
76ebfedea0SLionel Sambuc 	krb5_log(context, context->warn_dest, level, xfmt, args[0], args[1]);
77ebfedea0SLionel Sambuc     else
78ebfedea0SLionel Sambuc 	warnx(xfmt, args[0], args[1]);
79ebfedea0SLionel Sambuc     free(msg);
80ebfedea0SLionel Sambuc     krb5_free_error_message(context, err_str);
81ebfedea0SLionel Sambuc     return 0;
82ebfedea0SLionel Sambuc }
83ebfedea0SLionel Sambuc 
84ebfedea0SLionel Sambuc #define FUNC(ETEXT, CODE, LEVEL)					\
85ebfedea0SLionel Sambuc     krb5_error_code ret;						\
86ebfedea0SLionel Sambuc     va_list ap;								\
87ebfedea0SLionel Sambuc     va_start(ap, fmt);							\
88ebfedea0SLionel Sambuc     ret = _warnerr(context, ETEXT, CODE, LEVEL, fmt, ap); 		\
89ebfedea0SLionel Sambuc     va_end(ap);
90ebfedea0SLionel Sambuc 
91ebfedea0SLionel Sambuc #undef __attribute__
92ebfedea0SLionel Sambuc #define __attribute__(X)
93ebfedea0SLionel Sambuc 
94ebfedea0SLionel Sambuc /**
95ebfedea0SLionel Sambuc  * Log a warning to the log, default stderr, include the error from
96ebfedea0SLionel Sambuc  * the last failure.
97ebfedea0SLionel Sambuc  *
98ebfedea0SLionel Sambuc  * @param context A Kerberos 5 context.
99ebfedea0SLionel Sambuc  * @param code error code of the last error
100ebfedea0SLionel Sambuc  * @param fmt message to print
101ebfedea0SLionel Sambuc  * @param ap arguments
102ebfedea0SLionel Sambuc  *
103ebfedea0SLionel Sambuc  * @ingroup krb5_error
104ebfedea0SLionel Sambuc  */
105ebfedea0SLionel Sambuc 
106ebfedea0SLionel Sambuc KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
krb5_vwarn(krb5_context context,krb5_error_code code,const char * fmt,va_list ap)107ebfedea0SLionel Sambuc krb5_vwarn(krb5_context context, krb5_error_code code,
108ebfedea0SLionel Sambuc 	   const char *fmt, va_list ap)
109ebfedea0SLionel Sambuc      __attribute__ ((format (printf, 3, 0)))
110ebfedea0SLionel Sambuc {
111ebfedea0SLionel Sambuc     return _warnerr(context, 1, code, 1, fmt, ap);
112ebfedea0SLionel Sambuc }
113ebfedea0SLionel Sambuc 
114ebfedea0SLionel Sambuc /**
115ebfedea0SLionel Sambuc  * Log a warning to the log, default stderr, include the error from
116ebfedea0SLionel Sambuc  * the last failure.
117ebfedea0SLionel Sambuc  *
118ebfedea0SLionel Sambuc  * @param context A Kerberos 5 context.
119ebfedea0SLionel Sambuc  * @param code error code of the last error
120ebfedea0SLionel Sambuc  * @param fmt message to print
121ebfedea0SLionel Sambuc  *
122ebfedea0SLionel Sambuc  * @ingroup krb5_error
123ebfedea0SLionel Sambuc  */
124ebfedea0SLionel Sambuc 
125ebfedea0SLionel Sambuc KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
krb5_warn(krb5_context context,krb5_error_code code,const char * fmt,...)126ebfedea0SLionel Sambuc krb5_warn(krb5_context context, krb5_error_code code, const char *fmt, ...)
127ebfedea0SLionel Sambuc      __attribute__ ((format (printf, 3, 4)))
128ebfedea0SLionel Sambuc {
129ebfedea0SLionel Sambuc     FUNC(1, code, 1);
130ebfedea0SLionel Sambuc     return ret;
131ebfedea0SLionel Sambuc }
132ebfedea0SLionel Sambuc 
133ebfedea0SLionel Sambuc /**
134ebfedea0SLionel Sambuc  * Log a warning to the log, default stderr.
135ebfedea0SLionel Sambuc  *
136ebfedea0SLionel Sambuc  * @param context A Kerberos 5 context.
137ebfedea0SLionel Sambuc  * @param fmt message to print
138ebfedea0SLionel Sambuc  * @param ap arguments
139ebfedea0SLionel Sambuc  *
140ebfedea0SLionel Sambuc  * @ingroup krb5_error
141ebfedea0SLionel Sambuc  */
142ebfedea0SLionel Sambuc 
143ebfedea0SLionel Sambuc KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
krb5_vwarnx(krb5_context context,const char * fmt,va_list ap)144ebfedea0SLionel Sambuc krb5_vwarnx(krb5_context context, const char *fmt, va_list ap)
145ebfedea0SLionel Sambuc      __attribute__ ((format (printf, 2, 0)))
146ebfedea0SLionel Sambuc {
147ebfedea0SLionel Sambuc     return _warnerr(context, 0, 0, 1, fmt, ap);
148ebfedea0SLionel Sambuc }
149ebfedea0SLionel Sambuc 
150ebfedea0SLionel Sambuc /**
151ebfedea0SLionel Sambuc  * Log a warning to the log, default stderr.
152ebfedea0SLionel Sambuc  *
153ebfedea0SLionel Sambuc  * @param context A Kerberos 5 context.
154ebfedea0SLionel Sambuc  * @param fmt message to print
155ebfedea0SLionel Sambuc  *
156ebfedea0SLionel Sambuc  * @ingroup krb5_error
157ebfedea0SLionel Sambuc  */
158ebfedea0SLionel Sambuc 
159ebfedea0SLionel Sambuc KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
krb5_warnx(krb5_context context,const char * fmt,...)160ebfedea0SLionel Sambuc krb5_warnx(krb5_context context, const char *fmt, ...)
161ebfedea0SLionel Sambuc      __attribute__ ((format (printf, 2, 3)))
162ebfedea0SLionel Sambuc {
163ebfedea0SLionel Sambuc     FUNC(0, 0, 1);
164ebfedea0SLionel Sambuc     return ret;
165ebfedea0SLionel Sambuc }
166ebfedea0SLionel Sambuc 
167ebfedea0SLionel Sambuc /**
168ebfedea0SLionel Sambuc  * Log a warning to the log, default stderr, include bthe error from
169ebfedea0SLionel Sambuc  * the last failure and then exit.
170ebfedea0SLionel Sambuc  *
171ebfedea0SLionel Sambuc  * @param context A Kerberos 5 context
172ebfedea0SLionel Sambuc  * @param eval the exit code to exit with
173ebfedea0SLionel Sambuc  * @param code error code of the last error
174ebfedea0SLionel Sambuc  * @param fmt message to print
175ebfedea0SLionel Sambuc  * @param ap arguments
176ebfedea0SLionel Sambuc  *
177ebfedea0SLionel Sambuc  * @ingroup krb5_error
178ebfedea0SLionel Sambuc  */
179ebfedea0SLionel Sambuc 
180ebfedea0SLionel Sambuc KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
krb5_verr(krb5_context context,int eval,krb5_error_code code,const char * fmt,va_list ap)181ebfedea0SLionel Sambuc krb5_verr(krb5_context context, int eval, krb5_error_code code,
182ebfedea0SLionel Sambuc 	  const char *fmt, va_list ap)
183ebfedea0SLionel Sambuc      __attribute__ ((noreturn, format (printf, 4, 0)))
184ebfedea0SLionel Sambuc {
185ebfedea0SLionel Sambuc     _warnerr(context, 1, code, 0, fmt, ap);
186ebfedea0SLionel Sambuc     exit(eval);
187ebfedea0SLionel Sambuc     UNREACHABLE(return 0);
188ebfedea0SLionel Sambuc }
189ebfedea0SLionel Sambuc 
190ebfedea0SLionel Sambuc /**
191ebfedea0SLionel Sambuc  * Log a warning to the log, default stderr, include bthe error from
192ebfedea0SLionel Sambuc  * the last failure and then exit.
193ebfedea0SLionel Sambuc  *
194ebfedea0SLionel Sambuc  * @param context A Kerberos 5 context
195ebfedea0SLionel Sambuc  * @param eval the exit code to exit with
196ebfedea0SLionel Sambuc  * @param code error code of the last error
197ebfedea0SLionel Sambuc  * @param fmt message to print
198ebfedea0SLionel Sambuc  *
199ebfedea0SLionel Sambuc  * @ingroup krb5_error
200ebfedea0SLionel Sambuc  */
201ebfedea0SLionel Sambuc 
202ebfedea0SLionel Sambuc KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
krb5_err(krb5_context context,int eval,krb5_error_code code,const char * fmt,...)203ebfedea0SLionel Sambuc krb5_err(krb5_context context, int eval, krb5_error_code code,
204ebfedea0SLionel Sambuc 	 const char *fmt, ...)
205ebfedea0SLionel Sambuc      __attribute__ ((noreturn, format (printf, 4, 5)))
206ebfedea0SLionel Sambuc {
207ebfedea0SLionel Sambuc     FUNC(1, code, 0);
208ebfedea0SLionel Sambuc     exit(eval);
209ebfedea0SLionel Sambuc     UNREACHABLE(return 0);
210ebfedea0SLionel Sambuc }
211ebfedea0SLionel Sambuc 
212ebfedea0SLionel Sambuc /**
213ebfedea0SLionel Sambuc  * Log a warning to the log, default stderr, and then exit.
214ebfedea0SLionel Sambuc  *
215ebfedea0SLionel Sambuc  * @param context A Kerberos 5 context
216ebfedea0SLionel Sambuc  * @param eval the exit code to exit with
217ebfedea0SLionel Sambuc  * @param fmt message to print
218ebfedea0SLionel Sambuc  * @param ap arguments
219ebfedea0SLionel Sambuc  *
220ebfedea0SLionel Sambuc  * @ingroup krb5_error
221ebfedea0SLionel Sambuc  */
222ebfedea0SLionel Sambuc 
223ebfedea0SLionel Sambuc KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
krb5_verrx(krb5_context context,int eval,const char * fmt,va_list ap)224ebfedea0SLionel Sambuc krb5_verrx(krb5_context context, int eval, const char *fmt, va_list ap)
225ebfedea0SLionel Sambuc      __attribute__ ((noreturn, format (printf, 3, 0)))
226ebfedea0SLionel Sambuc {
227ebfedea0SLionel Sambuc     _warnerr(context, 0, 0, 0, fmt, ap);
228ebfedea0SLionel Sambuc     exit(eval);
229ebfedea0SLionel Sambuc     UNREACHABLE(return 0);
230ebfedea0SLionel Sambuc }
231ebfedea0SLionel Sambuc 
232ebfedea0SLionel Sambuc /**
233ebfedea0SLionel Sambuc  * Log a warning to the log, default stderr, and then exit.
234ebfedea0SLionel Sambuc  *
235ebfedea0SLionel Sambuc  * @param context A Kerberos 5 context
236ebfedea0SLionel Sambuc  * @param eval the exit code to exit with
237ebfedea0SLionel Sambuc  * @param fmt message to print
238ebfedea0SLionel Sambuc  *
239ebfedea0SLionel Sambuc  * @ingroup krb5_error
240ebfedea0SLionel Sambuc  */
241ebfedea0SLionel Sambuc 
242ebfedea0SLionel Sambuc KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
krb5_errx(krb5_context context,int eval,const char * fmt,...)243ebfedea0SLionel Sambuc krb5_errx(krb5_context context, int eval, const char *fmt, ...)
244ebfedea0SLionel Sambuc      __attribute__ ((noreturn, format (printf, 3, 4)))
245ebfedea0SLionel Sambuc {
246ebfedea0SLionel Sambuc     FUNC(0, 0, 0);
247ebfedea0SLionel Sambuc     exit(eval);
248ebfedea0SLionel Sambuc     UNREACHABLE(return 0);
249ebfedea0SLionel Sambuc }
250ebfedea0SLionel Sambuc 
251ebfedea0SLionel Sambuc /**
252ebfedea0SLionel Sambuc  * Log a warning to the log, default stderr, include bthe error from
253ebfedea0SLionel Sambuc  * the last failure and then abort.
254ebfedea0SLionel Sambuc  *
255ebfedea0SLionel Sambuc  * @param context A Kerberos 5 context
256ebfedea0SLionel Sambuc  * @param code error code of the last error
257ebfedea0SLionel Sambuc  * @param fmt message to print
258ebfedea0SLionel Sambuc  * @param ap arguments
259ebfedea0SLionel Sambuc  *
260ebfedea0SLionel Sambuc  * @ingroup krb5_error
261ebfedea0SLionel Sambuc  */
262ebfedea0SLionel Sambuc 
263ebfedea0SLionel Sambuc KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
krb5_vabort(krb5_context context,krb5_error_code code,const char * fmt,va_list ap)264ebfedea0SLionel Sambuc krb5_vabort(krb5_context context, krb5_error_code code,
265ebfedea0SLionel Sambuc 	    const char *fmt, va_list ap)
266ebfedea0SLionel Sambuc      __attribute__ ((noreturn, format (printf, 3, 0)))
267ebfedea0SLionel Sambuc {
268ebfedea0SLionel Sambuc     _warnerr(context, 1, code, 0, fmt, ap);
269ebfedea0SLionel Sambuc     abort();
270ebfedea0SLionel Sambuc     UNREACHABLE(return 0);
271ebfedea0SLionel Sambuc }
272ebfedea0SLionel Sambuc 
273ebfedea0SLionel Sambuc /**
274ebfedea0SLionel Sambuc  * Log a warning to the log, default stderr, include the error from
275ebfedea0SLionel Sambuc  * the last failure and then abort.
276ebfedea0SLionel Sambuc  *
277ebfedea0SLionel Sambuc  * @param context A Kerberos 5 context
278ebfedea0SLionel Sambuc  * @param code error code of the last error
279ebfedea0SLionel Sambuc  * @param fmt message to print
280ebfedea0SLionel Sambuc  *
281ebfedea0SLionel Sambuc  * @ingroup krb5_error
282ebfedea0SLionel Sambuc  */
283ebfedea0SLionel Sambuc 
284ebfedea0SLionel Sambuc KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
krb5_abort(krb5_context context,krb5_error_code code,const char * fmt,...)285ebfedea0SLionel Sambuc krb5_abort(krb5_context context, krb5_error_code code, const char *fmt, ...)
286ebfedea0SLionel Sambuc      __attribute__ ((noreturn, format (printf, 3, 4)))
287ebfedea0SLionel Sambuc {
288ebfedea0SLionel Sambuc     FUNC(1, code, 0);
289ebfedea0SLionel Sambuc     abort();
290ebfedea0SLionel Sambuc     UNREACHABLE(return 0);
291ebfedea0SLionel Sambuc }
292ebfedea0SLionel Sambuc 
293ebfedea0SLionel Sambuc KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
krb5_vabortx(krb5_context context,const char * fmt,va_list ap)294ebfedea0SLionel Sambuc krb5_vabortx(krb5_context context, const char *fmt, va_list ap)
295ebfedea0SLionel Sambuc      __attribute__ ((noreturn, format (printf, 2, 0)))
296ebfedea0SLionel Sambuc {
297ebfedea0SLionel Sambuc     _warnerr(context, 0, 0, 0, fmt, ap);
298ebfedea0SLionel Sambuc     abort();
299ebfedea0SLionel Sambuc     UNREACHABLE(return 0);
300ebfedea0SLionel Sambuc }
301ebfedea0SLionel Sambuc 
302ebfedea0SLionel Sambuc /**
303ebfedea0SLionel Sambuc  * Log a warning to the log, default stderr, and then abort.
304ebfedea0SLionel Sambuc  *
305ebfedea0SLionel Sambuc  * @param context A Kerberos 5 context
306ebfedea0SLionel Sambuc  * @param code error code of the last error
307ebfedea0SLionel Sambuc  * @param fmt message to print
308ebfedea0SLionel Sambuc  *
309ebfedea0SLionel Sambuc  * @ingroup krb5_error
310ebfedea0SLionel Sambuc  */
311ebfedea0SLionel Sambuc 
312ebfedea0SLionel Sambuc KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
krb5_abortx(krb5_context context,const char * fmt,...)313ebfedea0SLionel Sambuc krb5_abortx(krb5_context context, const char *fmt, ...)
314ebfedea0SLionel Sambuc      __attribute__ ((noreturn, format (printf, 2, 3)))
315ebfedea0SLionel Sambuc {
316ebfedea0SLionel Sambuc     FUNC(0, 0, 0);
317ebfedea0SLionel Sambuc     abort();
318ebfedea0SLionel Sambuc     UNREACHABLE(return 0);
319ebfedea0SLionel Sambuc }
320ebfedea0SLionel Sambuc 
321ebfedea0SLionel Sambuc /**
322ebfedea0SLionel Sambuc  * Set the default logging facility.
323ebfedea0SLionel Sambuc  *
324ebfedea0SLionel Sambuc  * @param context A Kerberos 5 context
325ebfedea0SLionel Sambuc  * @param fac Facility to use for logging.
326ebfedea0SLionel Sambuc  *
327ebfedea0SLionel Sambuc  * @ingroup krb5_error
328ebfedea0SLionel Sambuc  */
329ebfedea0SLionel Sambuc 
330ebfedea0SLionel Sambuc KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
krb5_set_warn_dest(krb5_context context,krb5_log_facility * fac)331ebfedea0SLionel Sambuc krb5_set_warn_dest(krb5_context context, krb5_log_facility *fac)
332ebfedea0SLionel Sambuc {
333ebfedea0SLionel Sambuc     context->warn_dest = fac;
334ebfedea0SLionel Sambuc     return 0;
335ebfedea0SLionel Sambuc }
336ebfedea0SLionel Sambuc 
337ebfedea0SLionel Sambuc /**
338ebfedea0SLionel Sambuc  * Get the default logging facility.
339ebfedea0SLionel Sambuc  *
340ebfedea0SLionel Sambuc  * @param context A Kerberos 5 context
341ebfedea0SLionel Sambuc  *
342ebfedea0SLionel Sambuc  * @ingroup krb5_error
343ebfedea0SLionel Sambuc  */
344ebfedea0SLionel Sambuc 
345ebfedea0SLionel Sambuc KRB5_LIB_FUNCTION krb5_log_facility * KRB5_LIB_CALL
krb5_get_warn_dest(krb5_context context)346ebfedea0SLionel Sambuc krb5_get_warn_dest(krb5_context context)
347ebfedea0SLionel Sambuc {
348ebfedea0SLionel Sambuc     return context->warn_dest;
349ebfedea0SLionel Sambuc }
350