Disable renaming to empty string

So far it was possible to rename any object using LDAPUpdate to a name
with empty primary key. Since this can cause nasty problems, this patch
disables empty string in --rename argument.

https://fedorahosted.org/freeipa/ticket/827
This commit is contained in:
Jan Zeleny 2011-01-24 03:24:05 -05:00 committed by Rob Crittenden
parent 35b3d6b3be
commit 3e3cc55d24

View File

@ -800,6 +800,8 @@ class LDAPUpdate(LDAPQuery, crud.Update):
rdnupdate = False
try:
if self.obj.rdnattr and 'rename' in options:
if not options['rename']:
raise errors.ValidationError(name='rename', error=u'can\'t be empty')
entry_attrs[self.obj.rdnattr] = options['rename']
if self.obj.rdnattr and self.obj.rdnattr in entry_attrs: