Changeset 511
- Timestamp:
- 05/14/13 14:51:22 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/dns-rpc.cgi
r506 r511 118 118 } 119 119 120 # check for defrec and revrec; only call on subs that deal with records 121 sub _reccheck { 122 my $argref = shift; 123 die "Missing defrec and/or revrec flags\n" if !($argref->{defrec} || $argref->{revrec}); 124 } 125 120 126 # set location to the zone's default location if none is specified 121 127 sub _loccheck { … … 151 157 152 158 my ($code, $msg) = $dnsdb->addDomain($args{domain}, $args{group}, $args{state}); 153 die $msgif $code eq 'FAIL';159 die "$msg\n" if $code eq 'FAIL'; 154 160 return $msg; # domain ID 155 161 } … … 172 178 ($code,$msg) = $dnsdb->delZone($zoneid, $args{revrec}); 173 179 } 174 die $msgif $code eq 'FAIL';180 die "$msg\n" if $code eq 'FAIL'; 175 181 return $msg; 176 182 } … … 185 191 186 192 my $domid = $dnsdb->domainID($args{domain}); 187 die $dnsdb->errstrif !$domid;193 die "$dnsdb->errstr\n" if !$domid; 188 194 return $domid; 189 195 } … … 219 225 ## optional $inhert arg? 220 226 my ($code,$msg) = $dnsdb->addGroup($args{groupname}, $args{parent_id}, $perms); 221 die $msgif $code eq 'FAIL';227 die "$msg\n" if $code eq 'FAIL'; 222 228 return $msg; 223 229 } … … 238 244 ($code,$msg) = $dnsdb->delGroup($grpid); 239 245 } 240 die $msgif $code eq 'FAIL';246 die "$msg\n" if $code eq 'FAIL'; 241 247 return $msg; 242 248 } … … 264 270 } 265 271 my ($code,$msg) = $dnsdb->addUser(@userargs); 266 die $msgif $code eq 'FAIL';272 die "$msg\n" if $code eq 'FAIL'; 267 273 return $msg; 268 274 } … … 290 296 # have to pass them all in to be overwritten 291 297 my ($code,$msg) = $dnsdb->updateUser(@userargs); 292 die $msgif $code eq 'FAIL';298 die "$msg\n" if $code eq 'FAIL'; 293 299 return $msg; 294 300 } … … 301 307 die "Missing UID\n" if !$args{uid}; 302 308 my ($code,$msg) = $dnsdb->delUser($args{uid}); 303 die $msgif $code eq 'FAIL';309 die "$msg\n" if $code eq 'FAIL'; 304 310 return $msg; 305 311 } … … 330 336 331 337 _commoncheck(\%args); 338 339 _reccheck(\%args); 332 340 333 341 my $ret = $dnsdb->getSOA($args{defrec}, $args{revrec}, $args{id}); … … 349 357 _commoncheck(\%args); 350 358 359 _reccheck(\%args); 360 351 361 my $ret = $dnsdb->getRecLine($args{defrec}, $args{revrec}, $args{id}); 352 362 353 die $dnsdb->errstrif !$ret;363 die "$dnsdb->errstr\n" if !$ret; 354 364 355 365 return $ret; … … 384 394 385 395 # fail if we *still* don't have a valid zone ID 386 die $dnsdb->errstr."\n" if !$args{id};396 die "$dnsdb->errstr\n" if !$args{id}; 387 397 388 398 # and finally retrieve the records. … … 390 400 offset => $args{offset}, nrecs => $args{nrecs}, sortby => $args{sortby}, 391 401 sortorder => $args{sortorder}, filter => $args{filter}); 392 die $dnsdb->errstr."\n" if !$ret;402 die "$dnsdb->errstr\n" if !$ret; 393 403 394 404 return $ret; … … 399 409 400 410 _commoncheck(\%args); 411 412 _reccheck(\%args); 401 413 402 414 # set some optional args … … 409 421 my $ret = $dnsdb->getRecCount($args{defrec}, $args{revrec}, $args{id}, $args{filter}); 410 422 411 die $dnsdb->errstrif !$ret;423 die "$dnsdb->errstr\n" if !$ret; 412 424 413 425 return $ret; … … 419 431 _commoncheck(\%args, 'y'); 420 432 433 _reccheck(\%args); 421 434 _loccheck(\%args); 422 435 _ttlcheck(\%args); … … 437 450 my ($code, $msg) = $dnsdb->addRec(@recargs); 438 451 439 die $msgif $code eq 'FAIL';452 die "$msg\n" if $code eq 'FAIL'; 440 453 return $msg; 441 454 } … … 445 458 446 459 _commoncheck(\%args, 'y'); 460 461 _reccheck(\%args); 447 462 448 463 # get old line, so we can update only the bits that the caller passed to change … … 462 477 $args{distance}, $args{weight}, $args{port}); 463 478 464 die $msgif $code eq 'FAIL';479 die "$msg\n" if $code eq 'FAIL'; 465 480 return $msg; 466 481 } … … 541 556 _commoncheck(\%args, 'y'); 542 557 558 _reccheck(\%args); 559 543 560 my ($code, $msg) = $dnsdb->delRec($args{defrec}, $args{recrev}, $args{id}); 544 561 545 die $msgif $code eq 'FAIL';562 die "$msg\n" if $code eq 'FAIL'; 546 563 return $msg; 547 564 } … … 602 619 if ($args{delforward} || $rec->{type} == 12) { 603 620 my ($code,$msg) = $dnsdb->delRec('n', 'y', $rec->{record_id}); 604 die $msgif $code eq 'FAIL';621 die "$msg\n" if $code eq 'FAIL'; 605 622 return $msg; 606 623 } else { 607 624 my $ret = $dnsdb->downconvert($rec->{record_id}, $DNSDB::reverse_typemap{A}); 608 die $dnsdb->errstrif !$ret;625 die "$dnsdb->errstr\n" if !$ret; 609 626 return "A+PTR for $args{cidr} split and PTR removed"; 610 627 }
Note:
See TracChangeset
for help on using the changeset viewer.