Skip to content

fd.writable misreporting #302

@sufnlower

Description

@sufnlower

I noticed that fd.writable was returning true when a file was opened with 'rb'.

with smbclient.open_file(file, 'rb') as fd:
    if fd.writable:
        print("     [x] The above file is writable by the smbuser passed.")
        fd.write("test")

The print line was printed and fd.write resulted in an exception.

The following works for the purpose.

try:
    with smbclient.open_file(file,'w') as fdw:
        print("     [x] The above file is writable by the smbuser passed.")
except:
    print("     [ ] No write access to above file.")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions