]> mj.ucw.cz Git - nsc-5.git/blobdiff - m4/dnslib.m4
Relative names with dots are now allowed if the dots are escaped
[nsc-5.git] / m4 / dnslib.m4
index 5499baa232d61a8c242034bac75bcf38e8199957..5997262bc58f1b2eb6c3e051a3adfdf5c4dbf298 100644 (file)
@@ -1,12 +1,12 @@
 dnl ###
 dnl ### NSC -- Library Functions For DNS Processing
-dnl ### (c) 1997--2011 Martin Mares <mj@ucw.cz>
+dnl ### (c) 1997--2019 Martin Mares <mj@ucw.cz>
 dnl ###
 divert(-1)
 
 # NSC version
 
-define(`NSCVER', `NSC 3.1')
+define(`NSCVER', `NSC 5.0')
 
 # Current date and time
 
@@ -28,10 +28,11 @@ define(nsc_file_name, `translit($1,/,@)')
 define(nsc_revIPa, `ifelse($#, 1, `$1', `nsc_revIPa(shift($@)).$1')')
 define(nsc_revaddr, `nsc_revIPa(translit($1, `.', `,'))')
 
-# Fix up dots in a name: if the name is not simple (i.e., it contains at least one dot),
-# ensure that it ends with a dot.
+# Fix up dots in a name: If the name is not simple (i.e., it contains at least one unescaped
+# dot), ensure that it ends with a dot. Then unescape all escaped dots (\.).
 
-define(nsc_corr_dot, `ifelse(substr($1,decr(len($1))),.,$1,$1`'ifelse(index($1,.),-1,,.))')
+define(nsc_name, `nsc_unescape_name(ifelse(substr($1,decr(len($1))),.,$1,$1`'ifelse(regexp($1,`[^\\]\.'),-1,,.)))')
+define(nsc_unescape_name,`patsubst(`$1',\\\.,.)')
 
 # Normalize IPv6 address
 
@@ -92,15 +93,8 @@ define(`nsc_fatal_error', `errprint(`NSC error: $1
 
 define(`NAMED_RESTART_CMD', `rndc reload')
 
-define(`ROOT', `/etc/named')
 define(`CFDIR', `cf')
-define(`ZONEDIR', `zone')
-define(`BAKDIR', `bak')
 define(`VERSDIR', `ver')
-define(`HASHDIR', `hash')
-define(`KEYDIR', `keys')
-define(`DSSDIR', `dss')
-define(`ROOTCACHE', `root.cache')
 
 define(`REFRESH', HOURS(8))
 define(`RETRY', HOURS(2))
@@ -112,6 +106,7 @@ define(`MAINTNAME', `root'.`nsc_corr_dot(NSNAME)')
 
 define(`KEYGEN_OPTIONS', `-a RSASHA256 -b 1024')
 define(`SIGNZONE_OPTIONS', `-e +'DAYS(365))
+define(`DSFROMKEY_OPTIONS', `')
 
 # And finally we change comments to semicolons to be compatible with the zone files