~andreserl/ubuntu/lucid/bind9/bind9-apport-533601

« back to all changes in this revision

Viewing changes to bin/named/logconf.c

  • Committer: Bazaar Package Importer
  • Author(s): LaMont Jones, LaMont Jones, Internet Software Consortium, Inc, localization folks
  • Date: 2008-08-02 14:20:20 UTC
  • mfrom: (1.2.1 upstream) (6.1.24 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080802142020-l1hon9jy8lbbjxmg
[LaMont Jones]

* default to using resolvconf if it is installed
* fix sonames and dependencies.  Closes: #149259, #492418
* Do not build-depend libcap2-dev on non-linux.  Closes: #493392
* drop unused query-loc manpage.  Closes: #492564
* lwresd: Deliver /etc/bind directory.  Closes: #490027
* fix query-source comment in default install

[Internet Software Consortium, Inc]

* 9.5.0-P2.  Closes: #492949

[localization folks]

* l10n: Spanish debconf translation.  Closes: #492425 (Ignacio Mondino)
* l10n: Swedish debconf templates.  Closes: #491369 (Martin Ågren)
* l10n: Japanese debconf translations.  Closes: #492048 (Hideki Yamane
  (Debian-JP))
* l10n: Finnish translation.  Closes: #490630 (Esko Arajärvi)
* l10n: Italian debconf translations.  Closes: #492587 (Alessandro Vietta)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * Copyright (C) 2004  Internet Systems Consortium, Inc. ("ISC")
 
2
 * Copyright (C) 2004-2007  Internet Systems Consortium, Inc. ("ISC")
3
3
 * Copyright (C) 1999-2001  Internet Software Consortium.
4
4
 *
5
 
 * Permission to use, copy, modify, and distribute this software for any
 
5
 * Permission to use, copy, modify, and/or distribute this software for any
6
6
 * purpose with or without fee is hereby granted, provided that the above
7
7
 * copyright notice and this permission notice appear in all copies.
8
8
 *
15
15
 * PERFORMANCE OF THIS SOFTWARE.
16
16
 */
17
17
 
18
 
/* $Id: logconf.c,v 1.30.2.3.10.2 2004/03/06 10:21:18 marka Exp $ */
 
18
/* $Id: logconf.c,v 1.42 2007/06/19 23:46:59 tbox Exp $ */
 
19
 
 
20
/*! \file */
19
21
 
20
22
#include <config.h>
21
23
 
36
38
               if (result != ISC_R_SUCCESS) goto cleanup;        \
37
39
        } while (0)
38
40
 
39
 
/*
 
41
/*%
40
42
 * Set up a logging category according to the named.conf data
41
43
 * in 'ccat' and add it to 'lctx'.
42
44
 */
43
45
static isc_result_t
44
 
category_fromconf(cfg_obj_t *ccat, isc_logconfig_t *lctx) {
 
46
category_fromconf(const cfg_obj_t *ccat, isc_logconfig_t *lctx) {
45
47
        isc_result_t result;
46
48
        const char *catname;
47
49
        isc_logcategory_t *category;
48
50
        isc_logmodule_t *module;
49
 
        cfg_obj_t *destinations = NULL;
50
 
        cfg_listelt_t *element = NULL;
 
51
        const cfg_obj_t *destinations = NULL;
 
52
        const cfg_listelt_t *element = NULL;
51
53
 
52
54
        catname = cfg_obj_asstring(cfg_tuple_get(ccat, "name"));
53
55
        category = isc_log_categorybyname(ns_g_lctx, catname);
68
70
             element != NULL;
69
71
             element = cfg_list_next(element))
70
72
        {
71
 
                cfg_obj_t *channel = cfg_listelt_value(element);
72
 
                char *channelname = cfg_obj_asstring(channel);
 
73
                const cfg_obj_t *channel = cfg_listelt_value(element);
 
74
                const char *channelname = cfg_obj_asstring(channel);
73
75
 
74
76
                result = isc_log_usechannel(lctx, channelname, category,
75
77
                                            module);
84
86
        return (ISC_R_SUCCESS);
85
87
}
86
88
 
87
 
/*
 
89
/*%
88
90
 * Set up a logging channel according to the named.conf data
89
91
 * in 'cchan' and add it to 'lctx'.
90
92
 */
91
93
static isc_result_t
92
 
channel_fromconf(cfg_obj_t *channel, isc_logconfig_t *lctx) {
 
94
channel_fromconf(const cfg_obj_t *channel, isc_logconfig_t *lctx) {
93
95
        isc_result_t result;
94
96
        isc_logdestination_t dest;
95
97
        unsigned int type;
96
98
        unsigned int flags = 0;
97
99
        int level;
98
100
        const char *channelname;
99
 
        cfg_obj_t *fileobj = NULL;
100
 
        cfg_obj_t *syslogobj = NULL;
101
 
        cfg_obj_t *nullobj = NULL;
102
 
        cfg_obj_t *stderrobj = NULL;
103
 
        cfg_obj_t *severity = NULL;
 
101
        const cfg_obj_t *fileobj = NULL;
 
102
        const cfg_obj_t *syslogobj = NULL;
 
103
        const cfg_obj_t *nullobj = NULL;
 
104
        const cfg_obj_t *stderrobj = NULL;
 
105
        const cfg_obj_t *severity = NULL;
104
106
        int i;
105
107
 
106
108
        channelname = cfg_obj_asstring(cfg_map_getname(channel));
130
132
        type = ISC_LOG_TONULL;
131
133
        
132
134
        if (fileobj != NULL) {
133
 
                cfg_obj_t *pathobj = cfg_tuple_get(fileobj, "file");
134
 
                cfg_obj_t *sizeobj = cfg_tuple_get(fileobj, "size");
135
 
                cfg_obj_t *versionsobj = cfg_tuple_get(fileobj, "versions");
 
135
                const cfg_obj_t *pathobj = cfg_tuple_get(fileobj, "file");
 
136
                const cfg_obj_t *sizeobj = cfg_tuple_get(fileobj, "size");
 
137
                const cfg_obj_t *versionsobj =
 
138
                                 cfg_tuple_get(fileobj, "versions");
136
139
                isc_int32_t versions = ISC_LOG_ROLLNEVER;
137
140
                isc_offset_t size = 0;
138
141
 
157
160
                type = ISC_LOG_TOSYSLOG;
158
161
 
159
162
                if (cfg_obj_isstring(syslogobj)) {
160
 
                        char *facilitystr = cfg_obj_asstring(syslogobj);
 
163
                        const char *facilitystr = cfg_obj_asstring(syslogobj);
161
164
                        (void)isc_syslog_facilityfromstring(facilitystr,
162
165
                                                            &facility);
163
166
                }
174
177
         * Munge flags.
175
178
         */
176
179
        {
177
 
                cfg_obj_t *printcat = NULL;
178
 
                cfg_obj_t *printsev = NULL;
179
 
                cfg_obj_t *printtime = NULL;
 
180
                const cfg_obj_t *printcat = NULL;
 
181
                const cfg_obj_t *printsev = NULL;
 
182
                const cfg_obj_t *printtime = NULL;
180
183
 
181
184
                (void)cfg_map_get(channel, "print-category", &printcat);
182
185
                (void)cfg_map_get(channel, "print-severity", &printsev);
193
196
        level = ISC_LOG_INFO;
194
197
        if (cfg_map_get(channel, "severity", &severity) == ISC_R_SUCCESS) {
195
198
                if (cfg_obj_isstring(severity)) {
196
 
                        char *str = cfg_obj_asstring(severity);
 
199
                        const char *str = cfg_obj_asstring(severity);
197
200
                        if (strcasecmp(str, "critical") == 0)
198
201
                                level = ISC_LOG_CRITICAL;
199
202
                        else if (strcasecmp(str, "error") == 0)
242
245
}
243
246
 
244
247
isc_result_t
245
 
ns_log_configure(isc_logconfig_t *logconf, cfg_obj_t *logstmt) {
 
248
ns_log_configure(isc_logconfig_t *logconf, const cfg_obj_t *logstmt) {
246
249
        isc_result_t result;
247
 
        cfg_obj_t *channels = NULL;
248
 
        cfg_obj_t *categories = NULL;
249
 
        cfg_listelt_t *element;
 
250
        const cfg_obj_t *channels = NULL;
 
251
        const cfg_obj_t *categories = NULL;
 
252
        const cfg_listelt_t *element;
250
253
        isc_boolean_t default_set = ISC_FALSE;
251
254
        isc_boolean_t unmatched_set = ISC_FALSE;
 
255
        const cfg_obj_t *catname;
252
256
 
253
257
        CHECK(ns_log_setdefaultchannels(logconf));
254
258
 
257
261
             element != NULL;
258
262
             element = cfg_list_next(element))
259
263
        {
260
 
                cfg_obj_t *channel = cfg_listelt_value(element);
 
264
                const cfg_obj_t *channel = cfg_listelt_value(element);
261
265
                CHECK(channel_fromconf(channel, logconf));
262
266
        }
263
267
 
266
270
             element != NULL;
267
271
             element = cfg_list_next(element))
268
272
        {
269
 
                cfg_obj_t *category = cfg_listelt_value(element);
 
273
                const cfg_obj_t *category = cfg_listelt_value(element);
270
274
                CHECK(category_fromconf(category, logconf));
271
275
                if (!default_set) {
272
 
                        cfg_obj_t *catname = cfg_tuple_get(category, "name");
 
276
                        catname = cfg_tuple_get(category, "name");
273
277
                        if (strcmp(cfg_obj_asstring(catname), "default") == 0)
274
278
                                default_set = ISC_TRUE;
275
279
                }
276
280
                if (!unmatched_set) {
277
 
                        cfg_obj_t *catname = cfg_tuple_get(category, "name");
 
281
                        catname = cfg_tuple_get(category, "name");
278
282
                        if (strcmp(cfg_obj_asstring(catname), "unmatched") == 0)
279
283
                                unmatched_set = ISC_TRUE;
280
284
                }