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

« back to all changes in this revision

Viewing changes to lib/bind/resolv/res_query.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:
70
70
 
71
71
#if defined(LIBC_SCCS) && !defined(lint)
72
72
static const char sccsid[] = "@(#)res_query.c   8.1 (Berkeley) 6/4/93";
73
 
static const char rcsid[] = "$Id: res_query.c,v 1.2.2.3.4.2 2004/03/16 12:34:19 marka Exp $";
 
73
static const char rcsid[] = "$Id: res_query.c,v 1.8.672.2 2008/04/03 10:49:22 marka Exp $";
74
74
#endif /* LIBC_SCCS and not lint */
75
75
 
76
76
#include "port_before.h"
97
97
#define MAXPACKET       1024
98
98
#endif
99
99
 
100
 
/*
 
100
/*%
101
101
 * Formulate a normal query, send, and await answer.
102
102
 * Returned answer is placed in supplied buffer "answer".
103
103
 * Perform preliminary check of answer, returning success only
109
109
 */
110
110
int
111
111
res_nquery(res_state statp,
112
 
           const char *name,    /* domain name */
113
 
           int class, int type, /* class and type of query */
114
 
           u_char *answer,      /* buffer to put answer */
115
 
           int anslen)          /* size of answer buffer */
 
112
           const char *name,    /*%< domain name */
 
113
           int class, int type, /*%< class and type of query */
 
114
           u_char *answer,      /*%< buffer to put answer */
 
115
           int anslen)          /*%< size of answer buffer */
116
116
{
117
117
        u_char buf[MAXPACKET];
118
118
        HEADER *hp = (HEADER *) answer;
 
119
        u_int oflags;
 
120
        u_char *rdata;
119
121
        int n;
120
 
        u_int oflags;
121
122
 
122
123
        oflags = statp->_flags;
123
124
 
124
125
again:
125
 
        hp->rcode = NOERROR;    /* default */
126
 
 
 
126
        hp->rcode = NOERROR;    /*%< default */
127
127
#ifdef DEBUG
128
128
        if (statp->options & RES_DEBUG)
129
129
                printf(";; res_query(%s, %d, %d)\n", name, class, type);
133
133
                         buf, sizeof(buf));
134
134
#ifdef RES_USE_EDNS0
135
135
        if (n > 0 && (statp->_flags & RES_F_EDNS0ERR) == 0 &&
136
 
            (statp->options & (RES_USE_EDNS0|RES_USE_DNSSEC)) != 0U)
 
136
            (statp->options & (RES_USE_EDNS0|RES_USE_DNSSEC|RES_NSID))) {
137
137
                n = res_nopt(statp, n, buf, sizeof(buf), anslen);
 
138
                rdata = &buf[n];
 
139
                if (n > 0 && (statp->options & RES_NSID) != 0U) {
 
140
                        n = res_nopt_rdata(statp, n, buf, sizeof(buf), rdata,
 
141
                                           NS_OPT_NSID, 0, NULL);
 
142
                }
 
143
        }
138
144
#endif
139
145
        if (n <= 0) {
140
146
#ifdef DEBUG
144
150
                RES_SET_H_ERRNO(statp, NO_RECOVERY);
145
151
                return (n);
146
152
        }
 
153
 
147
154
        n = res_nsend(statp, buf, n, answer, anslen);
148
155
        if (n < 0) {
149
156
#ifdef RES_USE_EDNS0
195
202
        return (n);
196
203
}
197
204
 
198
 
/*
 
205
/*%
199
206
 * Formulate a normal query, send, and retrieve answer in supplied buffer.
200
207
 * Return the size of the response on success, -1 on error.
201
208
 * If enabled, implement search rules until answer or unrecoverable failure
203
210
 */
204
211
int
205
212
res_nsearch(res_state statp,
206
 
            const char *name,   /* domain name */
207
 
            int class, int type,        /* class and type of query */
208
 
            u_char *answer,     /* buffer to put answer */
209
 
            int anslen)         /* size of answer */
 
213
            const char *name,   /*%< domain name */
 
214
            int class, int type,        /*%< class and type of query */
 
215
            u_char *answer,     /*%< buffer to put answer */
 
216
            int anslen)         /*%< size of answer */
210
217
{
211
218
        const char *cp, * const *domain;
212
219
        HEADER *hp = (HEADER *) answer;
218
225
        int searched = 0;
219
226
 
220
227
        errno = 0;
221
 
        RES_SET_H_ERRNO(statp, HOST_NOT_FOUND);  /* True if we never query. */
222
 
 
 
228
        RES_SET_H_ERRNO(statp, HOST_NOT_FOUND);  /*%< True if we never query. */
223
229
        dots = 0;
224
230
        for (cp = name; *cp != '\0'; cp++)
225
231
                dots += (*cp == '.');
344
350
        return (-1);
345
351
}
346
352
 
347
 
/*
 
353
/*%
348
354
 * Perform a call on res_query on the concatenation of name and domain,
349
355
 * removing a trailing dot from name if domain is NULL.
350
356
 */
352
358
res_nquerydomain(res_state statp,
353
359
            const char *name,
354
360
            const char *domain,
355
 
            int class, int type,        /* class and type of query */
356
 
            u_char *answer,             /* buffer to put answer */
357
 
            int anslen)         /* size of answer */
 
361
            int class, int type,        /*%< class and type of query */
 
362
            u_char *answer,             /*%< buffer to put answer */
 
363
            int anslen)         /*%< size of answer */
358
364
{
359
365
        char nbuf[MAXDNAME];
360
366
        const char *longname = nbuf;
430
436
        fclose(fp);
431
437
        return (NULL);
432
438
}
 
439
 
 
440
/*! \file */