NobGit
public nobgit read

NobMail

Based on mailcow: dockerized

Languages

Repository composition by tracked source files.

PHP
PHP 49% JavaScript 35% HTML 9% CSS 4% Shell 2% Python 1% Lua 0% Perl 0% Ruby 0% SCSS 0%
Create file Wiki Documentation
Clone
https://nobgit.com/orgs/nobgit/nobmail.git
ssh://[email protected]:2222/orgs/nobgit/nobmail.git

Trace

data/web/inc/spf.inc.php

Trace helps you understand code history line by line. See who changed each line, when it changed, and which commit introduced it.

spf.inc.php on main
Author Date Commit Line Code
Michael Kuron over 9 years ago df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
1
<?php
Open commit View diff
1 <?php
andryyy about 9 years ago 74359f6

Use Redis for forwarded_hosts, some fixes

Full commit hash
74359f6df4f2200ed11223ba911e6683cd963b0d
Author
andryyy <[email protected]>
Date
about 9 years ago
Selected line
2
error_reporting(0);
Open commit View diff
2 error_reporting(0);
andryyy over 5 years ago 06c89ba

[Web] Implement XMPP

Full commit hash
06c89bac7deec007fbc5703bb8973f4da2176846
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
3
function get_spf_allowed_hosts($check_domain, $expand_ipv6 = false) {
Open commit View diff
3 function get_spf_allowed_hosts($check_domain, $expand_ipv6 = false) {
Michael Kuron over 9 years ago df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
4
	$hosts = array();
Open commit View diff
4 $hosts = array();
same change df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
5
	
Open commit View diff
5
andryyy almost 7 years ago 692614f

[Web] Fix loop in SPF lookup

Full commit hash
692614f79eee958d933f0f89e6d0e52b79a41ea2
Author
andryyy <[email protected]>
Date
almost 7 years ago
Selected line
6
	$records = dns_get_record($check_domain, DNS_TXT);
Open commit View diff
6 $records = dns_get_record($check_domain, DNS_TXT);
Michael Kuron over 9 years ago df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
7
	foreach ($records as $record)
Open commit View diff
7 foreach ($records as $record)
same change df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
8
	{
Open commit View diff
8 {
same change df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
9
		$txt = explode(' ', $record['entries'][0]);
Open commit View diff
9 $txt = explode(' ', $record['entries'][0]);
same change df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
10
		if (array_shift($txt) != 'v=spf1') // only handle SPF records
Open commit View diff
10 if (array_shift($txt) != 'v=spf1') // only handle SPF records
same change df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
11
			continue;
Open commit View diff
11 continue;
same change df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
12
		
Open commit View diff
12
same change df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
13
		foreach ($txt as $mech)
Open commit View diff
13 foreach ($txt as $mech)
same change df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
14
		{
Open commit View diff
14 {
same change df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
15
			$qual = substr($mech, 0, 1);
Open commit View diff
15 $qual = substr($mech, 0, 1);
same change df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
16
			if ($qual == '-' || $qual == '~') // only handle pass or neutral records
Open commit View diff
16 if ($qual == '-' || $qual == '~') // only handle pass or neutral records
same change df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
17
				continue(2);
Open commit View diff
17 continue(2);
same change df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
18
			
Open commit View diff
18
same change df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
19
			if ($qual == '+' || $qual == '?')
Open commit View diff
19 if ($qual == '+' || $qual == '?')
same change df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
20
				$mech = substr($mech, 1); // remove the qualifier
Open commit View diff
20 $mech = substr($mech, 1); // remove the qualifier
same change df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
21
			
Open commit View diff
21
same change df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
22
			if (strpos($mech, '=') !== FALSE) // handle a modifier
Open commit View diff
22 if (strpos($mech, '=') !== FALSE) // handle a modifier
same change df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
23
			{
Open commit View diff
23 {
same change df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
24
				$mod = explode('=', $mech);
Open commit View diff
24 $mod = explode('=', $mech);
same change df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
25
				if ($mod[0] == 'redirect') // handle a redirect
Open commit View diff
25 if ($mod[0] == 'redirect') // handle a redirect
same change df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
26
				{
Open commit View diff
26 {
Sven Michels about 5 years ago b39ac8f

[Web] Fix: spf record validation failed with redirect

Full commit hash
b39ac8f649d95e8ca23e88ef216cd72a245dcc2b
Author
Sven Michels <[email protected]>
Date
about 5 years ago
Selected line
27
					$hosts = get_spf_allowed_hosts($mod[1],true);
Open commit View diff
27 $hosts = get_spf_allowed_hosts($mod[1],true);
Michael Kuron over 9 years ago df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
28
					return $hosts;
Open commit View diff
28 return $hosts;
same change df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
29
				}
Open commit View diff
29 }
same change df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
30
			}
Open commit View diff
30 }
same change df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
31
			else
Open commit View diff
31 else
same change df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
32
			{
Open commit View diff
32 {
same change df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
33
				unset($cidr);
Open commit View diff
33 unset($cidr);
andryyy about 6 years ago b6933fd

[Web] Improve SPF checks

Full commit hash
b6933fdb964f230cfdd6937d6d51aeb9ec2f7cc0
Author
andryyy <[email protected]>
Date
about 6 years ago
Selected line
34
				// reset domain to check_domain
Open commit View diff
34 // reset domain to check_domain
same change b6933fd

[Web] Improve SPF checks

Full commit hash
b6933fdb964f230cfdd6937d6d51aeb9ec2f7cc0
Author
andryyy <[email protected]>
Date
about 6 years ago
Selected line
35
				$domain = $check_domain;
Open commit View diff
35 $domain = $check_domain;
Michael Kuron over 9 years ago df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
36
				if (strpos($mech, ':') !== FALSE) // handle a domain specification
Open commit View diff
36 if (strpos($mech, ':') !== FALSE) // handle a domain specification
same change df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
37
				{
Open commit View diff
37 {
same change df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
38
					$split = explode(':', $mech);
Open commit View diff
38 $split = explode(':', $mech);
same change df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
39
					$mech = array_shift($split);
Open commit View diff
39 $mech = array_shift($split);
same change df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
40
					$domain = implode(':', $split);
Open commit View diff
40 $domain = implode(':', $split);
same change df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
41
					if (strpos($domain, '/') !== FALSE) // remove CIDR specification
Open commit View diff
41 if (strpos($domain, '/') !== FALSE) // remove CIDR specification
same change df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
42
					{
Open commit View diff
42 {
same change df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
43
						$split = explode('/', $domain);
Open commit View diff
43 $split = explode('/', $domain);
same change df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
44
						$domain = $split[0];
Open commit View diff
44 $domain = $split[0];
same change df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
45
						$cidr = $split[1];
Open commit View diff
45 $cidr = $split[1];
same change df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
46
					}
Open commit View diff
46 }
same change df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
47
				}
Open commit View diff
47 }
same change df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
48
				
Open commit View diff
48
same change df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
49
				$new_hosts = array();
Open commit View diff
49 $new_hosts = array();
andryyy almost 7 years ago 692614f

[Web] Fix loop in SPF lookup

Full commit hash
692614f79eee958d933f0f89e6d0e52b79a41ea2
Author
andryyy <[email protected]>
Date
almost 7 years ago
Selected line
50
        if ($mech == 'include' && $check_domain != $domain) // handle an inclusion
Open commit View diff
50 if ($mech == 'include' && $check_domain != $domain) // handle an inclusion
Michael Kuron over 9 years ago df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
51
				{
Open commit View diff
51 {
same change df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
52
					$new_hosts = get_spf_allowed_hosts($domain);
Open commit View diff
52 $new_hosts = get_spf_allowed_hosts($domain);
same change df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
53
				}
Open commit View diff
53 }
same change df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
54
				elseif ($mech == 'a') // handle a mechanism
Open commit View diff
54 elseif ($mech == 'a') // handle a mechanism
same change df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
55
				{
Open commit View diff
55 {
same change df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
56
					$new_hosts = get_a_hosts($domain);
Open commit View diff
56 $new_hosts = get_a_hosts($domain);
same change df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
57
				}
Open commit View diff
57 }
same change df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
58
				elseif ($mech == 'mx') // handle mx mechanism
Open commit View diff
58 elseif ($mech == 'mx') // handle mx mechanism
same change df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
59
				{
Open commit View diff
59 {
same change df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
60
					$new_hosts = get_mx_hosts($domain);
Open commit View diff
60 $new_hosts = get_mx_hosts($domain);
same change df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
61
				}
Open commit View diff
61 }
same change df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
62
				elseif ($mech == 'ip4' || $mech == 'ip6') // handle ip mechanism
Open commit View diff
62 elseif ($mech == 'ip4' || $mech == 'ip6') // handle ip mechanism
same change df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
63
				{
Open commit View diff
63 {
same change df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
64
					$new_hosts = array($domain);
Open commit View diff
64 $new_hosts = array($domain);
same change df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
65
				}
Open commit View diff
65 }
same change df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
66
				
Open commit View diff
66
same change df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
67
				if (isset($cidr)) // add CIDR specification if present
Open commit View diff
67 if (isset($cidr)) // add CIDR specification if present
same change df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
68
				{
Open commit View diff
68 {
same change df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
69
					foreach ($new_hosts as &$host)
Open commit View diff
69 foreach ($new_hosts as &$host)
same change df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
70
					{
Open commit View diff
70 {
same change df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
71
						$host .= '/' . $cidr;
Open commit View diff
71 $host .= '/' . $cidr;
same change df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
72
					}
Open commit View diff
72 }
same change df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
73
					unset($host);
Open commit View diff
73 unset($host);
same change df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
74
				}
Open commit View diff
74 }
same change df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
75
				
Open commit View diff
75
same change df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
76
				$hosts = array_unique(array_merge($hosts,$new_hosts), SORT_REGULAR);
Open commit View diff
76 $hosts = array_unique(array_merge($hosts,$new_hosts), SORT_REGULAR);
same change df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
77
			}
Open commit View diff
77 }
same change df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
78
		}
Open commit View diff
78 }
same change df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
79
	}
Open commit View diff
79 }
andryyy about 6 years ago b6933fd

[Web] Improve SPF checks

Full commit hash
b6933fdb964f230cfdd6937d6d51aeb9ec2f7cc0
Author
andryyy <[email protected]>
Date
about 6 years ago
Selected line
80
	foreach ($hosts as &$host) {
Open commit View diff
80 foreach ($hosts as &$host) {
same change b6933fd

[Web] Improve SPF checks

Full commit hash
b6933fdb964f230cfdd6937d6d51aeb9ec2f7cc0
Author
andryyy <[email protected]>
Date
about 6 years ago
Selected line
81
		if (filter_var($host, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) {
Open commit View diff
81 if (filter_var($host, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) {
Sven Michels about 5 years ago b39ac8f

[Web] Fix: spf record validation failed with redirect

Full commit hash
b39ac8f649d95e8ca23e88ef216cd72a245dcc2b
Author
Sven Michels <[email protected]>
Date
about 5 years ago
Selected line
82
			if ($expand_ipv6 === true) {
Open commit View diff
82 if ($expand_ipv6 === true) {
same change b39ac8f

[Web] Fix: spf record validation failed with redirect

Full commit hash
b39ac8f649d95e8ca23e88ef216cd72a245dcc2b
Author
Sven Michels <[email protected]>
Date
about 5 years ago
Selected line
83
				$hex = unpack("H*hex", inet_pton($host));
Open commit View diff
83 $hex = unpack("H*hex", inet_pton($host));
same change b39ac8f

[Web] Fix: spf record validation failed with redirect

Full commit hash
b39ac8f649d95e8ca23e88ef216cd72a245dcc2b
Author
Sven Michels <[email protected]>
Date
about 5 years ago
Selected line
84
				$host = substr(preg_replace("/([A-f0-9]{4})/", "$1:", $hex['hex']), 0, -1);
Open commit View diff
84 $host = substr(preg_replace("/([A-f0-9]{4})/", "$1:", $hex['hex']), 0, -1);
same change b39ac8f

[Web] Fix: spf record validation failed with redirect

Full commit hash
b39ac8f649d95e8ca23e88ef216cd72a245dcc2b
Author
Sven Michels <[email protected]>
Date
about 5 years ago
Selected line
85
			}
Open commit View diff
85 }
same change b39ac8f

[Web] Fix: spf record validation failed with redirect

Full commit hash
b39ac8f649d95e8ca23e88ef216cd72a245dcc2b
Author
Sven Michels <[email protected]>
Date
about 5 years ago
Selected line
86
			else {
Open commit View diff
86 else {
same change b39ac8f

[Web] Fix: spf record validation failed with redirect

Full commit hash
b39ac8f649d95e8ca23e88ef216cd72a245dcc2b
Author
Sven Michels <[email protected]>
Date
about 5 years ago
Selected line
87
				$host = $host;
Open commit View diff
87 $host = $host;
same change b39ac8f

[Web] Fix: spf record validation failed with redirect

Full commit hash
b39ac8f649d95e8ca23e88ef216cd72a245dcc2b
Author
Sven Michels <[email protected]>
Date
about 5 years ago
Selected line
88
			}
Open commit View diff
88 }
andryyy about 6 years ago b6933fd

[Web] Improve SPF checks

Full commit hash
b6933fdb964f230cfdd6937d6d51aeb9ec2f7cc0
Author
andryyy <[email protected]>
Date
about 6 years ago
Selected line
89
		}
Open commit View diff
89 }
same change b6933fd

[Web] Improve SPF checks

Full commit hash
b6933fdb964f230cfdd6937d6d51aeb9ec2f7cc0
Author
andryyy <[email protected]>
Date
about 6 years ago
Selected line
90
	}
Open commit View diff
90 }
Michael Kuron over 9 years ago df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
91
	return $hosts;
Open commit View diff
91 return $hosts;
same change df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
92
}
Open commit View diff
92 }
same change df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
93
Open commit View diff
93
andryyy about 9 years ago f77c40a

Better log table, some MySQL to Redis migrations, API changes, other minor changes...

Full commit hash
f77c40a179bb89b463318c6dafe4823a5844a43f
Author
andryyy <[email protected]>
Date
about 9 years ago
Selected line
94
Open commit View diff
94
Michael Kuron over 9 years ago df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
95
function get_mx_hosts($domain)
Open commit View diff
95 function get_mx_hosts($domain)
same change df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
96
{
Open commit View diff
96 {
same change df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
97
	$hosts = array();
Open commit View diff
97 $hosts = array();
andryyy about 9 years ago f77c40a

Better log table, some MySQL to Redis migrations, API changes, other minor changes...

Full commit hash
f77c40a179bb89b463318c6dafe4823a5844a43f
Author
andryyy <[email protected]>
Date
about 9 years ago
Selected line
98
  try {
Open commit View diff
98 try {
same change f77c40a

Better log table, some MySQL to Redis migrations, API changes, other minor changes...

Full commit hash
f77c40a179bb89b463318c6dafe4823a5844a43f
Author
andryyy <[email protected]>
Date
about 9 years ago
Selected line
99
    $mx_records = dns_get_record($domain, DNS_MX);
Open commit View diff
99 $mx_records = dns_get_record($domain, DNS_MX);
andryyy about 9 years ago 74359f6

Use Redis for forwarded_hosts, some fixes

Full commit hash
74359f6df4f2200ed11223ba911e6683cd963b0d
Author
andryyy <[email protected]>
Date
about 9 years ago
Selected line
100
    if ($mx_records) {
Open commit View diff
100 if ($mx_records) {
same change 74359f6

Use Redis for forwarded_hosts, some fixes

Full commit hash
74359f6df4f2200ed11223ba911e6683cd963b0d
Author
andryyy <[email protected]>
Date
about 9 years ago
Selected line
101
      foreach ($mx_records as $mx_record) {
Open commit View diff
101 foreach ($mx_records as $mx_record) {
same change 74359f6

Use Redis for forwarded_hosts, some fixes

Full commit hash
74359f6df4f2200ed11223ba911e6683cd963b0d
Author
andryyy <[email protected]>
Date
about 9 years ago
Selected line
102
        $new_hosts = get_a_hosts($mx_record['target']);
Open commit View diff
102 $new_hosts = get_a_hosts($mx_record['target']);
same change 74359f6

Use Redis for forwarded_hosts, some fixes

Full commit hash
74359f6df4f2200ed11223ba911e6683cd963b0d
Author
andryyy <[email protected]>
Date
about 9 years ago
Selected line
103
        $hosts = array_unique(array_merge($hosts,$new_hosts), SORT_REGULAR);
Open commit View diff
103 $hosts = array_unique(array_merge($hosts,$new_hosts), SORT_REGULAR);
same change 74359f6

Use Redis for forwarded_hosts, some fixes

Full commit hash
74359f6df4f2200ed11223ba911e6683cd963b0d
Author
andryyy <[email protected]>
Date
about 9 years ago
Selected line
104
      }
Open commit View diff
104 }
andryyy about 9 years ago f77c40a

Better log table, some MySQL to Redis migrations, API changes, other minor changes...

Full commit hash
f77c40a179bb89b463318c6dafe4823a5844a43f
Author
andryyy <[email protected]>
Date
about 9 years ago
Selected line
105
    }
Open commit View diff
105 }
same change f77c40a

Better log table, some MySQL to Redis migrations, API changes, other minor changes...

Full commit hash
f77c40a179bb89b463318c6dafe4823a5844a43f
Author
andryyy <[email protected]>
Date
about 9 years ago
Selected line
106
  }
Open commit View diff
106 }
same change f77c40a

Better log table, some MySQL to Redis migrations, API changes, other minor changes...

Full commit hash
f77c40a179bb89b463318c6dafe4823a5844a43f
Author
andryyy <[email protected]>
Date
about 9 years ago
Selected line
107
  catch (Exception $e) {
Open commit View diff
107 catch (Exception $e) {
same change f77c40a

Better log table, some MySQL to Redis migrations, API changes, other minor changes...

Full commit hash
f77c40a179bb89b463318c6dafe4823a5844a43f
Author
andryyy <[email protected]>
Date
about 9 years ago
Selected line
108
    if ($e->getMessage() !== 'dns_get_record(): A temporary server error occurred.') {
Open commit View diff
108 if ($e->getMessage() !== 'dns_get_record(): A temporary server error occurred.') {
same change f77c40a

Better log table, some MySQL to Redis migrations, API changes, other minor changes...

Full commit hash
f77c40a179bb89b463318c6dafe4823a5844a43f
Author
andryyy <[email protected]>
Date
about 9 years ago
Selected line
109
      throw $e;
Open commit View diff
109 throw $e;
same change f77c40a

Better log table, some MySQL to Redis migrations, API changes, other minor changes...

Full commit hash
f77c40a179bb89b463318c6dafe4823a5844a43f
Author
andryyy <[email protected]>
Date
about 9 years ago
Selected line
110
    }
Open commit View diff
110 }
same change f77c40a

Better log table, some MySQL to Redis migrations, API changes, other minor changes...

Full commit hash
f77c40a179bb89b463318c6dafe4823a5844a43f
Author
andryyy <[email protected]>
Date
about 9 years ago
Selected line
111
    $mx_records = false;
Open commit View diff
111 $mx_records = false;
same change f77c40a

Better log table, some MySQL to Redis migrations, API changes, other minor changes...

Full commit hash
f77c40a179bb89b463318c6dafe4823a5844a43f
Author
andryyy <[email protected]>
Date
about 9 years ago
Selected line
112
  }
Open commit View diff
112 }
Michael Kuron over 9 years ago df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
113
	return $hosts;
Open commit View diff
113 return $hosts;
same change df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
114
}
Open commit View diff
114 }
same change df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
115
Open commit View diff
115
same change df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
116
function get_a_hosts($domain)
Open commit View diff
116 function get_a_hosts($domain)
same change df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
117
{
Open commit View diff
117 {
same change df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
118
	$hosts = array();
Open commit View diff
118 $hosts = array();
same change df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
119
	
Open commit View diff
119
same change df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
120
	$a_records = dns_get_record($domain, DNS_A);
Open commit View diff
120 $a_records = dns_get_record($domain, DNS_A);
same change df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
121
	foreach ($a_records as $a_record)
Open commit View diff
121 foreach ($a_records as $a_record)
same change df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
122
	{
Open commit View diff
122 {
same change df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
123
		$hosts[] = $a_record['ip'];
Open commit View diff
123 $hosts[] = $a_record['ip'];
same change df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
124
	}
Open commit View diff
124 }
same change df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
125
	$a_records = dns_get_record($domain, DNS_AAAA);
Open commit View diff
125 $a_records = dns_get_record($domain, DNS_AAAA);
andryyy over 5 years ago 06c89ba

[Web] Implement XMPP

Full commit hash
06c89bac7deec007fbc5703bb8973f4da2176846
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
126
	foreach ($a_records as $a_record) {
Open commit View diff
126 foreach ($a_records as $a_record) {
same change 06c89ba

[Web] Implement XMPP

Full commit hash
06c89bac7deec007fbc5703bb8973f4da2176846
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
127
    $hosts[] = $a_record['ipv6'];
Open commit View diff
127 $hosts[] = $a_record['ipv6'];
Michael Kuron over 9 years ago df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
128
	}
Open commit View diff
128 }
same change df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
129
	
Open commit View diff
129
same change df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
130
	return $hosts;
Open commit View diff
130 return $hosts;
same change df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
131
}
Open commit View diff
131 }
same change df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
132
Open commit View diff
132
same change df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
133
function get_outgoing_hosts_best_guess($domain)
Open commit View diff
133 function get_outgoing_hosts_best_guess($domain)
same change df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
134
{
Open commit View diff
134 {
same change df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
135
	// try the SPF record to get hosts that are allowed to send outgoing mails for this domain
Open commit View diff
135 // try the SPF record to get hosts that are allowed to send outgoing mails for this domain
same change df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
136
	$hosts = get_spf_allowed_hosts($domain);
Open commit View diff
136 $hosts = get_spf_allowed_hosts($domain);
same change df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
137
	if ($hosts) return $hosts;
Open commit View diff
137 if ($hosts) return $hosts;
same change df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
138
	
Open commit View diff
138
same change df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
139
	// try the MX record to get mail servers for this domain
Open commit View diff
139 // try the MX record to get mail servers for this domain
same change df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
140
	$hosts = get_mx_hosts($domain);
Open commit View diff
140 $hosts = get_mx_hosts($domain);
same change df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
141
	if ($hosts) return $hosts;
Open commit View diff
141 if ($hosts) return $hosts;
same change df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
142
	
Open commit View diff
142
same change df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
143
	// fall back to the A record to get the host name for this domain
Open commit View diff
143 // fall back to the A record to get the host name for this domain
same change df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
144
	return get_a_hosts($domain);
Open commit View diff
144 return get_a_hosts($domain);
same change df71e97

Forwarding hosts: use SPF records if present

Full commit hash
df71e97a09fa9b90b4766875ee20f9ba2345bcc3
Author
Michael Kuron <[email protected]>
Date
over 9 years ago
Selected line
145
}
Open commit View diff
145 }
andryyy almost 7 years ago 692614f

[Web] Fix loop in SPF lookup

Full commit hash
692614f79eee958d933f0f89e6d0e52b79a41ea2
Author
andryyy <[email protected]>
Date
almost 7 years ago
Selected line
146
?>
Open commit View diff
146 ?>