diff options
author | Narayan Desai <desai@mcs.anl.gov> | 2007-04-05 15:35:05 +0000 |
---|---|---|
committer | Narayan Desai <desai@mcs.anl.gov> | 2007-04-05 15:35:05 +0000 |
commit | 347fb9e983255e89f1fa04090e4141bfdfe72e9e (patch) | |
tree | 2b7b39a39f6de416f6b28ce5a646f63b1a962b5b /src/lib/Server | |
parent | 6c6b0ad8d13ddcea625dbd3130ea0b9d4bc00ba8 (diff) | |
download | bcfg2-347fb9e983255e89f1fa04090e4141bfdfe72e9e.tar.gz bcfg2-347fb9e983255e89f1fa04090e4141bfdfe72e9e.tar.bz2 bcfg2-347fb9e983255e89f1fa04090e4141bfdfe72e9e.zip |
Fix shared addresses for UUID'd clients behind NAT (Resolves Ticket #420)
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@3007 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/lib/Server')
-rw-r--r-- | src/lib/Server/Plugins/Metadata.py | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/src/lib/Server/Plugins/Metadata.py b/src/lib/Server/Plugins/Metadata.py index ee190d249..d5ec3519f 100644 --- a/src/lib/Server/Plugins/Metadata.py +++ b/src/lib/Server/Plugins/Metadata.py @@ -110,7 +110,11 @@ class Metadata(Bcfg2.Server.Plugin.Plugin): self.clientdata = xdata for client in xdata.findall('.//Client'): if 'address' in client.attrib: - self.addresses[client.get('address')] = client.get('name') + caddr = client.get('address') + if self.addresses.has_key(caddr): + self.addresses[caddr].append(client.get('name')) + else: + self.addresses[caddr] = [client.get('name')] if 'uuid' in client.attrib: self.uuid[client.get('uuid')] = client.get('name') if 'secure' in client.attrib: @@ -120,7 +124,10 @@ class Metadata(Bcfg2.Server.Plugin.Plugin): if 'password' in client.attrib: self.passwords[client.get('name')] = client.get('password') for alias in [alias for alias in client.findall('Alias') if 'address' in alias.attrib]: - self.addresses[alias.get('address')] = client.get('name') + if self.addresses.has_key(alias.get('address')): + self.addresses[alias.get('address')].append(client.get('name')) + else: + self.addresses[alias.get('address')] = (client.get('name')) self.clients.update({client.get('name'): client.get('profile')}) [self.aliases.update({alias.get('name'): client.get('name')}) for alias in client.findall('Alias')] @@ -243,7 +250,10 @@ class Metadata(Bcfg2.Server.Plugin.Plugin): return self.uuid[uuid] address = addresspair[0] if self.addresses.has_key(address): - return self.addresses[address] + if len(self.addresses[address]) != 1: + self.logger.error("Address %s has multiple reverse assignments; a uuid must be used" % (address)) + raise MetadataConsistencyError + return self.addresses[address][0] try: return socket.gethostbyaddr(address)[0] except socket.herror: @@ -349,8 +359,13 @@ class Metadata(Bcfg2.Server.Plugin.Plugin): client = self.uuid[user] # we have the client - if client not in self.floating and client != user: - if client != self.resolve_client(address): + if client not in self.floating and user != 'root': + if address[0] in self.addresses: + # we are using manual resolution + if client not in self.addresses[address[0]]: + self.logger.error("Got request for non-floating UUID %s from %s" % (user, address[0])) + return False + elif client != self.resolve_client(address): self.logger.error("Got request for non-floating UUID %s from %s" \ % (user, address[0])) return False |