mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
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
This commit is contained in:
@@ -22,6 +22,7 @@ import tempfile
|
||||
import logging
|
||||
import subprocess
|
||||
import os
|
||||
import ipa.ipavalidate as ipavalidate
|
||||
|
||||
def select_user(counter, users):
|
||||
"""counter is the number of User objects in users
|
||||
@@ -82,3 +83,11 @@ def select_group(counter, groups):
|
||||
print "Please enter a number between 1 and %s" % counter
|
||||
|
||||
return groupindex
|
||||
|
||||
def check_name(name):
|
||||
"""Helper to ensure that a user or group name is legal"""
|
||||
|
||||
if (not ipavalidate.GoodName(name, notEmpty=True)):
|
||||
raise ValueError("may only include letters, numbers, _, -, . and $")
|
||||
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user