~ubuntu-branches/ubuntu/raring/bind9/raring

« back to all changes in this revision

Viewing changes to bin/named/client.c

  • Committer: Package Import Robot
  • Author(s): LaMont Jones
  • Date: 2012-01-19 12:30:31 UTC
  • mfrom: (1.9.1) (26.1.6 sid)
  • Revision ID: package-import@ubuntu.com-20120119123031-0j2wlg66ll5ogpz2
Tags: 1:9.8.1.dfsg.P1-1~build1
preciseĀ upload

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * Copyright (C) 2004-2010  Internet Systems Consortium, Inc. ("ISC")
 
2
 * Copyright (C) 2004-2011  Internet Systems Consortium, Inc. ("ISC")
3
3
 * Copyright (C) 1999-2003  Internet Software Consortium.
4
4
 *
5
5
 * Permission to use, copy, modify, and/or distribute this software for any
15
15
 * PERFORMANCE OF THIS SOFTWARE.
16
16
 */
17
17
 
18
 
/* $Id: client.c,v 1.266.36.2 2010-09-24 08:30:58 tbox Exp $ */
 
18
/* $Id: client.c,v 1.271.10.2 2011-07-28 04:30:54 marka Exp $ */
19
19
 
20
20
#include <config.h>
21
21
 
633
633
                dns_message_puttemprdataset(client->message, &client->opt);
634
634
        }
635
635
 
 
636
        client->signer = NULL;
636
637
        client->udpsize = 512;
637
638
        client->extflags = 0;
638
639
        client->ednsversion = -1;
1312
1313
 
1313
1314
        UNUSED(arg);
1314
1315
 
 
1316
        /*
 
1317
         * ns_g_server->interfacemgr is task exclusive locked.
 
1318
         */
 
1319
        if (ns_g_server->interfacemgr == NULL)
 
1320
                return (ISC_TRUE);
 
1321
 
1315
1322
        if (!ns_interfacemgr_listeningon(ns_g_server->interfacemgr, dstaddr))
1316
1323
                return (ISC_FALSE);
1317
1324
 
1777
1784
 
1778
1785
        }
1779
1786
        if (result == ISC_R_SUCCESS) {
 
1787
                char namebuf[DNS_NAME_FORMATSIZE];
 
1788
                dns_name_format(&client->signername, namebuf, sizeof(namebuf));
1780
1789
                ns_client_log(client, DNS_LOGCATEGORY_SECURITY,
1781
1790
                              NS_LOGMODULE_CLIENT, ISC_LOG_DEBUG(3),
1782
 
                              "request has valid signature");
 
1791
                              "request has valid signature: %s", namebuf);
1783
1792
                client->signer = &client->signername;
1784
1793
        } else if (result == ISC_R_NOTFOUND) {
1785
1794
                ns_client_log(client, DNS_LOGCATEGORY_SECURITY,
2093
2102
        client->next = NULL;
2094
2103
        client->shutdown = NULL;
2095
2104
        client->shutdown_arg = NULL;
 
2105
        client->signer = NULL;
2096
2106
        dns_name_init(&client->signername, NULL);
2097
2107
        client->mortal = ISC_FALSE;
2098
2108
        client->tcpquota = NULL;
2763
2773
ns_client_dumprecursing(FILE *f, ns_clientmgr_t *manager) {
2764
2774
        ns_client_t *client;
2765
2775
        char namebuf[DNS_NAME_FORMATSIZE];
 
2776
        char original[DNS_NAME_FORMATSIZE];
2766
2777
        char peerbuf[ISC_SOCKADDR_FORMATSIZE];
 
2778
        char typebuf[DNS_RDATATYPE_FORMATSIZE];
 
2779
        char classbuf[DNS_RDATACLASS_FORMATSIZE];
2767
2780
        const char *name;
2768
2781
        const char *sep;
 
2782
        const char *origfor;
 
2783
        dns_rdataset_t *rdataset;
2769
2784
 
2770
2785
        REQUIRE(VALID_MANAGER(manager));
2771
2786
 
2783
2798
                        sep = "";
2784
2799
                }
2785
2800
                dns_name_format(client->query.qname, namebuf, sizeof(namebuf));
2786
 
                fprintf(f, "; client %s%s%s: '%s' requesttime %d\n",
2787
 
                        peerbuf, sep, name, namebuf, client->requesttime);
 
2801
                if (client->query.qname != client->query.origqname &&
 
2802
                    client->query.origqname != NULL) {
 
2803
                        origfor = " for ";
 
2804
                        dns_name_format(client->query.origqname, original,
 
2805
                                        sizeof(original));
 
2806
                } else {
 
2807
                        origfor = "";
 
2808
                        original[0] = '\0';
 
2809
                }
 
2810
                rdataset = ISC_LIST_HEAD(client->query.qname->list);
 
2811
                if (rdataset == NULL && client->query.origqname != NULL)
 
2812
                        rdataset = ISC_LIST_HEAD(client->query.origqname->list);
 
2813
                if (rdataset != NULL) {
 
2814
                        dns_rdatatype_format(rdataset->type, typebuf,
 
2815
                                             sizeof(typebuf));
 
2816
                        dns_rdataclass_format(rdataset->rdclass, classbuf,
 
2817
                                              sizeof(classbuf));
 
2818
                } else {
 
2819
                        strcpy(typebuf, "-");
 
2820
                        strcpy(classbuf, "-");
 
2821
                }
 
2822
                fprintf(f, "; client %s%s%s: id %u '%s/%s/%s'%s%s "
 
2823
                        "requesttime %d\n", peerbuf, sep, name,
 
2824
                        client->message->id, namebuf, typebuf, classbuf,
 
2825
                        origfor, original, client->requesttime);
2788
2826
                client = ISC_LIST_NEXT(client, link);
2789
2827
        }
2790
2828
        UNLOCK(&manager->lock);