Index: /trunk/DNSDB.pm
===================================================================
--- /trunk/DNSDB.pm	(revision 530)
+++ /trunk/DNSDB.pm	(revision 531)
@@ -438,5 +438,5 @@
   # or the intended parent domain for live records.
   my $pname = ($args{defrec} eq 'y' ? 'DOMAIN' : $self->domainName($args{id}));
-  ${$args{host}} =~ s/\.*$/\.$pname/ if ${$args{host}} !~ /$pname$/;
+  ${$args{host}} =~ s/\.*$/\.$pname/ if (${$args{host}} ne '@' && ${$args{host}} !~ /$pname$/);
 
   # Check IP is well-formed, and that it's a v4 address
@@ -3675,5 +3675,5 @@
   return ('FAIL', "Hostnames may not contain anything other than (0-9 a-z . _)")
 	if $defrec eq 'n' && ($revrec eq 'y' ? $$rectype != $reverse_typemap{TXT} : 1) &&
-		$$host !~ /^[0-9a-z_%.-]+$/i;
+		$$host !~ /^(?:[0-9a-z_%.-]+|@)$/i;
 
   # Collect these even if we're only doing a simple A record so we can call *any* validation sub
@@ -3812,5 +3812,5 @@
   return ('FAIL', "Hostnames may not contain anything other than (0-9 a-z - . _)")
 	if $defrec eq 'n' && ($revrec eq 'y' ? $$rectype != $reverse_typemap{TXT} : 1) &&
-		$$host !~ /^[0-9a-z_%.-]+$/i;
+		$$host !~ /^(?:[0-9a-z_%.-]+|@)$/i;
 
   # only MX and SRV will use these
@@ -5093,4 +5093,10 @@
   my ($datafile,$revrec,$recflags,$zone,$host,$type,$val,$dist,$weight,$port,$ttl,$loc,$stamp) = @_;
 
+  if ($revrec eq 'y') {
+    $val = $zone if $val eq '@';
+  } else {
+    $host = $zone if $host eq '@';
+  }
+
   ## Convert a bare number into an octal-coded pair of octets.
   # Take optional arg to indicate a decimal or hex input.  Defaults to hex.
