~ubuntu-branches/ubuntu/hoary/courier/hoary

« back to all changes in this revision

Viewing changes to rfc1035/testlookup.c

  • Committer: Bazaar Package Importer
  • Author(s): Thom May
  • Date: 2004-11-29 12:09:34 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20041129120934-kkn0xj11j0n1n6lo
Tags: 0.47-3ubuntu1
* Nathaniel McCallum
 - debian/*.init: pretty initscripts
 - debian/control: version depends on lsb-base

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
 
6
6
#include        "config.h"
7
7
#include        "rfc1035.h"
 
8
#include        "spf.h"
8
9
#include        <sys/types.h>
9
10
#include        <stdio.h>
10
11
#include        <stdlib.h>
15
16
#include        "soxwrap/soxwrap.h"
16
17
#include        "rfc1035_res.h"
17
18
 
18
 
static const char rcsid[]="$Id: testlookup.c,v 1.9 2000/05/28 18:17:25 mrsam Exp $";
 
19
static const char rcsid[]="$Id: testlookup.c,v 1.11 2004/08/15 16:41:02 mrsam Exp $";
19
20
 
20
21
static void setns(const char *p)
21
22
{
36
37
        rfc1035_init_ns(&rfc1035_default_resolver, ia, i);
37
38
}
38
39
 
 
40
extern char rfc1035_spf_gettxt(const char *current_domain,
 
41
                               char *buf);
 
42
 
 
43
static void spflookup(const char *current_domain)
 
44
{
 
45
        char buf[256];
 
46
 
 
47
        switch (rfc1035_spf_gettxt(current_domain, buf)) {
 
48
        case SPF_NONE:
 
49
                printf("none\n");
 
50
                return;
 
51
        case SPF_NEUTRAL:
 
52
                printf("neutral\n");
 
53
                return;
 
54
        case SPF_PASS:
 
55
                printf("pass: %s\n", buf);
 
56
                return;
 
57
        case SPF_FAIL:
 
58
                printf("fail\n");
 
59
                return;
 
60
        case SPF_SOFTFAIL:
 
61
                printf("softfail\n");
 
62
                return;
 
63
        case SPF_ERROR:
 
64
                printf("error\n");
 
65
                return;
 
66
        default:
 
67
                printf("unknown\n");
 
68
        }
 
69
}
 
70
 
39
71
int main(int argc, char **argv)
40
72
{
41
73
struct  rfc1035_reply *replyp;
100
132
                                                        & 0x0F));
101
133
                                strcat(ptrbuf, buf);
102
134
                        }
103
 
                        strcat(ptrbuf, "ip6.int");
 
135
                        strcat(ptrbuf, "ip6.arpa");
104
136
                        q_name=ptrbuf;
105
137
                }
106
138
                else
172
204
        q_type= -1;
173
205
 
174
206
        if (argn < argc)
175
 
                q_type=rfc1035_type_strtoi(argv[argn++]);
 
207
        {
 
208
                if (strcmp(argv[argn], "spf") == 0)
 
209
                        q_type= -2;
 
210
                else
 
211
                        q_type=rfc1035_type_strtoi(argv[argn++]);
 
212
        }
176
213
 
177
 
        if (q_type < 0)
 
214
        if (q_type == -1)
178
215
                q_type=q_xflag ? RFC1035_TYPE_PTR:RFC1035_TYPE_ANY;
179
216
 
180
217
        q_class= -1;
183
220
        if (q_class < 0)
184
221
                q_class=RFC1035_CLASS_IN;
185
222
 
 
223
        if (q_type == -2)
 
224
        {
 
225
                spflookup(q_name);
 
226
                exit(0);
 
227
        }
 
228
 
186
229
        replyp=rfc1035_resolve(&rfc1035_default_resolver,
187
230
                RFC1035_OPCODE_QUERY, 1, q_name, q_type, q_class);
188
231