Index: trunk/cgi-bin/ipdb-rpc.cgi
===================================================================
--- trunk/cgi-bin/ipdb-rpc.cgi	(revision 837)
+++ trunk/cgi-bin/ipdb-rpc.cgi	(revision 838)
@@ -252,5 +252,40 @@
 # another internal sub;  mainly a sub to make allocateBlock() a lot smaller
 #sub rpc_initPool {}
-sub rpc_updateBlock {}
+
+
+sub rpc_updateBlock {
+  my %args = @_;
+
+  _commoncheck(\%args, 'y');
+
+  _validateInput(\%args);
+
+  # Allow caller to send a CIDR instead of the block ID.
+  $args{origblock} = $args{block};
+  if ($args{block} =~ m{^(?:\d+\.){3}\d+(?:/32)?$}) {
+    # updating a static IP.  retrieve the IP ID based on either the parent or VRF.
+    die "Pool ID or VRF is required\n" if !$args{parent} && !$args{vrf};
+    ($args{block}) = $ip_dbh->selectrow_array(
+       "SELECT id FROM poolips WHERE ip = ? AND ".($args{parent} ? "parent_id = ?" : "vrf = ?"),
+       undef, $args{block}, ($args{parent} ? $args{parent} : $args{vrf}) );
+  }
+
+  my $binfo = getBlockData($ip_dbh, $args{block}, $args{type});
+
+  # set assignIP_on_update to simplify some calling situations.  better to use allocateBlock if possible though.
+  my ($code,$msg) = updateBlock($ip_dbh, %args, assignIP_on_update => 1);
+
+  if ($code eq 'FAIL') {
+    syslog "err", "$args{rpcsystem}/$args{rpcuser} could not update block/IP ID $args{block}: '$msg'";
+    die "$msg\n";
+  }
+
+  syslog "notice", "$authuser updated $args{block}";
+
+  return $msg;
+
+} # rpc_updateBlock()
+
+
 sub rpc_deleteBlock {}
 sub rpc_getBlockData {}
