summaryrefslogtreecommitdiffstats
path: root/ipalib
diff options
context:
space:
mode:
authorPavel Zuna <pzuna@redhat.com>2011-01-18 15:43:07 -0500
committerAdam Young <ayoung@redhat.com>2011-01-18 12:46:53 -0500
commit5f4ac74563266a6bf900c36c01d17a6e4226da94 (patch)
tree932b71679fd0a2628042b7a3e0a5bd510f0d7af2 /ipalib
parent74ad4f3d7d72d8095ec5b56ba849f2aa9adcb691 (diff)
downloadfreeipa-5f4ac74563266a6bf900c36c01d17a6e4226da94.tar.gz
freeipa-5f4ac74563266a6bf900c36c01d17a6e4226da94.tar.xz
freeipa-5f4ac74563266a6bf900c36c01d17a6e4226da94.zip
Fix password/random logic in host plugin.
Fix #798
Diffstat (limited to 'ipalib')
-rw-r--r--ipalib/plugins/host.py15
1 files changed, 9 insertions, 6 deletions
diff --git a/ipalib/plugins/host.py b/ipalib/plugins/host.py
index 0a407058e..6947d9077 100644
--- a/ipalib/plugins/host.py
+++ b/ipalib/plugins/host.py
@@ -319,16 +319,19 @@ class host_add(LDAPCreate):
del entry_attrs['locality']
entry_attrs['cn'] = keys[-1]
entry_attrs['serverhostname'] = keys[-1].split('.', 1)[0]
- if 'userpassword' not in entry_attrs and \
- options.get('random', False) == False:
+ if 'userpassword' not in entry_attrs and not options.get('random', False):
entry_attrs['krbprincipalname'] = 'host/%s@%s' % (
keys[-1], self.api.env.realm
)
- if 'krbprincipalaux' not in entry_attrs['objectclass']:
- entry_attrs['objectclass'].append('krbprincipalaux')
+ if 'krbprincipal' not in entry_attrs:
entry_attrs['objectclass'].append('krbprincipal')
- elif 'krbprincipalaux' in entry_attrs['objectclass']:
- entry_attrs['objectclass'].remove('krbprincipalaux')
+ if 'krbprincipal' not in entry_attrs:
+ entry_attrs['objectclass'].append('krbprincipalaux')
+ else:
+ if 'krbprincipal' in entry_attrs['objectclass']:
+ entry_attrs['objectclass'].remove('krbprincipal')
+ if 'krbprincipalaux' in entry_attrs['objectclass']:
+ entry_attrs['objectclass'].remove('krbprincipalaux')
if 'random' in options:
if options.get('random'):
entry_attrs['userpassword'] = ipa_generate_password()