Changeset 255
- Timestamp:
- 03/01/12 16:39:04 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/DNSDB.pm
r254 r255 1338 1338 $sth->execute($pargroup,$groupname); 1339 1339 1340 $sth = $dbh->prepare("SELECT group_id FROM groups WHERE group_name=?"); 1341 $sth->execute($groupname); 1342 my ($groupid) = $sth->fetchrow_array(); 1340 my ($groupid) = $dbh->selectrow_array("SELECT group_id FROM groups WHERE group_name=?", undef, ($groupname)); 1343 1341 1344 1342 # Permissions … … 1365 1363 1366 1364 # Default records 1367 $sth= $dbh->prepare("INSERT INTO default_records (group_id,host,type,val,distance,weight,port,ttl) ".1365 my $sthf = $dbh->prepare("INSERT INTO default_records (group_id,host,type,val,distance,weight,port,ttl) ". 1368 1366 "VALUES ($groupid,?,?,?,?,?,?,?)"); 1367 my $sthr = $dbh->prepare("INSERT INTO default_rev_records (group_id,host,type,val,ttl) ". 1368 "VALUES ($groupid,?,?,?,?)"); 1369 1369 if ($inherit) { 1370 1370 # Duplicate records from parent. Actually relying on inherited records feels … … 1373 1373 $sth2->execute($pargroup); 1374 1374 while (my @clonedata = $sth2->fetchrow_array) { 1375 $sth->execute(@clonedata); 1375 $sthf->execute(@clonedata); 1376 } 1377 # And now the reverse records 1378 $sth2 = $dbh->prepare("SELECT group_id,host,type,val,ttl FROM default_rev_records WHERE group_id=?"); 1379 $sth2->execute($pargroup); 1380 while (my @clonedata = $sth2->fetchrow_array) { 1381 $sthr->execute(@clonedata); 1376 1382 } 1377 1383 } else { … … 1379 1385 # reasonable basic defaults for SOA, MX, NS, and minimal hosting 1380 1386 # could load from a config file, but somewhere along the line we need hardcoded bits. 1381 $sth->execute('ns1.example.com:hostmaster.example.com', 6, '10800:3600:604800:10800', 0, 0, 0, 86400); 1382 $sth->execute('DOMAIN', 1, '192.168.4.2', 0, 0, 0, 7200); 1383 $sth->execute('DOMAIN', 15, 'mx.example.com', 10, 0, 0, 7200); 1384 $sth->execute('DOMAIN', 2, 'ns1.example.com', 0, 0, 0, 7200); 1385 $sth->execute('DOMAIN', 2, 'ns2.example.com', 0, 0, 0, 7200); 1386 $sth->execute('www.DOMAIN', 5, 'DOMAIN', 0, 0, 0, 7200); 1387 $sthf->execute('ns1.example.com:hostmaster.example.com', 6, '10800:3600:604800:10800', 0, 0, 0, 86400); 1388 $sthf->execute('DOMAIN', 1, '192.168.4.2', 0, 0, 0, 7200); 1389 $sthf->execute('DOMAIN', 15, 'mx.example.com', 10, 0, 0, 7200); 1390 $sthf->execute('DOMAIN', 2, 'ns1.example.com', 0, 0, 0, 7200); 1391 $sthf->execute('DOMAIN', 2, 'ns2.example.com', 0, 0, 0, 7200); 1392 $sthf->execute('www.DOMAIN', 5, 'DOMAIN', 0, 0, 0, 7200); 1393 # reasonable basic defaults for generic reverse zone. Same as initial SQL tabledef. 1394 $sthr->execute('hostmaster.ADMINDOMAIN:ns1.ADMINDOMAIN', 6, '10800:3600:604800:10800', 86400); 1395 $sthr->execute('unused-%r.ADMINDOMAIN', 65283, 'ZONE', 3600); 1387 1396 } 1388 1397
Note:
See TracChangeset
for help on using the changeset viewer.