]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/smb: Allow whitespace in share login names 66574/head
authorAnoop C S <anoopcs@cryptolab.net>
Tue, 9 Dec 2025 13:37:40 +0000 (19:07 +0530)
committerAnoop C S <anoopcs@cryptolab.net>
Wed, 10 Dec 2025 08:21:08 +0000 (13:51 +0530)
Whitespaces are perfectly valid in Windows AD user or group names.

Signed-off-by: Anoop C S <anoopcs@cryptolab.net>
src/pybind/mgr/smb/tests/test_resources.py
src/pybind/mgr/smb/tests/test_validation.py
src/pybind/mgr/smb/validation.py

index fda7654a55cbe8dfd8fcf559a8f5a8bc2bb5d3c3..c42d7ea84e454c0bc51b698f85e85e63e1895ade 100644 (file)
@@ -724,7 +724,7 @@ login_control:
   - name: itstaff
     category: group
     access: rw
-  - name: caldor
+  - name: "caldor hart"
     category: user
     access: admin
   - name: delbard
@@ -742,7 +742,7 @@ login_control:
     assert share.login_control[1].name == 'itstaff'
     assert share.login_control[1].category == enums.LoginCategory.GROUP
     assert share.login_control[1].access == enums.LoginAccess.READ_WRITE
-    assert share.login_control[2].name == 'caldor'
+    assert share.login_control[2].name == 'caldor hart'
     assert share.login_control[2].category == enums.LoginCategory.USER
     assert share.login_control[2].access == enums.LoginAccess.ADMIN
     assert share.login_control[3].name == 'delbard'
index 3c30b6b02f69adbefcabbc4c51d54963fbbdf538..cc0c6cdb301dbb9cbf259bfcc62198ae2809f482 100644 (file)
@@ -117,9 +117,9 @@ def test_clean_custom_options():
     [
         ("tim", True, ""),
         ("britons\\arthur", True, ""),
-        ("lance a lot", False, "spaces, tabs, or newlines"),
-        ("tabs\ta\tlot", False, "spaces, tabs, or newlines"),
-        ("bed\nivere", False, "spaces, tabs, or newlines"),
+        ("lance a lot", True, ""),
+        ("tabs\ta\tlot", False, "tabs or newlines"),
+        ("bed\nivere", False, "tabs or newlines"),
         ("runawa" + ("y" * 122), True, ""),
         ("runawa" + ("y" * 123), False, "128"),
     ],
index 41d76b77d3f30c00e7cf2a3243c0cd196506bce1..02fab2a642a1d859d8a9f415428176185d978e1f 100644 (file)
@@ -108,10 +108,8 @@ def clean_custom_options(
 
 
 def check_access_name(name: str) -> None:
-    if ' ' in name or '\t' in name or '\n' in name:
-        raise ValueError(
-            'login name may not contain spaces, tabs, or newlines'
-        )
+    if '\t' in name or '\n' in name:
+        raise ValueError('login name may not contain tabs or newlines')
     if len(name) > 128:
         raise ValueError('login name may not exceed 128 characters')