Univention Bugzilla – Attachment 8838 Details for
Bug 42531
Check reason of failure of user access to files in samba share
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
check_file_access.py.diff
check_file_access.py.diff (text/plain), 2.21 KB, created by
Arvid Requate
on 2017-05-10 18:56:53 CEST
(
hide
)
Description:
check_file_access.py.diff
Filename:
MIME Type:
Creator:
Arvid Requate
Created:
2017-05-10 18:56:53 CEST
Size:
2.21 KB
patch
obsolete
>--- check_file_access.py.orig 2017-05-10 17:13:52.934432295 +0200 >+++ check_file_access.py 2017-05-10 18:43:52.037485359 +0200 >@@ -189,7 +189,7 @@ def resolve_smb_path_to_local_path(share > directory (if smb.conf has a `homes` section). > """ > (host_name, share_name, file_path) = split_share_path(share_path) >- if host_name != get_samba_host(): >+ if not host_name in ("localhost", "127.0.0.1", "::1", get_samba_host()): > raise ValueError("Can only resolve local SMB paths.") > shares = find_samba_shares(share_name=share_name, user_name=user_name) > share = next((share for share in shares), dict()) >@@ -274,7 +274,10 @@ def print_until_success(check_generator, > print(" ", "but", result.description, "succeded") > return last_error > if first.is_success(): >- print(result.description, "succeded") >+ try: >+ print(result.description, "succeded") >+ except UnboundLocalError: >+ print("first.is_success") > return None > > >@@ -512,6 +515,8 @@ def do_smb_access_check(credentials, hos > except samba.NTSTATUSError as error: > if "x" in permissions and "r" not in permissions: > result.add_description(" (note, that for x, r is needed)") >+ if error.args[1] == "The object name is not found.": >+ raise SMBError(error, error.args[1]) > raise SMBAccessError(host_name, share_name, smb_path, permissions, error) > else: > smb.close_file(fnum) >@@ -540,7 +545,10 @@ def find_smb_access_problem(user_name, c > group_sids = (security.dom_sid(security.SID_WORLD),) + tuple(gid_to_sid(gid) for gid in gids) > > selection = security.SECINFO_OWNER | security.SECINFO_GROUP | security.SECINFO_DACL >- acl = client.get_acl(smb_path, selection, security.SEC_FLAG_MAXIMUM_ALLOWED) >+ try: >+ acl = client.get_acl(smb_path, selection, security.SEC_FLAG_MAXIMUM_ALLOWED) >+ except samba.NTSTATUSError as error: >+ raise SMBError(host_name, error) > > if acl.dacl is not None and not acl.dacl.aces: > return "No access because of emtpy DACL to {!r}".format(path) >@@ -857,7 +865,7 @@ def main(): > args = parse_arguments() > for path in args.file_path: > if args.is_smb_path: >- path = resolve_smb_path_to_local_path(path, user=args.user) >+ path = resolve_smb_path_to_local_path(path, user_name=args.user) > run_checks(args, os.path.abspath(path)) > >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 42531
:
8817
| 8838 |
8839
|
8840