17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
# File 'ext/spf2/spf2.c', line 17
static VALUE spf2_query(VALUE self, VALUE ipfrom, VALUE domain)
{
SPF_server_t *spf_server = NULL;
SPF_response_t *spf_response = NULL;
SPF_request_t *spf_request = NULL;
VALUE ret, str_result, str_reason, str_error;
Data_Get_Struct(self, SPF_server_t, spf_server);
spf_request = SPF_request_new(spf_server);
SPF_request_set_ipv4_str(spf_request, StringValueCStr(ipfrom));
SPF_request_set_env_from(spf_request, StringValueCStr(domain));
SPF_request_query_mailfrom(spf_request, &spf_response);
str_result =
rb_str_new2(SPF_strresult(SPF_response_result(spf_response)));
str_reason =
rb_str_new2(SPF_strreason(SPF_response_reason(spf_response)));
str_error =
rb_str_new2(SPF_strerror(SPF_response_errcode(spf_response)));
ret = rb_ary_new2(4);
rb_ary_push(ret, str_result);
rb_ary_push(ret, str_reason);
rb_ary_push(ret, str_error);
SPF_response_free(spf_response);
SPF_request_free(spf_request);
return ret;
}
|