Line 0
Link Here
|
|
|
1 |
--- src/spf_example/spf_example.c.orig Mon Mar 28 14:17:20 2005 |
2 |
+++ src/spf_example/spf_example.c Mon Mar 28 14:22:46 2005 |
3 |
@@ -90,17 +90,17 @@ |
4 |
"\n" |
5 |
"Valid data options are:\n" |
6 |
" -i <IP address> The IP address that is sending email\n" |
7 |
- " -s <email address> The email address used as the\n" |
8 |
- " envelope-from. If no username (local\n" |
9 |
- " part) is given, 'postmaster' will be\n" |
10 |
- " assumed.\n" |
11 |
- " -r <email address> [optional] The email address used as\n" |
12 |
- " the envelope-to email address, for\n" |
13 |
- " secondary-MX checking.\n" |
14 |
- " -h <domain name> The domain name given on the SMTP HELO\n" |
15 |
- " command. This is only needed if the\n" |
16 |
- " -sender option is not given.\n" |
17 |
- " -d [debug level] debug level.\n" |
18 |
+ " -s <email address> The email address used as the\n" |
19 |
+ " envelope-from. If no username (local\n" |
20 |
+ " part) is given, 'postmaster' will be\n" |
21 |
+ " assumed.\n" |
22 |
+ " -r <email address> [optional] The email address used as\n" |
23 |
+ " the envelope-to email address, for\n" |
24 |
+ " secondary-MX checking.\n" |
25 |
+ " -h <domain name> The domain name given on the SMTP HELO\n" |
26 |
+ " command. This is only needed if the\n" |
27 |
+ " -sender option is not given.\n" |
28 |
+ " -d [debug level] debug level.\n" |
29 |
); |
30 |
} |
31 |
|
32 |
@@ -206,7 +206,7 @@ |
33 |
* destroyed when you are finished. |
34 |
*/ |
35 |
|
36 |
- spf_server = SPF_server_new(SPF_DNS_CACHE, 1); |
37 |
+ spf_server = SPF_server_new(SPF_DNS_CACHE, opt_debug); |
38 |
|
39 |
if (spf_server == NULL) { |
40 |
fprintf( stderr, "SPF_create_config failed.\n" ); |
41 |
@@ -264,10 +264,24 @@ |
42 |
* message. |
43 |
*/ |
44 |
|
45 |
- if ( SPF_request_set_helo_dom( spf_request, opt_helo ) ) { |
46 |
- printf( "Invalid HELO domain.\n" ); |
47 |
- res = 255; |
48 |
- goto error; |
49 |
+ if (opt_helo == NULL) { |
50 |
+ if (opt_sender != NULL) { |
51 |
+ if (strstr(opt_sender, "@") != NULL) { |
52 |
+ opt_helo = strdup(strstr(opt_sender, "@") + 1); |
53 |
+ |
54 |
+ if ( SPF_request_set_helo_dom( spf_request, opt_helo ) ) { |
55 |
+ printf( "Invalid HELO domain.\n" ); |
56 |
+ res = 255; |
57 |
+ goto error; |
58 |
+ } |
59 |
+ } |
60 |
+ } |
61 |
+ } else { |
62 |
+ if ( SPF_request_set_helo_dom( spf_request, opt_helo ) ) { |
63 |
+ printf( "Invalid HELO domain.\n" ); |
64 |
+ res = 255; |
65 |
+ goto error; |
66 |
+ } |
67 |
} |
68 |
|
69 |
/* |