- Timestamp:
- 09/09/11 17:38:52 (13 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/DNSDB.pm
r121 r123 1078 1078 (($def eq 'def' or $def eq 'y') ? ',r.group_id FROM default_' : ',r.domain_id FROM '). 1079 1079 "records r LEFT OUTER JOIN longrecs l ON r.longrec_id=l.longrec_id WHERE record_id=?"; 1080 my $ret = $dbh->selectrow_hashref($sql, undef, ($id) ) or warn $dbh->errstr;1080 my $ret = $dbh->selectrow_hashref($sql, undef, ($id) ); 1081 1081 1082 1082 if ($dbh->err) { 1083 1083 $errstr = $DBI::errstr; 1084 return undef; 1085 } 1086 1087 if (!$ret) { 1088 $errstr = "No such record"; 1084 1089 return undef; 1085 1090 } -
trunk/dns-rpc.cgi
r121 r123 31 31 'dnsdb.delUser' => \&delUser, 32 32 'dnsdb.getSOA' => \&getSOA, 33 'dnsdb.getRecLine' => \&getRecLine, 34 'dnsdb.getDomRecs' => \&getDomRecs, 35 'dnsdb.getRecCount' => \&getRecCount, 36 'dnsdb.addRec' => \&addRec, 37 'dnsdb.delRec' => \&delRec, 38 'dnsdb.domStatus' => \&domStatus, 33 39 34 40 'dnsdb.getMethods' => \&get_method_list … … 237 243 die "Missing remote username" if !$args{rpcuser}; # for logging 238 244 die "Missing remote system name" if !$args{rpcsystem}; # for logging 245 246 my $ret = DNSDB::getRecLine($dbh, $args{def}, $args{id}); 247 248 die $DNSDB::errstr if !$ret; 249 250 return $ret; 239 251 } 240 252 … … 245 257 die "Missing remote username" if !$args{rpcuser}; # for logging 246 258 die "Missing remote system name" if !$args{rpcsystem}; # for logging 247 } 248 249 #sub getRecCount { 259 260 #bleh 261 $args{nrecs} = 'all' if !$args{nrecs}; 262 $args{nstart} = 0 if !$args{nstart}; 263 ## for order, need to map input to column names 264 $args{order} = 'host' if !$args{order}; 265 $args{direction} = 'ASC' if !$args{direction}; 266 267 my $ret = DNSDB::getDomRecs($dbh, $args{def}, $args{id}, $args{nrecs}, $args{nstart}, $args{order}, $args{direction}); 268 269 die $DNSDB::errstr if !$ret; 270 271 return $ret; 272 } 273 274 sub getRecCount { 275 my %args = @_; 276 277 # Make sure we've got all the local bits we need 278 die "Missing remote username" if !$args{rpcuser}; # for logging 279 die "Missing remote system name" if !$args{rpcsystem}; # for logging 280 281 return DNSDB::getRecCount($dbh, $id); 282 } 250 283 251 284 sub addRec { … … 255 288 die "Missing remote username" if !$args{rpcuser}; # for logging 256 289 die "Missing remote system name" if !$args{rpcsystem}; # for logging 290 291 # note dist, weight, port are not reequired on all types; will be ignored if not needed. 292 my ($code, $msg) = DNSDB::addRec($dbh, $args{def}, $args{domid}, $args{host}, $typemap{$args{type}}, 293 $args{val}, $args{ttl}, $args{dist}, $args{weight}, $args{port}); 294 295 die $msg if $code eq 'FAIL'; 257 296 } 258 297 … … 263 302 die "Missing remote username" if !$args{rpcuser}; # for logging 264 303 die "Missing remote system name" if !$args{rpcsystem}; # for logging 304 305 # note dist, weight, port are not reequired on all types; will be ignored if not needed. 306 my ($code, $msg) = DNSDB::updateRec($dbh, $args{def}, $args{recid}, $args{host}, $typemap{$args{type}}, 307 $args{val}, $args{ttl}, $args{dist}, $args{weight}, $args{port}); 308 309 die $msg if $code eq 'FAIL'; 265 310 } 266 311 … … 271 316 die "Missing remote username" if !$args{rpcuser}; # for logging 272 317 die "Missing remote system name" if !$args{rpcsystem}; # for logging 318 319 # note dist, weight, port are not reequired on all types; will be ignored if not needed. 320 my ($code, $msg) = DNSDB::delRec($dbh, $args{def}, $args{recid}); 321 322 die $msg if $code eq 'FAIL'; 273 323 } 274 324 275 325 #sub getParents { 276 #sub domStatus { 326 327 sub domStatus { 328 my %args = @_; 329 330 # Make sure we've got all the local bits we need 331 die "Missing remote username" if !$args{rpcuser}; # for logging 332 die "Missing remote system name" if !$args{rpcsystem}; # for logging 333 334 my @arglist = ($dbh, $args{domid}); 335 push @arglist, $args{status} if defined($args{status}); 336 337 my $status = DNSDB::domStatus(@arglist); 338 } 339 277 340 #sub importAXFR { 278 341 #sub export {
Note:
See TracChangeset
for help on using the changeset viewer.