allow 0 as valid value
This commit is contained in:
		
							parent
							
								
									059b605121
								
							
						
					
					
						commit
						b0e8f1f55b
					
				| @ -14,25 +14,29 @@ | |||||||
| // Minimum TTL        Unsigned 32-bit integer
 | // Minimum TTL        Unsigned 32-bit integer
 | ||||||
| 
 | 
 | ||||||
| exports.DNS_PACKER_TYPE_SOA = function (ab, dv, total, record) { | exports.DNS_PACKER_TYPE_SOA = function (ab, dv, total, record) { | ||||||
|   if(!record.primary && !record.name_server){ |   function notNumber(n) { | ||||||
|  |     return 'number' === typeof n && !isNaN(n); | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   if (!record.primary && !record.name_server) { | ||||||
|     throw new Error("no name server for SOA record"); |     throw new Error("no name server for SOA record"); | ||||||
|   } |   } | ||||||
|   if(!record.admin && !record.email_addr){ |   if (!record.admin && !record.email_addr) { | ||||||
|     throw new Error("ne email address for SOA record"); |     throw new Error("ne email address for SOA record"); | ||||||
|   } |   } | ||||||
|   if(!record.serial && !record.sn){ |   if (notNumber(record.serial) && notNumber(record.sn)) { | ||||||
|     throw new Error("no serial number for SOA record"); |     throw new Error("no serial number for SOA record"); | ||||||
|   } |   } | ||||||
|   if(!record.refresh && !record.ref){ |   if (notNumber(record.refresh) && notNumber(record.ref)) { | ||||||
|     throw new Error("no refresh for SOA record"); |     throw new Error("no refresh for SOA record"); | ||||||
|   } |   } | ||||||
|   if(!record.retry && !record.ret){ |   if (notNumber(record.retry) && notNumber(record.ret)) { | ||||||
|     throw new Error("no update retry for SOA record"); |     throw new Error("no update retry for SOA record"); | ||||||
|   } |   } | ||||||
|   if(!record.expiration && !record.ex){ |   if (notNumber(record.expiration) && notNumber(record.ex)) { | ||||||
|     throw new Error("no expiry for SOA record"); |     throw new Error("no expiry for SOA record"); | ||||||
|   } |   } | ||||||
|   if(!record.minimum && !record.nx){ |   if (notNumber(record.minimum) && notNumber(record.nx)) { | ||||||
|     throw new Error("no nxdomain for SOA record"); |     throw new Error("no nxdomain for SOA record"); | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user