~ubuntu-branches/ubuntu/karmic/pdnsd/karmic

« back to all changes in this revision

Viewing changes to src/conff.c

  • Committer: Bazaar Package Importer
  • Author(s): Pierre Habouzit
  • Date: 2008-10-05 09:54:52 UTC
  • mfrom: (4.1.4 intrepid)
  • Revision ID: james.westby@ubuntu.com-20081005095452-wc58cmdofvyipcv3
Tags: 1.2.6-par-10
* Add patches/0005-fix-for-CVE-2008-4194.patch for CVE-2008-4194.
  (Closes: #500910).
* Document where the two default configuration are in README.Debian
  (Closes: #499984).
* Update turkish translation thanks to Mert Dirik (Closes: #490047).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* conff.c - Maintain configuration information
2
2
 
3
3
   Copyright (C) 2000, 2001 Thomas Moestl
4
 
   Copyright (C) 2002, 2003, 2004, 2005 Paul A. Rombouts
5
 
 
6
 
This file is part of the pdnsd package.
7
 
 
8
 
pdnsd is free software; you can redistribute it and/or modify
9
 
it under the terms of the GNU General Public License as published by
10
 
the Free Software Foundation; either version 2, or (at your option)
11
 
any later version.
12
 
 
13
 
pdnsd is distributed in the hope that it will be useful,
14
 
but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
 
GNU General Public License for more details.
17
 
 
18
 
You should have received a copy of the GNU General Public License
19
 
along with pdsnd; see the file COPYING.  If not, write to
20
 
the Free Software Foundation, 59 Temple Place - Suite 330,
21
 
Boston, MA 02111-1307, USA.  */
 
4
   Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Paul A. Rombouts
 
5
 
 
6
  This file is part of the pdnsd package.
 
7
 
 
8
  pdnsd is free software; you can redistribute it and/or modify
 
9
  it under the terms of the GNU General Public License as published by
 
10
  the Free Software Foundation; either version 3 of the License, or
 
11
  (at your option) any later version.
 
12
 
 
13
  pdnsd is distributed in the hope that it will be useful,
 
14
  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
15
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
16
  GNU General Public License for more details.
 
17
 
 
18
  You should have received a copy of the GNU General Public License
 
19
  along with pdnsd; see the file COPYING. If not, see
 
20
  <http://www.gnu.org/licenses/>.
 
21
*/
22
22
 
23
23
#include <config.h>
24
24
#include <stdio.h>
65
65
  stat_pipe:         0,
66
66
  notcp:             0,
67
67
  strict_suid:       1,
 
68
  use_nss:           1,
68
69
  paranoid:          0,
69
70
  lndown_kluge:      0,
70
71
  onquery:           0,
83
84
};
84
85
 
85
86
servparm_t serv_presets={
86
 
  port:          53,
87
 
  uptest:        C_NONE,
88
 
  timeout:       120,
89
 
  interval:      900,
90
 
  ping_timeout:  600,
91
 
  scheme:        "",
92
 
  uptest_cmd:    NULL,
93
 
  uptest_usr:    "",
94
 
  interface:     "",
95
 
  device:        "",
96
 
  label:         NULL,
97
 
  purge_cache:   0,
98
 
  nocache:       0,
99
 
  lean_query:    1,
100
 
  is_proxy:      0,
101
 
  rootserver:    0,
102
 
  preset:        1,
103
 
  policy:        C_INCLUDED,
104
 
  alist:         NULL,
105
 
  atup_a:        NULL,
 
87
  port:              53,
 
88
  uptest:            C_NONE,
 
89
  timeout:           120,
 
90
  interval:          900,
 
91
  ping_timeout:      600,
 
92
  scheme:            "",
 
93
  uptest_cmd:        NULL,
 
94
  uptest_usr:        "",
 
95
  interface:         "",
 
96
  device:            "",
 
97
  label:             NULL,
 
98
  purge_cache:       0,
 
99
  nocache:           0,
 
100
  lean_query:        1,
 
101
  is_proxy:          0,
 
102
  rootserver:        0,
 
103
  rand_servers:      0,
 
104
  preset:            1,
 
105
  rejectrecursively: 0,
 
106
  rejectpolicy:      C_FAIL,
 
107
  policy:            C_INCLUDED,
 
108
  alist:             NULL,
 
109
  atup_a:            NULL,
 
110
  reject_a4:         NULL,
 
111
#if ALLOW_LOCAL_AAAA
 
112
  reject_a6:         NULL,
 
113
#endif
106
114
#ifdef ENABLE_IPV4
107
 
  ping_a:        {{INADDR_ANY}}
 
115
  ping_a:            {{INADDR_ANY}}
108
116
#else
109
 
  ping_a:        {IN6ADDR_ANY_INIT}
 
117
  ping_a:            {IN6ADDR_ANY_INIT}
110
118
#endif
111
119
};
112
120
 
348
356
        free(serv->label);
349
357
        da_free(serv->atup_a);
350
358
        free_slist_array(serv->alist);
 
359
        da_free(serv->reject_a4);
 
360
#if ALLOW_LOCAL_AAAA
 
361
        da_free(serv->reject_a6);
 
362
#endif
351
363
}
352
364
 
353
365
static void free_server_data(servparm_array sa)
386
398
        fsprintf_or_return(f,"\tNegative domain policy: %s\n",const_name(global.neg_domain_pol));
387
399
        fsprintf_or_return(f,"\tRun as: %s\n",global.run_as);
388
400
        fsprintf_or_return(f,"\tStrict run as: %s\n",global.strict_suid?"on":"off");
 
401
        fsprintf_or_return(f,"\tUse NSS: %s\n",global.use_nss?"on":"off");
389
402
        fsprintf_or_return(f,"\tParanoid mode (cache pollution prevention): %s\n",global.paranoid?"on":"off");
390
403
        fsprintf_or_return(f,"\tControl socket permissions (mode): %o\n",global.ctl_perms);
391
404
        fsprintf_or_return(f,"\tMaximum parallel queries served: %i\n",global.proc_limit);
433
446
        return retval;
434
447
}
435
448
 
 
449
 
 
450
#if ALLOW_LOCAL_AAAA
 
451
#define serv_has_rejectlist(s) ((s)->reject_a4!=NULL || (s)->reject_a6!=NULL)
 
452
#else
 
453
#define serv_has_rejectlist(s) ((s)->reject_a4!=NULL)
 
454
#endif
 
455
 
 
456
 
436
457
/* Report the current status of server i to the file descriptor f.
437
458
   Call with locks applied.
438
459
*/
475
496
        fsprintf_or_return(f,"\tlean query: %s\n",st->lean_query?"on":"off");
476
497
        fsprintf_or_return(f,"\tUse only proxy?: %s\n",st->is_proxy?"on":"off");
477
498
        fsprintf_or_return(f,"\tAssumed root server: %s\n",st->rootserver?"yes":"no");
 
499
        fsprintf_or_return(f,"\tRandomize server query order: %s\n",st->rand_servers?"yes":"no");
478
500
        fsprintf_or_return(f,"\tDefault policy: %s\n",const_name(st->policy));
479
 
        fsprintf_or_return(f,"\tPolicies:\n");
480
 
        if (st->alist==NULL) {
481
 
                fsprintf_or_return(f,"\t\t(none)\n");
482
 
        } else {
483
 
                for (j=0;j<DA_NEL(st->alist);j++) {
484
 
                        slist_t *sl=&DA_INDEX(st->alist,j);
485
 
                        unsigned char buf[256];
486
 
                        fsprintf_or_return(f,"\t\t%s: %s%s\n",
487
 
                                           sl->rule==C_INCLUDED?"include":"exclude",
488
 
                                           sl->exact?"":".",
489
 
                                           rhn2str(sl->domain,buf,sizeof(buf)));
490
 
                }
 
501
        fsprintf_or_return(f,"\tPolicies:%s\n", st->alist?"":" (none)");
 
502
        for (j=0;j<DA_NEL(st->alist);++j) {
 
503
                slist_t *sl=&DA_INDEX(st->alist,j);
 
504
                unsigned char buf[256];
 
505
                fsprintf_or_return(f,"\t\t%s: %s%s\n",
 
506
                                   sl->rule==C_INCLUDED?"include":"exclude",
 
507
                                   sl->exact?"":".",
 
508
                                   rhn2str(sl->domain,buf,sizeof(buf)));
 
509
        }
 
510
        if(serv_has_rejectlist(st)) {
 
511
                fsprintf_or_return(f,"\tAddresses which should be rejected in replies:\n");
 
512
                for (j=0;j<DA_NEL(st->reject_a4);++j) {
 
513
                        addr4maskpair_t *am=&DA_INDEX(st->reject_a4,j);
 
514
                        char abuf[ADDRSTR_MAXLEN],mbuf[ADDRSTR_MAXLEN];
 
515
                        fsprintf_or_return(f,"\t\t%s/%s\n",inet_ntop(AF_INET,&am->a,abuf,sizeof(abuf)),
 
516
                                           inet_ntop(AF_INET,&am->mask,mbuf,sizeof(mbuf)));
 
517
                }
 
518
#if ALLOW_LOCAL_AAAA
 
519
                for (j=0;j<DA_NEL(st->reject_a6);++j) {
 
520
                        addr6maskpair_t *am=&DA_INDEX(st->reject_a6,j);
 
521
                        char abuf[INET6_ADDRSTRLEN],mbuf[INET6_ADDRSTRLEN];
 
522
                        fsprintf_or_return(f,"\t\t%s/%s\n",inet_ntop(AF_INET6,&am->a,abuf,sizeof(abuf)),
 
523
                                           inet_ntop(AF_INET6,&am->mask,mbuf,sizeof(mbuf)));
 
524
                }
 
525
#endif
 
526
                fsprintf_or_return(f,"\tReject policy: %s\n",const_name(st->rejectpolicy));
 
527
                fsprintf_or_return(f,"\tReject recursively: %s\n",st->rejectrecursively?"yes":"no");
491
528
        }
492
529
        return 0;
493
530
}