mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Raise an error on bad principals instead of printing one when changing passwords
Fix logic in determining what to do with an incoming principal
This commit is contained in:
parent
cfdd272166
commit
e41fcf19fe
@ -413,6 +413,10 @@ class InsufficientAccess(GenericError):
|
||||
"""You do not have permission to perform this task"""
|
||||
faultCode = 1027
|
||||
|
||||
class InvalidUserPrincipal(GenericError):
|
||||
"""Invalid user principal"""
|
||||
faultCode = 1028
|
||||
|
||||
class FunctionDeprecated(GenericError):
|
||||
"""Raised by a deprecated function"""
|
||||
faultCode = 2000
|
||||
|
@ -52,14 +52,14 @@ class passwd(frontend.Command):
|
||||
:param param uid: The login name of the user being updated.
|
||||
:param kw: Not used.
|
||||
"""
|
||||
if principal.find('@') < 0:
|
||||
import pdb
|
||||
pdb.set_trace()
|
||||
if principal.find('@') > 0:
|
||||
u = principal.split('@')
|
||||
if len(u) > 2 or len(u) == 0:
|
||||
print "Invalid user name (%s)" % principal
|
||||
if len(u) == 1:
|
||||
principal = principal+"@"+self.api.env.realm
|
||||
else:
|
||||
principal = principal
|
||||
if len(u) > 2:
|
||||
raise errors.InvalidUserPrincipal, principal
|
||||
else:
|
||||
principal = principal+"@"+self.api.env.realm
|
||||
dn = self.Backend.ldap.find_entry_dn(
|
||||
"krbprincipalname",
|
||||
principal,
|
||||
|
Loading…
Reference in New Issue
Block a user