1 diff -Naur radsecproxy-1.5-orig/debug.c radsecproxy-1.5/debug.c
2 --- radsecproxy-1.5-orig/debug.c 2011-10-01 10:26:44.000000000 +0200
3 +++ radsecproxy-1.5/debug.c 2011-12-12 14:43:32.000000000 +0100
5 static char *debug_filepath = NULL;
6 static FILE *debug_file = NULL;
7 static int debug_syslogfacility = 0;
8 +#if defined(WANT_FTICKS)
9 +static int fticks_syslogfacility = 0;
11 static uint8_t debug_timestamp = 0;
13 void debug_init(char *ident) {
18 -int debug_set_destination(char *dest) {
19 - static const char *facstrings[] = { "LOG_DAEMON", "LOG_MAIL", "LOG_USER", "LOG_LOCAL0",
20 - "LOG_LOCAL1", "LOG_LOCAL2", "LOG_LOCAL3", "LOG_LOCAL4",
21 - "LOG_LOCAL5", "LOG_LOCAL6", "LOG_LOCAL7", NULL };
22 - static const int facvals[] = { LOG_DAEMON, LOG_MAIL, LOG_USER, LOG_LOCAL0,
23 - LOG_LOCAL1, LOG_LOCAL2, LOG_LOCAL3, LOG_LOCAL4,
24 - LOG_LOCAL5, LOG_LOCAL6, LOG_LOCAL7 };
25 +int debug_set_destination(char *dest, int log_type) {
26 + static const char *facstrings[] = {
27 + "LOG_DAEMON", "LOG_MAIL", "LOG_USER", "LOG_LOCAL0",
28 + "LOG_LOCAL1", "LOG_LOCAL2", "LOG_LOCAL3", "LOG_LOCAL4",
29 + "LOG_LOCAL5", "LOG_LOCAL6", "LOG_LOCAL7", NULL };
30 + static const int facvals[] = {
31 + LOG_DAEMON, LOG_MAIL, LOG_USER, LOG_LOCAL0,
32 + LOG_LOCAL1, LOG_LOCAL2, LOG_LOCAL3, LOG_LOCAL4,
33 + LOG_LOCAL5, LOG_LOCAL6, LOG_LOCAL7 };
37 if (!strncasecmp(dest, "file:///", 8)) {
38 - debug_filepath = stringcopy(dest + 7, 0);
39 - debug_file = fopen(debug_filepath, "a");
41 - debug_file = stderr;
42 - debugx(1, DBG_ERR, "Failed to open logfile %s\n%s",
43 - debug_filepath, strerror(errno));
44 + if (log_type != LOG_TYPE_FTICKS) {
45 + debug_filepath = stringcopy(dest + 7, 0);
46 + debug_file = fopen(debug_filepath, "a");
48 + debug_file = stderr;
49 + debugx(1, DBG_ERR, "Failed to open logfile %s\n%s",
50 + debug_filepath, strerror(errno));
52 + setvbuf(debug_file, NULL, _IONBF, 0);
54 + debug(DBG_WARN, "FTicksSyslogFacility starting with file:/// not "
55 + "permitted, assuming default F-Ticks destination");
57 - setvbuf(debug_file, NULL, _IONBF, 0);
60 - if (!strncasecmp(dest, "x-syslog://", 11)) {
64 + if (!strncasecmp(dest, "x-syslog://", 11) || log_type == LOG_TYPE_FTICKS) {
65 + if (!strncasecmp(dest, "x-syslog://", 11)) {
71 for (i = 0; facstrings[i]; i++)
72 if (!strcasecmp(dest, facstrings[i]))
75 debugx(1, DBG_ERR, "Unknown syslog facility %s", dest);
76 - debug_syslogfacility = facvals[i];
78 - debug_syslogfacility = LOG_DAEMON;
79 + if (log_type != LOG_TYPE_FTICKS)
80 + debug_syslogfacility = facvals[i];
81 +#if defined(WANT_FTICKS)
82 + else if (log_type == LOG_TYPE_FTICKS)
83 + fticks_syslogfacility = facvals[i];
86 + if (log_type != LOG_TYPE_FTICKS)
87 + debug_syslogfacility = LOG_DAEMON;
88 +#if defined(WANT_FTICKS)
89 + else if (log_type == LOG_TYPE_FTICKS)
90 + fticks_syslogfacility = 0;
93 openlog(debug_ident, LOG_PID, debug_syslogfacility);
100 +#if defined(WANT_FTICKS)
101 +void fticks_debug(const char *format, ...) {
104 + va_start(ap, format);
105 + if (!debug_syslogfacility && !fticks_syslogfacility)
106 + debug_logit(0xff, format, ap);
108 + priority = LOG_DEBUG | fticks_syslogfacility;
109 + vsyslog(priority, format, ap);
114 /* Local Variables: */
115 /* c-file-style: "stroustrup" */
117 diff -Naur radsecproxy-1.5-orig/debug.h radsecproxy-1.5/debug.h
118 --- radsecproxy-1.5-orig/debug.h 2011-10-01 10:26:44.000000000 +0200
119 +++ radsecproxy-1.5/debug.h 2011-12-12 14:46:04.000000000 +0100
124 +#define LOG_TYPE_DEBUG 0
125 +#define LOG_TYPE_FTICKS 1
127 void debug_init(char *ident);
128 void debug_set_level(uint8_t level);
129 void debug_timestamp_on();
131 void debugx(int status, uint8_t level, char *format, ...);
132 void debugerrno(int err, uint8_t level, char *format, ...);
133 void debugerrnox(int err, uint8_t level, char *format, ...);
134 -int debug_set_destination(char *dest);
135 +int debug_set_destination(char *dest, int log_type);
136 void debug_reopen_log();
137 +#if defined(WANT_FTICKS)
138 +void fticks_debug(const char *format, ...);
141 /* Local Variables: */
142 /* c-file-style: "stroustrup" */
143 diff -Naur radsecproxy-1.5-orig/fticks.c radsecproxy-1.5/fticks.c
144 --- radsecproxy-1.5-orig/fticks.c 2011-10-08 16:03:47.000000000 +0200
145 +++ radsecproxy-1.5/fticks.c 2011-11-30 13:03:37.000000000 +0100
152 "F-TICKS/eduroam/1.0#REALM=%s#VISCOUNTRY=%s#%sCSI=%s#RESULT=%s#",
154 client->conf->fticks_viscountry,
155 diff -Naur radsecproxy-1.5-orig/radsecproxy.c radsecproxy-1.5/radsecproxy.c
156 --- radsecproxy-1.5-orig/radsecproxy.c 2011-10-08 16:03:48.000000000 +0200
157 +++ radsecproxy-1.5/radsecproxy.c 2011-12-12 14:46:25.000000000 +0100
158 @@ -3085,6 +3085,7 @@
159 "FTicksReporting", CONF_STR, &fticks_reporting_str,
160 "FTicksMAC", CONF_STR, &fticks_mac_str,
161 "FTicksKey", CONF_STR, &fticks_key_str,
162 + "FTicksSyslogFacility", CONF_STR, &options.ftickssyslogfacility,
166 @@ -3239,8 +3240,18 @@
167 options.loglevel = loglevel;
168 else if (options.loglevel)
169 debug_set_level(options.loglevel);
171 - debug_set_destination(options.logdestination ? options.logdestination : "x-syslog:///");
173 + debug_set_destination(options.logdestination
174 + ? options.logdestination
175 + : "x-syslog:///", LOG_TYPE_DEBUG);
176 +#if defined(WANT_FTICKS)
177 + if (options.ftickssyslogfacility) {
178 + debug_set_destination(options.ftickssyslogfacility,
180 + free(options.ftickssyslogfacility);
184 free(options.logdestination);
186 if (!list_first(clconfs))
187 diff -Naur radsecproxy-1.5-orig/radsecproxy.conf.5.xml radsecproxy-1.5/radsecproxy.conf.5.xml
188 --- radsecproxy-1.5-orig/radsecproxy.conf.5.xml 2011-10-08 15:59:25.000000000 +0200
189 +++ radsecproxy-1.5/radsecproxy.conf.5.xml 2011-11-30 13:03:58.000000000 +0100
194 + <term><literal>FTicksSyslogFacility</literal></term>
197 + The FTicksSyslogFacility option is used to specify
198 + a dedicated syslog facility for F-Ticks messages.
199 + This allows easy filtering of F-Ticks messages.
200 + By default, if FTicksSyslogFacility is not given,
201 + F-Ticks messages are written to the LogDestination.
204 + For F-Ticks messages always LOG_DEBUG level is used.
205 + Note that FTicksSyslogFacility value specifying a file
206 + (via file:/// prefix) is ignored.
212 <term><literal>ListenUDP</literal></term>
215 diff -Naur radsecproxy-1.5-orig/radsecproxy.conf-example radsecproxy-1.5/radsecproxy.conf-example
216 --- radsecproxy-1.5-orig/radsecproxy.conf-example 2011-10-08 15:00:14.000000000 +0200
217 +++ radsecproxy-1.5/radsecproxy.conf-example 2011-11-30 13:03:58.000000000 +0100
219 #FTicksReporting None
222 +# You can optionally specify FTicksSyslogFacility to use a dedicated
223 +# syslog facility for F-Ticks messages. This allows easy filtering
224 +# of F-Ticks messages.
225 +# For F-Ticks messages always LOG_DEBUG level is used.
226 +# Please note that FTicksSyslogFacility cannot specify a file (file:///...)
227 +#FTicksSyslogFacility log_local1
228 +#FTicksSyslogFacility x-syslog:///log_local1
230 # There is an option for doing some simple loop prevention. Note that
231 # the LoopPrevention directive can be used in server blocks too,
232 # overriding what's set here in the basic settings.
233 diff -Naur radsecproxy-1.5-orig/radsecproxy.h radsecproxy-1.5/radsecproxy.h
234 --- radsecproxy-1.5-orig/radsecproxy.h 2011-10-08 14:35:39.000000000 +0200
235 +++ radsecproxy-1.5/radsecproxy.h 2011-11-30 13:03:47.000000000 +0100
239 char *logdestination;
240 + char *ftickssyslogfacility;
242 uint32_t ttlattrtype[2];