~ubuntu-branches/ubuntu/maverick/bind9/maverick

« back to all changes in this revision

Viewing changes to lib/dns/rdata/in_1/wks_11.c

  • Committer: Bazaar Package Importer
  • Author(s): LaMont Jones
  • Date: 2005-04-19 10:21:58 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20050419102158-kp20cp1bqf4ivpzy
Tags: 1:9.3.1-2ubuntu1
resync with debian

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
 * Copyright (C) 2004  Internet Systems Consortium, Inc. ("ISC")
3
 
 * Copyright (C) 1999-2001  Internet Software Consortium.
 
3
 * Copyright (C) 1999-2002  Internet Software Consortium.
4
4
 *
5
5
 * Permission to use, copy, modify, and distribute this software for any
6
6
 * purpose with or without fee is hereby granted, provided that the above
15
15
 * PERFORMANCE OF THIS SOFTWARE.
16
16
 */
17
17
 
18
 
/* $Id: wks_11.c,v 1.44.2.1 2004/03/09 06:11:39 marka Exp $ */
 
18
/* $Id: wks_11.c,v 1.44.12.8 2004/09/16 01:00:58 marka Exp $ */
19
19
 
20
20
/* Reviewed: Fri Mar 17 15:01:49 PST 2000 by explorer */
21
21
 
52
52
 
53
53
        UNUSED(type);
54
54
        UNUSED(origin);
55
 
        UNUSED(downcase);
 
55
        UNUSED(options);
56
56
        UNUSED(rdclass);
57
57
 
58
58
        /*
62
62
                                      ISC_FALSE));
63
63
 
64
64
        isc_buffer_availableregion(target, &region);
65
 
        if (getquad(token.value.as_pointer, &addr, lexer, callbacks) != 1)
 
65
        if (getquad(DNS_AS_STR(token), &addr, lexer, callbacks) != 1)
66
66
                RETTOK(DNS_R_BADDOTTEDQUAD);
67
67
        if (region.length < 4)
68
68
                return (ISC_R_NOSPACE);
75
75
        RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string,
76
76
                                      ISC_FALSE));
77
77
 
78
 
        proto = strtol(token.value.as_pointer, &e, 10);
 
78
        proto = strtol(DNS_AS_STR(token), &e, 10);
79
79
        if (*e == 0)
80
80
                ;
81
 
        else if ((pe = getprotobyname(token.value.as_pointer)) != NULL)
 
81
        else if ((pe = getprotobyname(DNS_AS_STR(token))) != NULL)
82
82
                proto = pe->p_proto;
83
83
        else
84
84
                RETTOK(DNS_R_UNKNOWNPROTO);
92
92
 
93
93
        RETERR(uint8_tobuffer(proto, target));
94
94
 
95
 
        memset(bm, 0, sizeof bm);
 
95
        memset(bm, 0, sizeof(bm));
96
96
        do {
97
97
                RETERR(isc_lex_getmastertoken(lexer, &token,
98
98
                                              isc_tokentype_string, ISC_TRUE));
103
103
                 * Lowercase the service string as some getservbyname() are
104
104
                 * case sensitive and the database is usually in lowercase.
105
105
                 */
106
 
                strncpy(service, token.value.as_pointer, sizeof(service));
 
106
                strncpy(service, DNS_AS_STR(token), sizeof(service));
107
107
                service[sizeof(service)-1] = '\0';
108
108
                for (i = strlen(service) - 1; i >= 0; i--)
109
109
                        if (isupper(service[i]&0xff))
110
 
                                service[i] = tolower(service[i]);
 
110
                                service[i] = tolower(service[i]&0xff);
111
111
 
112
 
                port = strtol(token.value.as_pointer, &e, 10);
 
112
                port = strtol(DNS_AS_STR(token), &e, 10);
113
113
                if (*e == 0)
114
114
                        ;
115
115
                else if ((se = getservbyname(service, ps)) != NULL)
116
116
                        port = ntohs(se->s_port);
117
 
                else if ((se = getservbyname(token.value.as_pointer, ps))
 
117
                else if ((se = getservbyname(DNS_AS_STR(token), ps))
118
118
                          != NULL)
119
119
                        port = ntohs(se->s_port);
120
120
                else
139
139
totext_in_wks(ARGS_TOTEXT) {
140
140
        isc_region_t sr;
141
141
        unsigned short proto;
142
 
        char buf[sizeof "65535"];
 
142
        char buf[sizeof("65535")];
143
143
        unsigned int i, j;
144
144
 
145
145
        UNUSED(tctx);
158
158
        RETERR(str_totext(buf, target));
159
159
        isc_region_consume(&sr, 1);
160
160
 
161
 
        for (i = 0 ; i < sr.length ; i++) {
 
161
        for (i = 0; i < sr.length; i++) {
162
162
                if (sr.base[i] != 0)
163
 
                        for (j = 0 ; j < 8 ; j++)
 
163
                        for (j = 0; j < 8; j++)
164
164
                                if ((sr.base[i] & (0x80 >> j)) != 0) {
165
165
                                        sprintf(buf, "%u", i * 8 + j);
166
166
                                        RETERR(str_totext(" ", target));
181
181
 
182
182
        UNUSED(type);
183
183
        UNUSED(dctx);
184
 
        UNUSED(downcase);
 
184
        UNUSED(options);
185
185
        UNUSED(rdclass);
186
186
 
187
187
        isc_buffer_activeregion(source, &sr);
229
229
 
230
230
        dns_rdata_toregion(rdata1, &r1);
231
231
        dns_rdata_toregion(rdata2, &r2);
232
 
        return (compare_region(&r1, &r2));
 
232
        return (isc_region_compare(&r1, &r2));
233
233
}
234
234
 
235
235
static inline isc_result_t
321
321
        return ((digest)(arg, &r));
322
322
}
323
323
 
 
324
static inline isc_boolean_t
 
325
checkowner_in_wks(ARGS_CHECKOWNER) {
 
326
 
 
327
        REQUIRE(type == 11);
 
328
        REQUIRE(rdclass == 1);
 
329
 
 
330
        UNUSED(type);
 
331
        UNUSED(rdclass);
 
332
 
 
333
        return (dns_name_ishostname(name, wildcard));
 
334
}
 
335
 
 
336
static inline isc_boolean_t
 
337
checknames_in_wks(ARGS_CHECKNAMES) {
 
338
 
 
339
        REQUIRE(rdata->type == 11);
 
340
        REQUIRE(rdata->rdclass == 1);
 
341
 
 
342
        UNUSED(rdata);
 
343
        UNUSED(owner);
 
344
        UNUSED(bad);
 
345
 
 
346
        return (ISC_TRUE);
 
347
}
 
348
 
324
349
#endif  /* RDATA_IN_1_WKS_11_C */