1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158
|
KRB5_OPENLOG(3) BSD Library Functions Manual KRB5_OPENLOG(3)
NNAAMMEE
kkrrbb55__iinniittlloogg, kkrrbb55__ooppeennlloogg, kkrrbb55__cclloosseelloogg, kkrrbb55__aaddddlloogg__ddeesstt,
kkrrbb55__aaddddlloogg__ffuunncc, kkrrbb55__lloogg, kkrrbb55__vvlloogg, kkrrbb55__lloogg__mmssgg, kkrrbb55__vvlloogg__mmssgg --
Heimdal logging functions
LLIIBBRRAARRYY
Kerberos 5 Library (libkrb5, -lkrb5)
SSYYNNOOPPSSIISS
##iinncclluuddee <<kkrrbb55..hh>>
_t_y_p_e_d_e_f _v_o_i_d
(**kkrrbb55__lloogg__lloogg__ffuunncc__tt)(_c_o_n_s_t _c_h_a_r _*_t_i_m_e, _c_o_n_s_t _c_h_a_r _*_m_e_s_s_a_g_e,
_v_o_i_d _*_d_a_t_a);
_t_y_p_e_d_e_f _v_o_i_d
(**kkrrbb55__lloogg__cclloossee__ffuunncc__tt)(_v_o_i_d _*_d_a_t_a);
_k_r_b_5___e_r_r_o_r___c_o_d_e
kkrrbb55__aaddddlloogg__ddeesstt(_k_r_b_5___c_o_n_t_e_x_t _c_o_n_t_e_x_t, _k_r_b_5___l_o_g___f_a_c_i_l_i_t_y _*_f_a_c_i_l_i_t_y,
_c_o_n_s_t _c_h_a_r _*_d_e_s_t_i_n_a_t_i_o_n);
_k_r_b_5___e_r_r_o_r___c_o_d_e
kkrrbb55__aaddddlloogg__ffuunncc(_k_r_b_5___c_o_n_t_e_x_t _c_o_n_t_e_x_t, _k_r_b_5___l_o_g___f_a_c_i_l_i_t_y _*_f_a_c_i_l_i_t_y,
_i_n_t _m_i_n, _i_n_t _m_a_x, _k_r_b_5___l_o_g___l_o_g___f_u_n_c___t _l_o_g,
_k_r_b_5___l_o_g___c_l_o_s_e___f_u_n_c___t _c_l_o_s_e, _v_o_i_d _*_d_a_t_a);
_k_r_b_5___e_r_r_o_r___c_o_d_e
kkrrbb55__cclloosseelloogg(_k_r_b_5___c_o_n_t_e_x_t _c_o_n_t_e_x_t, _k_r_b_5___l_o_g___f_a_c_i_l_i_t_y _*_f_a_c_i_l_i_t_y);
_k_r_b_5___e_r_r_o_r___c_o_d_e
kkrrbb55__iinniittlloogg(_k_r_b_5___c_o_n_t_e_x_t _c_o_n_t_e_x_t, _c_o_n_s_t _c_h_a_r _*_p_r_o_g_r_a_m,
_k_r_b_5___l_o_g___f_a_c_i_l_i_t_y _*_*_f_a_c_i_l_i_t_y);
_k_r_b_5___e_r_r_o_r___c_o_d_e
kkrrbb55__lloogg(_k_r_b_5___c_o_n_t_e_x_t _c_o_n_t_e_x_t, _k_r_b_5___l_o_g___f_a_c_i_l_i_t_y _*_f_a_c_i_l_i_t_y, _i_n_t _l_e_v_e_l,
_c_o_n_s_t _c_h_a_r _*_f_o_r_m_a_t, _._._.);
_k_r_b_5___e_r_r_o_r___c_o_d_e
kkrrbb55__lloogg__mmssgg(_k_r_b_5___c_o_n_t_e_x_t _c_o_n_t_e_x_t, _k_r_b_5___l_o_g___f_a_c_i_l_i_t_y _*_f_a_c_i_l_i_t_y,
_c_h_a_r _*_*_r_e_p_l_y, _i_n_t _l_e_v_e_l, _c_o_n_s_t _c_h_a_r _*_f_o_r_m_a_t, _._._.);
_k_r_b_5___e_r_r_o_r___c_o_d_e
kkrrbb55__ooppeennlloogg(_k_r_b_5___c_o_n_t_e_x_t _c_o_n_t_e_x_t, _c_o_n_s_t _c_h_a_r _*_p_r_o_g_r_a_m,
_k_r_b_5___l_o_g___f_a_c_i_l_i_t_y _*_*_f_a_c_i_l_i_t_y);
_k_r_b_5___e_r_r_o_r___c_o_d_e
kkrrbb55__vvlloogg(_k_r_b_5___c_o_n_t_e_x_t _c_o_n_t_e_x_t, _k_r_b_5___l_o_g___f_a_c_i_l_i_t_y _*_f_a_c_i_l_i_t_y, _i_n_t _l_e_v_e_l,
_c_o_n_s_t _c_h_a_r _*_f_o_r_m_a_t, _v_a___l_i_s_t _a_r_g_l_i_s_t);
_k_r_b_5___e_r_r_o_r___c_o_d_e
kkrrbb55__vvlloogg__mmssgg(_k_r_b_5___c_o_n_t_e_x_t _c_o_n_t_e_x_t, _k_r_b_5___l_o_g___f_a_c_i_l_i_t_y _*_f_a_c_i_l_i_t_y,
_c_h_a_r _*_*_r_e_p_l_y, _i_n_t _l_e_v_e_l, _c_o_n_s_t _c_h_a_r _*_f_o_r_m_a_t, _v_a___l_i_s_t _a_r_g_l_i_s_t);
DDEESSCCRRIIPPTTIIOONN
These functions logs messages to one or more destinations.
The kkrrbb55__ooppeennlloogg() function creates a logging _f_a_c_i_l_i_t_y, that is used to
log messages. A facility consists of one or more destinations (which can
be files or syslog or some other device). The _p_r_o_g_r_a_m parameter should be
the generic name of the program that is doing the logging. This name is
used to lookup which destinations to use. This information is contained
in the logging section of the _k_r_b_5_._c_o_n_f configuration file. If no entry
is found for _p_r_o_g_r_a_m, the entry for default is used, or if that is miss-
ing too, SYSLOG will be used as destination.
To close a logging facility, use the kkrrbb55__cclloosseelloogg() function.
To log a message to a facility use one of the functions kkrrbb55__lloogg(),
kkrrbb55__lloogg__mmssgg(), kkrrbb55__vvlloogg(), or kkrrbb55__vvlloogg__mmssgg(). The functions ending in
_msg return in _r_e_p_l_y a pointer to the message that just got logged. This
string is allocated, and should be freed with ffrreeee(). The _f_o_r_m_a_t is a
standard pprriinnttff() style format string (but see the BUGS section).
If you want better control of where things gets logged, you can instead
of using kkrrbb55__ooppeennlloogg() call kkrrbb55__iinniittlloogg(), which just initializes a
facility, but doesn't define any actual logging destinations. You can
then add destinations with the kkrrbb55__aaddddlloogg__ddeesstt() and kkrrbb55__aaddddlloogg__ffuunncc()
functions. The first of these takes a string specifying a logging desti-
nation, and adds this to the facility. If you want to do some non-stan-
dard logging you can use the kkrrbb55__aaddddlloogg__ffuunncc() function, which takes a
function to use when logging. The _l_o_g function is called for each mes-
sage with _t_i_m_e being a string specifying the current time, and _m_e_s_s_a_g_e
the message to log. _c_l_o_s_e is called when the facility is closed. You can
pass application specific data in the _d_a_t_a parameter. The _m_i_n and _m_a_x
parameter are the same as in a destination (defined below). To specify a
max of infinity, pass -1.
kkrrbb55__ooppeennlloogg() calls kkrrbb55__iinniittlloogg() and then calls kkrrbb55__aaddddlloogg__ddeesstt() for
each destination found.
DDeessttiinnaattiioonnss
The defined destinations (as specified in _k_r_b_5_._c_o_n_f) follows:
STDERR
This logs to the program's stderr.
FILE:_/_f_i_l_e
FILE=_/_f_i_l_e
Log to the specified file. The form using a colon appends to
the file, the form with an equal truncates the file. The trun-
cating form keeps the file open, while the appending form
closes it after each log message (which makes it possible to
rotate logs). The truncating form is mainly for compatibility
with the MIT libkrb5.
DEVICE=_/_d_e_v_i_c_e
This logs to the specified device, at present this is the same
as FILE:/device.
CONSOLE
Log to the console, this is the same as DEVICE=/dev/console.
SYSLOG[:priority[:facility]]
Send messages to the syslog system, using priority, and facil-
ity. To get the name for one of these, you take the name of
the macro passed to syslog(3), and remove the leading LOG_
(LOG_NOTICE becomes NOTICE). The default values (as well as
the values used for unrecognised values), are ERR, and AUTH,
respectively. See syslog(3) for a list of priorities and
facilities.
Each destination may optionally be prepended with a range of logging lev-
els, specified as min-max/. If the _l_e_v_e_l parameter to kkrrbb55__lloogg() is
within this range (inclusive) the message gets logged to this destina-
tion, otherwise not. Either of the min and max valued may be omitted, in
this case min is assumed to be zero, and max is assumed to be infinity.
If you don't include a dash, both min and max gets set to the specified
value. If no range is specified, all messages gets logged.
EEXXAAMMPPLLEESS
[logging]
kdc = 0/FILE:/var/log/kdc.log
kdc = 1-/SYSLOG:INFO:USER
default = STDERR
This will log all messages from the kkddcc program with level 0 to
_/_v_a_r_/_l_o_g_/_k_d_c_._l_o_g, other messages will be logged to syslog with priority
LOG_INFO, and facility LOG_USER. All other programs will log all mes-
sages to their stderr.
SSEEEE AALLSSOO
syslog(3), krb5.conf(5)
BBUUGGSS
These functions use aasspprriinnttff() to format the message. If your operating
system does not have a working aasspprriinnttff(), a replacement will be used. At
present this replacement does not handle some correct conversion specifi-
cations (like floating point numbers). Until this is fixed, the use of
these conversions should be avoided.
If logging is done to the syslog facility, these functions might not be
thread-safe, depending on the implementation of ooppeennlloogg(), and ssyysslloogg().
HEIMDAL August 6, 1997 HEIMDAL
|