fix only_owner to work when called by FIFSRegistrar

This commit is contained in:
Jonathan Rainville 2018-07-23 11:56:33 -04:00
parent 3265218000
commit 9baf11f555
1 changed files with 5 additions and 13 deletions

View File

@ -15,8 +15,8 @@ contract ENSRegistry is ENS {
mapping (bytes32 => Record) records; mapping (bytes32 => Record) records;
// Permits modifications only by the owner of the specified node. // Permits modifications only by the owner of the specified node.
modifier only_owner(bytes32 node) { modifier only_owner(bytes32 node, address owner) {
require(records[node].owner == 0 || records[node].owner == msg.sender); require(records[node].owner == 0 || records[node].owner == msg.sender || records[node].owner == owner);
_; _;
} }
@ -32,7 +32,7 @@ contract ENSRegistry is ENS {
* @param node The node to transfer ownership of. * @param node The node to transfer ownership of.
* @param owner The address of the new owner. * @param owner The address of the new owner.
*/ */
function setOwner(bytes32 node, address owner) public only_owner(node) { function setOwner(bytes32 node, address owner) public only_owner(node, owner) {
Transfer(node, owner); Transfer(node, owner);
records[node].owner = owner; records[node].owner = owner;
} }
@ -43,19 +43,11 @@ contract ENSRegistry is ENS {
* @param label The hash of the label specifying the subnode. * @param label The hash of the label specifying the subnode.
* @param owner The address of the new owner. * @param owner The address of the new owner.
*/ */
/* function setSubnodeOwner(bytes32 node, bytes32 label, address owner) public only_owner(node, owner) {
function setSubnodeOwner(bytes32 node, bytes32 label, address owner) public only_owner(node) {
var subnode = keccak256(node, label); var subnode = keccak256(node, label);
NewOwner(node, label, owner); NewOwner(node, label, owner);
records[subnode].owner = owner; records[subnode].owner = owner;
} }
*/
function setSubnodeOwner(bytes32 node, bytes32 label, address owner) public {
var subnode = sha3(node, label);
NewOwner(node, label, owner);
records[subnode].owner = owner;
}
/** /**
* @dev Sets the resolver address for the specified node. * @dev Sets the resolver address for the specified node.
@ -72,7 +64,7 @@ contract ENSRegistry is ENS {
* @param node The node to update. * @param node The node to update.
* @param ttl The TTL in seconds. * @param ttl The TTL in seconds.
*/ */
function setTTL(bytes32 node, uint64 ttl) public only_owner(node) { function setTTL(bytes32 node, uint64 ttl) public only_owner(node, 0x0) {
NewTTL(node, ttl); NewTTL(node, ttl);
records[node].ttl = ttl; records[node].ttl = ttl;
} }