Changeset 101
Legend:
- Unmodified
- Added
- Removed
-
trunk/DNSDB.pm
r94 r101 58 58 59 59 # Halfway sane defaults for SOA, TTL, etc. 60 # serial defaults to 0 for convenience. 61 # value will be either YYYYMMDDNN for BIND/etc, or auto-internal for tinydns 60 62 our %def = qw ( 61 63 contact hostmaster.DOMAIN 62 64 prins ns1.myserver.com 65 serial 0 63 66 soattl 86400 64 67 refresh 10800 … … 976 979 my %ret; 977 980 978 my $sql = "select record_id,host,val,ttl from"; 981 # (ab)use distance and weight columns to store SOA data 982 983 my $sql = "SELECT record_id,host,val,ttl,distance from"; 979 984 if ($def eq 'def' or $def eq 'y') { 980 $sql .= " default_records where group_id=$id andtype=$reverse_typemap{SOA}";985 $sql .= " default_records WHERE group_id=? AND type=$reverse_typemap{SOA}"; 981 986 } else { 982 987 # we're editing a live SOA record; find based on domain 983 $sql .= " records where domain_id=$id andtype=$reverse_typemap{SOA}";988 $sql .= " records WHERE domain_id=? AND type=$reverse_typemap{SOA}"; 984 989 } 985 990 my $sth = $dbh->prepare($sql); 986 $sth->execute ;987 988 my ($recid,$host,$val,$ttl ) = $sth->fetchrow_array();991 $sth->execute($id); 992 993 my ($recid,$host,$val,$ttl,$serial) = $sth->fetchrow_array(); 989 994 my ($prins,$contact) = split /:/, $host; 990 995 my ($refresh,$retry,$expire,$minttl) = split /:/, $val; … … 992 997 $ret{recid} = $recid; 993 998 $ret{ttl} = $ttl; 999 $ret{serial} = $serial; 994 1000 $ret{prins} = $prins; 995 1001 $ret{contact} = $contact; -
trunk/dns.cgi
r98 r101 37 37 38 38 my @debugbits; # temp, to be spit out near the end of processing 39 my $debugenv = 1;39 my $debugenv = 0; 40 40 41 41 # Let's do these templates right... … … 1269 1269 no warnings qw( uninitialized ); 1270 1270 1271 $page->param(name => $webvar{name}); 1271 ##todo: allow BIND-style bare names, ASS-U-ME that the name is within the domain? 1272 # prefill <domain> or DOMAIN in "Host" space for new records 1273 my $domroot = ($webvar{defrec} eq 'y' ? 'DOMAIN' : domainName($dbh,$webvar{parentid})); 1274 $page->param(name => $domroot); 1272 1275 $page->param(address => $webvar{address}); 1273 1276 $page->param(distance => $webvar{distance}) … … 1275 1278 $page->param(weight => $webvar{weight}) if $webvar{type} == $reverse_typemap{SRV}; 1276 1279 $page->param(port => $webvar{port}) if $webvar{type} == $reverse_typemap{SRV}; 1277 $page->param(ttl => ($webvar{ttl} ? $webvar{ttl} : $DNSDB::def{minttl})); 1280 # retrieve the right ttl instead of falling (way) back to the hardcoded system default 1281 my %soa = getSOA($dbh,$webvar{defrec},$webvar{parentid}); 1282 $page->param(ttl => ($webvar{ttl} ? $webvar{ttl} : $soa{minttl})); 1278 1283 } 1279 1284 … … 1677 1682 1678 1683 ##fixme: push SQL into DNSDB.pm 1684 ##fixme: add bits to retrieve group/domain name info to retain after entity is deleted? 1679 1685 my $sth = $dbh->prepare("SELECT user_id, firstname || ' ' || lastname FROM users WHERE username=?"); 1680 1686 $sth->execute($username);
Note:
See TracChangeset
for help on using the changeset viewer.