Lines 189-195
def resolve_smb_path_to_local_path(share
|
Link Here
|
---|
|
189 |
directory (if smb.conf has a `homes` section). |
189 |
directory (if smb.conf has a `homes` section). |
190 |
""" |
190 |
""" |
191 |
(host_name, share_name, file_path) = split_share_path(share_path) |
191 |
(host_name, share_name, file_path) = split_share_path(share_path) |
192 |
if host_name != get_samba_host(): |
192 |
if not host_name in ("localhost", "127.0.0.1", "::1", get_samba_host()): |
193 |
raise ValueError("Can only resolve local SMB paths.") |
193 |
raise ValueError("Can only resolve local SMB paths.") |
194 |
shares = find_samba_shares(share_name=share_name, user_name=user_name) |
194 |
shares = find_samba_shares(share_name=share_name, user_name=user_name) |
195 |
share = next((share for share in shares), dict()) |
195 |
share = next((share for share in shares), dict()) |
Lines 274-280
def print_until_success(check_generator,
|
Link Here
|
---|
|
274 |
print(" ", "but", result.description, "succeded") |
274 |
print(" ", "but", result.description, "succeded") |
275 |
return last_error |
275 |
return last_error |
276 |
if first.is_success(): |
276 |
if first.is_success(): |
277 |
print(result.description, "succeded") |
277 |
try: |
|
|
278 |
print(result.description, "succeded") |
279 |
except UnboundLocalError: |
280 |
print("first.is_success") |
278 |
return None |
281 |
return None |
279 |
|
282 |
|
280 |
|
283 |
|
Lines 512-517
def do_smb_access_check(credentials, hos
|
Link Here
|
---|
|
512 |
except samba.NTSTATUSError as error: |
515 |
except samba.NTSTATUSError as error: |
513 |
if "x" in permissions and "r" not in permissions: |
516 |
if "x" in permissions and "r" not in permissions: |
514 |
result.add_description(" (note, that for x, r is needed)") |
517 |
result.add_description(" (note, that for x, r is needed)") |
|
|
518 |
if error.args[1] == "The object name is not found.": |
519 |
raise SMBError(error, error.args[1]) |
515 |
raise SMBAccessError(host_name, share_name, smb_path, permissions, error) |
520 |
raise SMBAccessError(host_name, share_name, smb_path, permissions, error) |
516 |
else: |
521 |
else: |
517 |
smb.close_file(fnum) |
522 |
smb.close_file(fnum) |
Lines 540-546
def find_smb_access_problem(user_name, c
|
Link Here
|
---|
|
540 |
group_sids = (security.dom_sid(security.SID_WORLD),) + tuple(gid_to_sid(gid) for gid in gids) |
545 |
group_sids = (security.dom_sid(security.SID_WORLD),) + tuple(gid_to_sid(gid) for gid in gids) |
541 |
|
546 |
|
542 |
selection = security.SECINFO_OWNER | security.SECINFO_GROUP | security.SECINFO_DACL |
547 |
selection = security.SECINFO_OWNER | security.SECINFO_GROUP | security.SECINFO_DACL |
543 |
acl = client.get_acl(smb_path, selection, security.SEC_FLAG_MAXIMUM_ALLOWED) |
548 |
try: |
|
|
549 |
acl = client.get_acl(smb_path, selection, security.SEC_FLAG_MAXIMUM_ALLOWED) |
550 |
except samba.NTSTATUSError as error: |
551 |
raise SMBError(host_name, error) |
544 |
|
552 |
|
545 |
if acl.dacl is not None and not acl.dacl.aces: |
553 |
if acl.dacl is not None and not acl.dacl.aces: |
546 |
return "No access because of emtpy DACL to {!r}".format(path) |
554 |
return "No access because of emtpy DACL to {!r}".format(path) |
|
857 |
args = parse_arguments() |
865 |
args = parse_arguments() |
858 |
for path in args.file_path: |
866 |
for path in args.file_path: |
859 |
if args.is_smb_path: |
867 |
if args.is_smb_path: |
860 |
path = resolve_smb_path_to_local_path(path, user=args.user) |
868 |
path = resolve_smb_path_to_local_path(path, user_name=args.user) |
861 |
run_checks(args, os.path.abspath(path)) |
869 |
run_checks(args, os.path.abspath(path)) |
862 |
|
870 |
|
863 |
|
871 |
|