[aur-dev] [PATCH] valid_email :: add dns check

Ike Devolder ike.devolder at gmail.com
Mon Mar 19 17:32:22 EDT 2012


Op maandag 19 maart 2012 22:30:55 schreef u:
> When an email address is of the correct format check if there is an mx
> record for the domain part. This forces people wanting to trash
> something in aur to use a domain part with an mx record.
> 
> This will not stop invalid email, it only adds an extra check and a
> possible help for typos.
> 
> Signed-off-by: BlackEagle <ike.devolder at gmail.com>
> ---
>  web/lib/aur.inc.php |   11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/web/lib/aur.inc.php b/web/lib/aur.inc.php
> index c662b80..48fb860 100644
> --- a/web/lib/aur.inc.php
> +++ b/web/lib/aur.inc.php
> @@ -80,7 +80,16 @@ function check_sid($dbh=NULL) {
>  # verify that an email address looks like it is legitimate
>  #
>  function valid_email($addy) {
> -	return (filter_var($addy, FILTER_VALIDATE_EMAIL) !== false);
> +	if (filter_var($addy, FILTER_VALIDATE_EMAIL) === false) {
> +		return false;
> +	}
> +
> +	$domain = substr($addy, strrpos($addy, '@') + 1);
> +	if (checkdnsrr($domain, 'MX') === false) {
> +		return false;
> +	}
> +
> +	return true;
>  }
> 
>  # a new seed value for mt_srand()
> --
> 1.7.9.4

modified patch, with only MX record check, removed the A record check since it 
was unnecessary.
--Ike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://mailman.archlinux.org/pipermail/aur-dev/attachments/20120319/79f643f2/attachment-0001.asc>


More information about the aur-dev mailing list