Changeset 500
- Timestamp:
- 05/07/13 10:44:58 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/dns-rpc.cgi
r499 r500 43 43 'dnsdb.addDomain' => \&addDomain, 44 44 'dnsdb.delZone' => \&delZone, 45 'dnsdb.domainID' => \&domainID, 45 46 'dnsdb.addRDNS' => \&addRDNS, 46 47 'dnsdb.addGroup' => \&addGroup, … … 173 174 #sub domainName {} 174 175 #sub revName {} 175 #sub domainID {} 176 177 sub domainID { 178 my %args = @_; 179 180 _commoncheck(\%args, 'y'); 181 182 my $domid = $dnsdb->domainID($args{domain}); 183 die $dnsdb->errstr if !$domid; 184 return $domid; 185 } 186 176 187 #sub revID {} 177 188 … … 346 357 _commoncheck(\%args); 347 358 359 # deal gracefully with alternate calling convention for args{id} 360 $args{id} = $args{ID} if !$args{id} && $args{ID}; 361 # ... and fail if we don't have one 362 die "Missing zone ID\n" if !$args{id}; 363 348 364 # set some optional args 349 $args{nrecs} = 'all' if !$args{nrecs}; 350 $args{nstart} = 0 if !$args{nstart}; 365 $args{offset} = 0 if !$args{offset}; 351 366 ## for order, need to map input to column names 352 367 $args{order} = 'host' if !$args{order}; 353 368 $args{direction} = 'ASC' if !$args{direction}; 354 369 $args{defrec} = 'n' if !$args{defrec}; 370 $args{revrec} = 'n' if !$args{revrec}; 371 372 # convert zone name to zone ID, if needed 373 if ($args{defrec} eq 'n') { 374 if ($args{revrec} eq 'n') { 375 $args{id} = $dnsdb->domainID($args{id}) if $args{id} !~ /^\d+$/; 376 } else { 377 $args{id} = $dnsdb->revID($args{id}) if $args{id} !~ /^\d+$/ 378 } 379 } 380 381 # and finally retrieve the records. 355 382 my $ret = $dnsdb->getRecList(defrec => $args{defrec}, revrec => $args{revrec}, id => $args{id}, 356 offset => $args{offset}, sortby => $args{sortby}, sortorder => $args{sortorder}, 357 filter => $args{filter}); 358 383 offset => $args{offset}, nrecs => $args{nrecs}, sortby => $args{sortby}, 384 sortorder => $args{sortorder}, filter => $args{filter}); 385 386 ##fixme: what to do if domain doesn't exist? 359 387 die $dnsdb->errstr if !$ret; 360 388
Note:
See TracChangeset
for help on using the changeset viewer.