diff options
Diffstat (limited to 'tinydns-model.lua')
-rw-r--r-- | tinydns-model.lua | 58 |
1 files changed, 54 insertions, 4 deletions
diff --git a/tinydns-model.lua b/tinydns-model.lua index 4d08a57..a466f6b 100644 --- a/tinydns-model.lua +++ b/tinydns-model.lua @@ -122,7 +122,7 @@ local function searchforconfigfiles() end -- Debug option (adds the sampleconfig content) - table.insert(configfiles, "/usr/share/acf/app/tinydns/sampleconfig.conf") +-- table.insert(configfiles, "/usr/share/acf/app/tinydns/sampleconfig.conf") end searchforconfigfiles() @@ -149,7 +149,15 @@ local function recursedomains(t,array,maxn,currnum) currnum = currnum - 1 -- FIXME: The current level should hold information on previous level too! if not (currnum == 0) then + +-- if (array) and (type(array[t[currnum]]) == "table") then +-- local k,v = pairs(array[t[currnum]]) do +-- end +-- end + if not (array[t[currnum]]) then +-- if not (array[(table.concat(t,"."))]) then +-- array[t[currnum]] = {} array[t[currnum]] = {} end recursedomains(t,array[t[currnum]],maxn,currnum) @@ -273,11 +281,53 @@ function getconfig() if (filecontent_table[1] == "&") then local descr=check_signs("prefix") domain = format.string_to_table(filecontent_table[2], "%.") + + if (domain[#domain] ~= "arpa") then + -- We rebuild the table and add previous level-information to the current level + for i = table.maxn(domain),2,-1 do + domain[i-1] = domain[i-1] .. "." .. domain[i] + end + + -- This is the main information on each object domaindetails = cfe ({ - name=filecontent_table[2], - label=descr[filecontent_table[1]], - value=filecontent_table[2], + name=filecontent_table[4], + label=filecontent_table[4], }) + -- Add details to the previous object + table.insert(domaindetails, cfe ({ + name=type, + label="Type:", + value=descr[filecontent_table[1]], + })) + table.insert(domaindetails, cfe ({ + name=domain, + label="Domain:", + value=filecontent_table[2], + })) + table.insert(domaindetails, cfe ({ + name=ip, + label="IP address:", + value=filecontent_table[3], + })) + table.insert(domaindetails, cfe ({ + name=ns, + label="Name server:", + value=filecontent_table[4], + })) + table.insert(domaindetails, cfe ({ + name=ttl, + label="TimeToLive:", + value=filecontent_table[5], + })) + + + table.insert(domaindetails, cfe ({ + name=debug, + label="Debug:", + value=table.concat(filecontent_table,":"), + })) + end + end local value = filecontent_table[2] |