Changeset 756 for branches/stable/dns.cgi
- Timestamp:
- 06/13/17 13:58:57 (8 years ago)
- Location:
- branches/stable
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/stable
- Property svn:mergeinfo changed
/trunk merged: 722-724,727-749
- Property svn:mergeinfo changed
-
branches/stable/dns.cgi
r725 r756 3 3 ## 4 4 # $Id$ 5 # Copyright 2008-201 3Kris Deugau <kdeugau@deepnet.cx>5 # Copyright 2008-2016 Kris Deugau <kdeugau@deepnet.cx> 6 6 # 7 7 # This program is free software: you can redistribute it and/or modify … … 120 120 $webvar{startwith} =~ s/^(0-9|[a-z]).*/$1/ if $webvar{startwith}; 121 121 # not much call for chars not allowed in domain names 122 $webvar{filter} =~ s/[^a-zA-Z0-9_.:\@ -]//g if $webvar{filter};122 $webvar{filter} =~ s/[^a-zA-Z0-9_.:\@%-]//g if $webvar{filter}; 123 123 ## only set 'y' if box is checked, no other values legal 124 124 ## however, see https://secure.deepnet.cx/trac/dnsadmin/ticket/31 … … 138 138 # @#$%@%@#% XHTML - & in a URL must be escaped. >:( 139 139 my $uri_self = $ENV{REQUEST_URI}; 140 $uri_self = "/dns.cgi" if !$uri_self || $uri_self eq '/'; 140 141 $uri_self =~ s/\&([a-z])/\&\;$1/g; 141 142 … … 455 456 456 457 if ($code eq 'OK') { 458 $webvar{domain} = lc($webvar{domain}) if $dnsdb->{lowercase}; 457 459 $dnsdb->mailNotify("New ".($webvar{makeactive} eq 'on' ? 'Active' : 'Inactive')." Domain Created", 458 460 ($webvar{makeactive} eq 'on' ? 'Active' : 'Inactive').qq( domain "$webvar{domain}" added by ). … … 1795 1797 ##fixme: where should we call this from? 1796 1798 $id = $webvar{id}; 1797 if (!check_scope(id => $id, type => 'user')) { 1798 $page->param(errmsg => "You are not permitted to view log entries for the requested user"); 1799 goto DONELOG; 1800 } 1801 $page->param(logfor => 'user '.$dnsdb->userFullName($id)); 1799 ##fixme: don't include username on out-of-scope users 1800 $page->param(logfor => 'user '.($id ? $dnsdb->userFullName($id) : $webvar{fname})); 1802 1801 } elsif ($webvar{ltype} && $webvar{ltype} eq 'dom') { 1803 1802 $id = $webvar{id}; … … 1821 1820 } 1822 1821 $webvar{ltype} = 'group' if !$webvar{ltype}; 1823 my $lcount = $dnsdb->getLogCount(id => $id, logtype => $webvar{ltype}) or push @debugbits, $dnsdb->errstr; 1822 1823 # Done here since we want to allow more arbitrary blobs in the log filter 1824 if (defined($webvar{logfilter})) { 1825 $session->param('logfilter', '') if !$session->param('logfilter'); 1826 if ($webvar{logfilter} ne $session->param('logfilter')) { 1827 $uri_self =~ s/\&offset=[^&]//; 1828 $offset = 0; 1829 } 1830 $session->param('logfilter', $webvar{logfilter}) 1831 } 1832 my $logfilter = $session->param('logfilter'); 1833 $filter = $logfilter; 1834 $page->param(logfilter => $logfilter); 1835 1836 my $lcount = $dnsdb->getLogCount(id => $id, group => $logingroup, fname => $webvar{fname}, 1837 logtype => $webvar{ltype}, filter => $logfilter); 1838 if (!$lcount) { 1839 $page->param(errmsg => $dnsdb->errstr); 1840 $lcount = 0; 1841 } 1824 1842 1825 1843 $page->param(id => $id); … … 1840 1858 1841 1859 # Set up the column headings with the sort info 1842 my @cols = ('fname','username','entry','stamp'); 1843 my %colnames = (fname => 'Name', username => 'Username', entry => 'Log Entry', stamp => 'Date/Time'); 1860 my @cols = ('fname','domain','revzone','entry','stamp'); 1861 my %colnames = (fname => 'Name', domain => 'Forward zone', revzone => 'Reverse zone', 1862 entry => 'Log Entry', stamp => 'Date/Time'); 1844 1863 fill_colheads($sortby, $sortorder, \@cols, \%colnames); 1845 1864 1846 1865 ##fixme: increase per-page limit or use separate limit for log? some ops give *lots* of entries... 1847 my $logentries = $dnsdb->getLogEntries(id => $id, logtype => $webvar{ltype}, 1848 offset => $webvar{offset}, sortby => $sortby, sortorder => $sortorder); 1849 $page->param(logentries => $logentries); 1866 my $logentries = $dnsdb->getLogEntries(id => $id, group => $logingroup, fname => $webvar{fname}, 1867 logtype => $webvar{ltype}, 1868 offset => $webvar{offset}, sortby => $sortby, sortorder => $sortorder, filter => $logfilter); 1869 if (!$logentries) { 1870 $page->param(errmsg => $dnsdb->errstr); 1871 } else { 1872 # undef $logentries is inexplicably puking instead of showing "no entries found", 1873 # like all the rest of the methods that return a list the same way. idunno... 1874 $page->param(logentries => $logentries); 1875 } 1850 1876 1851 1877 ##fixme: 1852 # - filtering1853 # - show reverse zone column?1854 1878 # - on log record creation, bundle "parented" log actions (eg, "AXFR record blah for domain foo", 1855 1879 # or "Add record bar for new domain baz") into one entry (eg, "AXFR domain foo", "Add domain baz")? … … 1858 1882 # scope check fail target 1859 1883 DONELOG: ; 1884 1885 } elsif ($webvar{page} eq 'recsearch') { 1886 1887 # we do this for the domain and record list filter/search - it should be extremely rare to 1888 # need to search on characters outside this set until we get into IDNs 1889 # note this is a little larger due to template records 1890 $webvar{searchfor} =~ s/[^a-zA-Z0-9_.:\@%-]//g if $webvar{searchfor}; 1891 1892 # save the search in the session, same as the "filter" in various other lists... 1893 if (defined($webvar{searchfor})) { 1894 if ($session->param('recsearch') && $webvar{searchfor} ne $session->param('recsearch')) { 1895 $uri_self =~ s/\&offset=[^&]//; 1896 $offset = 0; 1897 } 1898 $session->param(recsearch => $webvar{searchfor}); 1899 } 1900 my $searchfor = $session->param('recsearch'); 1901 1902 $sortby = 'host'; 1903 $session->param($webvar{page}.'sortby', $webvar{sortby}) if $webvar{sortby}; 1904 $session->param($webvar{page}.'order', $webvar{order}) if $webvar{order}; 1905 $sortby = $session->param($webvar{page}.'sortby') if $session->param($webvar{page}.'sortby'); 1906 $sortorder = $session->param($webvar{page}.'order') if $session->param($webvar{page}.'order'); 1907 1908 # some magic to label and linkify the column headers for sorting 1909 my @cols = ('domain','revzone','host','type','val'); 1910 my %colheads = (domain => "Domain (Group)", revzone => "Reverse zone (Group)", host => "Host", 1911 type => "Type", val => "IP/value"); 1912 # only users allowed to see location/view data get this column 1913 if ($permissions{admin} || $permissions{location_view}) { 1914 $colheads{location} = "Location"; 1915 push @cols, 'location'; 1916 } 1917 fill_colheads($sortby, $sortorder, \@cols, \%colheads); 1918 1919 # pgcount.tmpl 1920 my $count = $dnsdb->recSearchCount(searchfor => $searchfor, group => $logingroup); 1921 fill_pgcount($count, "records"); 1922 fill_fpnla($count); 1923 1924 # and a bit for fpnla.tmpl 1925 $page->param(curpage => $webvar{page}); 1926 1927 $page->param(searchfor => $searchfor); 1928 my $recset = $dnsdb->recSearch(searchfor => $searchfor, group => $logingroup, offset => $webvar{offset}, 1929 sortby => $sortby, sortorder => $sortorder); 1930 $page->param(searchresults => $recset); 1860 1931 1861 1932 } # end $webvar{page} dance
Note:
See TracChangeset
for help on using the changeset viewer.