43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
# File 'ext/spf2/spf2.c', line 43
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;
}
|