summaryrefslogtreecommitdiffstats
path: root/ipa-python/ipautil.py
diff options
context:
space:
mode:
authorRob Crittenden <rcrit@ipa.greyoak.com>2008-08-06 13:00:36 -0400
committerRob Crittenden <rcrit@ipa.greyoak.com>2008-08-07 11:21:33 -0400
commit110f60da8e8cbf2b83f66b4959857dc62b407f06 (patch)
tree17ad23d4b346d7e826f8e3755697c382ed5ac84e /ipa-python/ipautil.py
parentfbc74a0cb48e7c596eb5c03fd56c068a8e0ef29e (diff)
downloadfreeipa-110f60da8e8cbf2b83f66b4959857dc62b407f06.tar.gz
freeipa-110f60da8e8cbf2b83f66b4959857dc62b407f06.tar.xz
freeipa-110f60da8e8cbf2b83f66b4959857dc62b407f06.zip
Change user and group validators to match shadow-utils
This sets the regex to [a-zA-Z0-9_.][a-zA-Z0-9_.-]{0,30}[a-zA-Z0-9_.$-]? Also change the validators to return True/False 450613, 457124
Diffstat (limited to 'ipa-python/ipautil.py')
-rw-r--r--ipa-python/ipautil.py15
1 files changed, 12 insertions, 3 deletions
diff --git a/ipa-python/ipautil.py b/ipa-python/ipautil.py
index 3526cc7a8..f3018ed09 100644
--- a/ipa-python/ipautil.py
+++ b/ipa-python/ipautil.py
@@ -30,6 +30,7 @@ import stat
import shutil
from ipa import ipavalidate
+from ipa import ipaadminutil
from types import *
import re
@@ -529,13 +530,13 @@ def user_input_email(prompt, default = None, allow_empty = False):
ret = user_input(prompt, default, allow_empty)
if allow_empty and ret.lower() == "none":
return ""
- if not ipavalidate.Email(ret, not allow_empty):
+ if ipavalidate.Email(ret, not allow_empty):
return ret.strip()
def user_input_plain(prompt, default = None, allow_empty = True, allow_spaces = True):
while True:
ret = user_input(prompt, default, allow_empty)
- if not ipavalidate.Plain(ret, not allow_empty, allow_spaces):
+ if ipavalidate.Plain(ret, not allow_empty, allow_spaces):
return ret
def user_input_path(prompt, default = None, allow_empty = True):
@@ -545,9 +546,17 @@ def user_input_path(prompt, default = None, allow_empty = True):
ret = user_input(prompt, default, allow_empty)
if allow_empty and ret.lower() == "none":
return ""
- if not ipavalidate.Path(ret, not allow_empty):
+ if ipavalidate.Path(ret, not allow_empty):
return ret
+def user_input_name(prompt, default = None):
+ while True:
+ ret = user_input(prompt, default, False)
+ try:
+ ipaadminutil.check_name(ret)
+ return ret
+ except ValueError, e:
+ print prompt + " " + str(e)
class AttributeValueCompleter:
'''