Index: trunk/DNSDB.pm
===================================================================
--- trunk/DNSDB.pm	(revision 985)
+++ trunk/DNSDB.pm	(revision 1002)
@@ -4816,4 +4816,15 @@
   return ($retcode,$retmsg) if $retcode eq 'FAIL';
 
+  # Minor cleanup of invalid DNS labels
+##fixme: seems like map should be used here to be decently Perlish, but any time I stick
+# a s/// inside the block map only returns the match/replace count instead of whatever
+# the changed $_ is for some reason
+  my @hbits = split '.', $host;
+  foreach (@hbits) {
+    s/^-+//;
+    s/-+$//;
+  }
+  $host = join '.', @hbits;
+
   # Set up database fields and bind parameters
   $fields .= "host,type,val,ttl,"._recparent($defrec,$revrec);
@@ -4982,4 +4993,15 @@
 
   return ($retcode,$retmsg) if $retcode eq 'FAIL';
+
+  # Minor cleanup of invalid DNS labels
+##fixme: seems like map should be used here to be decently Perlish, but any time I stick
+# a s/// inside the block map only returns the match/replace count instead of whatever
+# the changed $_ is for some reason
+  my @hbits = split '.', $host;
+  foreach (@hbits) {
+    s/^-+//;
+    s/-+$//;
+  }
+  $host = join '.', @hbits;
 
   # Set up database fields and bind parameters.  Note only the optional fields
