utils: Add a is_users_domain() function

This function checks if a given domain belongs to the user in question
identified as user_session.uid

This function returns true or false.

Signed-off-by: Andrew Clayton <andrew@dnsandmx.com>
url_handlers: Convert delete_mail_domain to is_users_domain

Use the is_users_domain() function to check the domain belongs to the
user.

This required moving the mysql result freeing around and we also fix a
potential memory leak of the db_row variable when we might have jumped
out of the function before freeing it.

Signed-off-by: Andrew Clayton <andrew@dnsandmx.com>
url_handlers: Convert delete_mail_fwd_record to is_users_domain

Signed-off-by: Andrew Clayton <andrew@dnsandmx.com>
url_handlers: Convert issue_etrn to is_users_domain

Signed-off-by: Andrew Clayton <andrew@dnsandmx.com>
url_handlers: Convert delete_dns_domain to is_users_domain

This required moving the mysql result freeing around and we also fix a
potential memory leak of the db_row variable when we might have jumped
out of the function before freeing it.

Signed-off-by: Andrew Clayton <andrew@dnsandmx.com>
url_handlers: Convert delete_dns_record to is_users_domain

Signed-off-by: Andrew Clayton <andrew@dnsandmx.com>
url_handlers: Convert renew to is_users_domain

Signed-off-by: Andrew Clayton <andrew@dnsandmx.com>
url_handlers: Simplify records()

There were three branches in the if () statement, two for entry_soa()
and one for get_records(). Re-work it to just two branches if/else, one
for each.

Signed-off-by: Andrew Clayton <andrew@dnsandmx.com>
url_handlers: renew: Fix thinko with renewing expired domains

If a domain is renewed before its expiry date, its new expiry date is
one year after its current expiry date.

If a domain has already expired, then we were still renewing it from its
expired date, probably not what you'd expect. So in this case renew it
from the current date.

Signed-off-by: Andrew Clayton <andrew@dnsandmx.com>