Changeset 277 for trunk/dns.cgi
- Timestamp:
- 03/15/12 18:04:02 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/dns.cgi
r275 r277 908 908 } 909 909 910 fillsoa($webvar{defrec},$webvar{ id});910 fillsoa($webvar{defrec},$webvar{revrec},$webvar{id}); 911 911 912 912 } elsif ($webvar{page} eq 'updatesoa') { … … 930 930 931 931 # get old SOA for log 932 my %soa = getSOA($dbh,$webvar{defrec},$webvar{id}); 933 934 my $sth; 935 ##fixme: push SQL into DNSDB.pm 936 ##fixme: data validation: make sure {recid} is really the SOA for {id} 937 # no domain ID, so we're editing the default SOA for a group (we don't care which one here) 938 # plus a bit of magic to update the appropriate table 939 my $sql = "UPDATE ".($webvar{defrec} eq 'y' ? "default_records" : "records"). 940 " SET host=?, val=?, ttl=? WHERE record_id=?"; 941 $sth = $dbh->prepare($sql); 942 $sth->execute("$webvar{contact}:$webvar{prins}", 943 "$webvar{refresh}:$webvar{retry}:$webvar{expire}:$webvar{minttl}", 944 $webvar{ttl}, 945 $webvar{recid}); 946 947 if ($sth->err) { 932 my %soa = getSOA($dbh,$webvar{defrec},$webvar{revrec},$webvar{id}); 933 934 # my $sth; 935 ###fixme: push SQL into DNSDB.pm 936 ###fixme: data validation: make sure {recid} is really the SOA for {id} 937 # # no domain ID, so we're editing the default SOA for a group (we don't care which one here) 938 # # plus a bit of magic to update the appropriate table 939 # my $sql = "UPDATE ".($webvar{defrec} eq 'y' ? "default_records" : "records"). 940 # " SET host=?, val=?, ttl=? WHERE record_id=?"; 941 # $sth = $dbh->prepare($sql); 942 # $sth->execute("$webvar{contact}:$webvar{prins}", 943 # "$webvar{refresh}:$webvar{retry}:$webvar{expire}:$webvar{minttl}", 944 # $webvar{ttl}, 945 # $webvar{recid}); 946 947 my ($code, $msg) = updateSOA($dbh, $webvar{defrec}, $webvar{revrec}, 948 (contact => $webvar{contact}, prins => $webvar{prins}, refresh => $webvar{refresh}, 949 retry => $webvar{retry}, expire => $webvar{expire}, minttl => $soa{minttl}, 950 ttl => $webvar{ttl}, recid => $webvar{recid}) ); 951 if ($code eq 'OK') { 952 changepage(page => "reclist", id => $webvar{id}, defrec => $webvar{defrec}, revrec => $webvar{revrec}, 953 resultmsg => "SOA record updated"); 954 } else { 948 955 $page->param(update_failed => 1); 949 $page->param(msg => $DBI::errstr); 950 fillsoa($webvar{defrec},$webvar{id}); 956 $page->param(msg => $DNSDB::errstr); 957 fillsoa($webvar{defrec},$webvar{revrec},$webvar{id}); 958 } 959 951 960 ##fixme: faillog 952 } else {953 961 # } else { 962 if (0) { 954 963 # do this in the order of "default to most common case" 955 964 my $loggroup; … … 969 978 "(ns $webvar{prins}, contact $webvar{contact}, refresh $webvar{refresh},". 970 979 " retry $webvar{retry}, expire $webvar{expire}, minTTL $webvar{minttl}, TTL $webvar{ttl})"); 971 changepage(page => "reclist", id => $webvar{id}, defrec => $webvar{defrec}, 972 resultmsg => "SOA record updated"); 973 } 980 } # if (0) 974 981 975 982 } elsif ($webvar{page} eq 'grpman') { … … 1895 1902 1896 1903 sub fillsoa { 1897 my $def = shift; 1904 my $defrec = shift; 1905 my $revrec = shift; 1898 1906 my $id = shift; 1899 my $domname = ($def eq 'y' ? '' : "DOMAIN"); 1900 1901 $page->param(defrec => $def); 1907 my $domname = ($defrec eq 'y' ? '' : "DOMAIN"); 1908 1909 $page->param(defrec => $defrec); 1910 $page->param(revrec => $revrec); 1902 1911 1903 1912 # i had a good reason to do this when I wrote it... 1904 1913 # $page->param(domain => $domname); 1905 1914 # $page->param(group => $DNSDB::group); 1906 $page->param(isgrp => 1) if $def eq 'y'; 1907 $page->param(parent => ($def eq 'y' ? groupName($dbh, $DNSDB::group) : domainName($dbh, $id)) ); 1915 $page->param(isgrp => 1) if $defrec eq 'y'; 1916 $page->param(parent => ($defrec eq 'y' ? groupName($dbh, $id) : 1917 ($revrec eq 'n' ? domainName($dbh, $id) : revName($dbh, $id)) ) ); 1908 1918 1909 1919 # defaults … … 1917 1927 1918 1928 # there are probably better ways to do this. TMTOWTDI. 1919 my %soa = getSOA($dbh,$def ,$id);1929 my %soa = getSOA($dbh,$defrec,$revrec,$id); 1920 1930 1921 1931 $page->param(id => $id);
Note:
See TracChangeset
for help on using the changeset viewer.