Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jborean93/smbprotocol
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: a99f1b341f5c662b28b3a486c6d5ecb11316b7ae
Choose a base ref
..
head repository: jborean93/smbprotocol
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: a76c0ebda5a6578ec3df9617cf80b18ffe8c8a8a
Choose a head ref
Showing with 10 additions and 9 deletions.
  1. +10 −9 src/smbclient/_os.py
19 changes: 10 additions & 9 deletions src/smbclient/_os.py
Original file line number Diff line number Diff line change
@@ -105,6 +105,12 @@
)


class SMBFileStreamInformation(t.NamedTuple):
name: str
size: int
allocation_size: int


def is_remote_path(path: str) -> bool:
"""
Returns True iff the given path is a remote SMB path (rather than a local path).
@@ -1022,13 +1028,7 @@ def setxattr(path, attribute, value, flags=0, follow_symlinks=True, **kwargs):
set_info(transaction, ea_info)


class SMBFileStreamInformation(t.NamedTuple):
name: str
size: int
allocation_size: int


def liststreams(path: str, **kwargs: t.Any) -> list[SMBFileStreamInformation]:
def liststreams(path: str, follow_symlinks=True, **kwargs: t.Any) -> list[SMBFileStreamInformation]:
"""
Return a list of the alternative data streams on a path. Listed streams can
be opened by appending their name to the original path. An example call for
@@ -1042,14 +1042,15 @@ def liststreams(path: str, **kwargs: t.Any) -> list[SMBFileStreamInformation]:
```
:param path: The full UNC path to the file to get the list of streams for.
:param follow_symlinks: Whether to follow the symlink at path if encountered.
:param kwargs: Common SMB Session arguments for smbclient.
:return: List of streams on the file with each entry being a string.
"""

raw = SMBRawIO(
path,
mode="r",
share_access="r",
desired_access=FilePipePrinterAccessMask.FILE_READ_ATTRIBUTES,
create_options=0 if follow_symlinks else CreateOptions.FILE_OPEN_REPARSE_POINT,
**kwargs,
)